public class GHolder
extends java.lang.Object
Constructor and Description |
---|
GHolder(java.lang.String internalCodingSchemeName,
java.lang.String internalVersionString,
ConceptReference focusNode,
boolean resolveForward,
boolean resolveReverse)
Constructs a new container to hold concept graph representations.
|
Modifier and Type | Method and Description |
---|---|
ConceptReference |
addAssociation(java.lang.String sourceCodeSystem,
java.lang.String sourceCodeNamespace,
java.lang.String sourceCode,
java.lang.String[] sourceCodeTypes,
java.lang.String sourceCodeEntityDescription,
java.lang.String relationName,
java.lang.String associationName,
java.lang.String targetCodeSystem,
java.lang.String targetCodeNamespace,
java.lang.String targetCode,
java.lang.String[] targetCodeTypes,
java.lang.String targetCodeEntityDescription,
NameAndValueList qualifiers,
boolean forward,
java.lang.String internalCodeSystemName,
java.lang.String internalVersionString)
Add an edge to the graph.
|
protected void |
addAssociationChildren(GNode oldParent,
GAssociation oldAssoc,
GNode newParent,
GAssociation newAssoc)
Copy child nodes from the old parent/association to the new.
|
void |
addAssociationInfo(java.lang.String sourceCodeSystem,
java.lang.String sourceCodeNamespace,
java.lang.String sourceCode,
java.lang.String[] sourceCodeTypes,
java.lang.String sourceCodeEntityDescription,
java.lang.String relationName,
java.lang.String associationName,
java.lang.String targetCodeSystem,
java.lang.String targetCodeNamespace,
java.lang.String targetCode,
java.lang.String[] targetCodeTypes,
java.lang.String targetCodeEntityDescription,
NameAndValueList qualifiers,
boolean forward,
java.lang.String internalCodeSystemName,
java.lang.String internalVersionString)
Add an edge to the graph.
|
protected void |
addNode(GNode node)
Basic addition of a node to those tracked by the graph.
|
ConceptReference |
addNode(java.lang.String codeSystem,
java.lang.String codeNamespace,
java.lang.String code,
java.lang.String[] codeTypes,
java.lang.String entityDescription,
java.lang.String internalCodeSystemName,
java.lang.String internalVersion,
boolean forward)
Returns a graph node based on the given information; a new node is added
to the graph if necessary.
|
protected AssociationList |
buildAssociationList(GNode node,
boolean forward,
int currentDepth,
int resolveCodedEntryDepth,
int resolveAssociationDepth,
LocalNameList restrictToProperties,
CodedNodeSet.PropertyType[] restrictToPropertyTypes,
SortOptionList sortBy,
Filter[] filters,
boolean keepLastAssociationLevelUnresolved)
Create and return the list of associations for the given node, resolved
to the specified depth and modified according to parameter values.
|
protected ResolvedConceptReference |
buildResolvedConceptReference(GNode currentNode,
int resolveCodedEntryDepth,
int resolveAssociationDepth,
LocalNameList restrictToProperties,
CodedNodeSet.PropertyType[] restrictToPropertyTypes,
SortOptionList sortByProperty,
Filter[] filters,
boolean keepLastAssociationLevelUnresolved) |
protected GAssociationInfo |
getAssociationInfo(java.lang.String internalCodeSystemName,
java.lang.String internalVersionString,
java.lang.String associationName,
java.lang.String relationName)
Returns a shared structure containing identifying information for the
given association; a new information object is automatically created if
necessary.
|
protected java.util.Iterator<GNode> |
getChildlessNodes(SortOptionList sortBy)
Returns all nodes maintained by the graph that are target but not source
of any relationship.
|
protected GNode |
getNode(java.lang.String codeSystem,
java.lang.String codeNamespace,
java.lang.String code,
java.lang.String[] codeTypes,
java.lang.String entityDescription,
boolean flagParentlessIfNew,
boolean flagChildlessIfNew,
java.lang.String internalCodeSystemName,
java.lang.String internalVersionString,
java.lang.String associationName)
Locates and returns a graph node based on the given information; a new
node is added to the graph if necessary.
|
int |
getNodeCount()
Returns the total number of nodes tracked by the graph.
|
CodedNodeSet |
getNodeList() |
protected java.util.Iterator<GNode> |
getParentlessNodes(SortOptionList sortBy)
Returns all nodes maintained by the graph that are source but not target
of any relationship.
|
ResolvedConceptReferenceList |
getResolvedConceptReferenceList(int resolveCodedEntryDepth,
int resolveAssociationDepth,
LocalNameList restrictToProperties,
CodedNodeSet.PropertyType[] restrictToPropertyTypes,
SortOptionList sortByProperty,
LocalNameList filterOptions,
boolean keepLastAssociationLevelUnresolved)
Returns the fully resolved contents of the graph.
|
protected java.util.Iterator<GNode> |
getSortedNodeIterator(SortOptionList sortBy,
java.util.Set<GNode> nodes)
Returns an iterator that will sort the given nodes according to the
specified sort options.
|
void |
intersection(GHolder holder)
Performs a boolean intersection of this graph holder with another.
|
protected boolean |
isResultsSkipped() |
protected void |
listHelper(ResolvedConceptReferenceList list,
GNode currentNode,
int resolveCodedEntryDepth,
int resolveAssociationDepth,
LocalNameList restrictToProperties,
CodedNodeSet.PropertyType[] restrictToPropertyTypes,
SortOptionList sortByProperty,
Filter[] filters,
boolean keepLastAssociationLevelUnresolved) |
protected void |
removeNode(java.lang.String nodeKey)
Removes the node identified by the given key from those tracked by the
graph.
|
protected void |
resetNodePrintedFlags()
For each node that is tracked, this class maintains an indication of
whether or not the node has been included in the results in order to
prevent recursion.
|
void |
setResultsSkipped(boolean resultsSkipped) |
java.lang.String |
toString() |
void |
union(GHolder holder)
Performs a boolean union of this graph holder with another.
|
protected Filter[] |
validateFilters(LocalNameList filterOptions) |
public GHolder(java.lang.String internalCodingSchemeName, java.lang.String internalVersionString, ConceptReference focusNode, boolean resolveForward, boolean resolveReverse)
internalCodingSchemeName
- The coding scheme name for associated nodes; not null.internalVersionString
- The coding scheme version for associated nodes; not null.focusNode
- The starting point for resolved relations; null for absolute
root.resolveForward
- Whether relations are to be resolved in the forward direction.resolveReverse
- Whether relations are to be resolved in the reverse direction.public ConceptReference addAssociation(java.lang.String sourceCodeSystem, java.lang.String sourceCodeNamespace, java.lang.String sourceCode, java.lang.String[] sourceCodeTypes, java.lang.String sourceCodeEntityDescription, java.lang.String relationName, java.lang.String associationName, java.lang.String targetCodeSystem, java.lang.String targetCodeNamespace, java.lang.String targetCode, java.lang.String[] targetCodeTypes, java.lang.String targetCodeEntityDescription, NameAndValueList qualifiers, boolean forward, java.lang.String internalCodeSystemName, java.lang.String internalVersionString) throws MissingResourceException, UnexpectedInternalError, LBParameterException
If the association is new, return a reference to the concept defined by the association endpoint based on specified direction (if forward, this is the target concept; if reverse, it is the source concept). If the association is already defined, returns null.
sourceCodeSystem
- sourceCodeNamespace
- sourceCode
- sourceCodeTypes
- relationName
- associationName
- targetCodeSystem
- targetCodeNamespace
- targetCode
- targetCodeTypes
- qualifiers
- forward
- internalCodeSystemName
- internalVersionString
- MissingResourceException
UnexpectedInternalError
LBParameterException
public void addAssociationInfo(java.lang.String sourceCodeSystem, java.lang.String sourceCodeNamespace, java.lang.String sourceCode, java.lang.String[] sourceCodeTypes, java.lang.String sourceCodeEntityDescription, java.lang.String relationName, java.lang.String associationName, java.lang.String targetCodeSystem, java.lang.String targetCodeNamespace, java.lang.String targetCode, java.lang.String[] targetCodeTypes, java.lang.String targetCodeEntityDescription, NameAndValueList qualifiers, boolean forward, java.lang.String internalCodeSystemName, java.lang.String internalVersionString) throws MissingResourceException, UnexpectedInternalError, LBParameterException
If the association is new, return a reference to the concept defined by the association endpoint based on specified direction (if forward, this is the target concept; if reverse, it is the source concept). If the association is already defined, returns null.
sourceCodeSystem
- sourceCodeNamespace
- sourceCode
- sourceCodeTypes
- relationName
- associationName
- targetCodeSystem
- targetCodeNamespace
- targetCode
- targetCodeTypes
- qualifiers
- forward
- internalCodeSystemName
- internalVersionString
- MissingResourceException
UnexpectedInternalError
LBParameterException
protected void addAssociationChildren(GNode oldParent, GAssociation oldAssoc, GNode newParent, GAssociation newAssoc)
oldParent
- oldAssoc
- newParent
- newAssoc
- protected void addNode(GNode node)
node
- public ConceptReference addNode(java.lang.String codeSystem, java.lang.String codeNamespace, java.lang.String code, java.lang.String[] codeTypes, java.lang.String entityDescription, java.lang.String internalCodeSystemName, java.lang.String internalVersion, boolean forward) throws MissingResourceException, UnexpectedInternalError
codeSystem
- codeNamespace
- code
- codeTypes
- internalCodeSystemName
- internalVersion
- forward
- MissingResourceException
UnexpectedInternalError
protected AssociationList buildAssociationList(GNode node, boolean forward, int currentDepth, int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList restrictToProperties, CodedNodeSet.PropertyType[] restrictToPropertyTypes, SortOptionList sortBy, Filter[] filters, boolean keepLastAssociationLevelUnresolved) throws LBParameterException, UnexpectedInternalError, MissingResourceException
node
- Focus node.forward
- Indicates whether the we are resolving source or target
relations for the node.currentDepth
- Tracks depth for purposes of recursion.resolveCodedEntryDepth
- Depth in the graph to resolve coded entries. -1 means don't
resolve anything - just return the concept references, 0 means
resolve just the root nodes, 1 means resolve 1 deep, etc.resolveAssociationDepth
- Number of hops to resolve associations. 0 means leave all
associations unresolved, 1 means immediate neighbors, etc. -1
means follow the entire closure of the graph.propertyNames
- Local names of properties to resolve. If not empty and not
null, only properties matching the given names are included
for resolved concepts.propertyTypes
- Indicates whether to resolve only specific property
categories, regardless of the assigned name. Any of the
enumerated PropertyType values can be specified. If not empty
and not null, only properties matching the given types are
included for resolved concepts.sortOptions
- List of sort options to apply during resolution. If supplied,
the sort algorithms will be applied in the order provided. Any
algorithms not valid to be applied in context of node set
iteration, as specified in the sort extension description,
will result in a parameter exception. Available algorithms can
be retrieved through the LexBIGService getSortExtensions()
method after being defined to the LexBIGServiceManager
extension registry.filters
- LBParameterException
UnexpectedInternalError
MissingResourceException
protected ResolvedConceptReference buildResolvedConceptReference(GNode currentNode, int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList restrictToProperties, CodedNodeSet.PropertyType[] restrictToPropertyTypes, SortOptionList sortByProperty, Filter[] filters, boolean keepLastAssociationLevelUnresolved) throws UnexpectedInternalError, MissingResourceException, LBParameterException
protected GAssociationInfo getAssociationInfo(java.lang.String internalCodeSystemName, java.lang.String internalVersionString, java.lang.String associationName, java.lang.String relationName) throws LBParameterException, UnexpectedInternalError, MissingResourceException
internalCodeSystemName
- internalVersionString
- associationName
- relationName
- LBParameterException
UnexpectedInternalError
MissingResourceException
protected java.util.Iterator<GNode> getChildlessNodes(SortOptionList sortBy)
sortBy
- protected GNode getNode(java.lang.String codeSystem, java.lang.String codeNamespace, java.lang.String code, java.lang.String[] codeTypes, java.lang.String entityDescription, boolean flagParentlessIfNew, boolean flagChildlessIfNew, java.lang.String internalCodeSystemName, java.lang.String internalVersionString, java.lang.String associationName) throws MissingResourceException, UnexpectedInternalError
codeSystem
- codeNamespace
- code
- codeTypes
- flagParentlessIfNew
- flagChildlessIfNew
- internalCodeSystemName
- internalVersionString
- associationName
- MissingResourceException
UnexpectedInternalError
public int getNodeCount()
public CodedNodeSet getNodeList() throws LBInvocationException
LBInvocationException
protected java.util.Iterator<GNode> getParentlessNodes(SortOptionList sortBy)
sortBy
- public ResolvedConceptReferenceList getResolvedConceptReferenceList(int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList restrictToProperties, CodedNodeSet.PropertyType[] restrictToPropertyTypes, SortOptionList sortByProperty, LocalNameList filterOptions, boolean keepLastAssociationLevelUnresolved) throws MissingResourceException, UnexpectedInternalError, LBParameterException
resolveCodedEntryDepth
- resolveAssociationDepth
- restrictToProperties
- restrictToPropertyTypes
- sortByProperty
- filterOptions
- MissingResourceException
UnexpectedInternalError
LBParameterException
protected java.util.Iterator<GNode> getSortedNodeIterator(SortOptionList sortBy, java.util.Set<GNode> nodes)
sortBy
- nodes
- public void intersection(GHolder holder)
holder
- protected boolean isResultsSkipped()
protected void listHelper(ResolvedConceptReferenceList list, GNode currentNode, int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList restrictToProperties, CodedNodeSet.PropertyType[] restrictToPropertyTypes, SortOptionList sortByProperty, Filter[] filters, boolean keepLastAssociationLevelUnresolved) throws UnexpectedInternalError, MissingResourceException, LBParameterException
protected void removeNode(java.lang.String nodeKey)
nodeKey
- protected void resetNodePrintedFlags()
public void setResultsSkipped(boolean resultsSkipped)
resultsSkipped
- the resultsSkipped to setpublic void union(GHolder holder)
holder
- protected Filter[] validateFilters(LocalNameList filterOptions) throws LBParameterException
LBParameterException
public java.lang.String toString()
toString
in class java.lang.Object