org.LexGrid.LexBIG.Impl.pagedgraph
Class AbstractQueryBuildingCodedNodeGraph

java.lang.Object
  extended by org.LexGrid.LexBIG.Impl.pagedgraph.AbstractCodedNodeGraph
      extended by org.LexGrid.LexBIG.Impl.pagedgraph.AbstractQueryBuildingCodedNodeGraph
All Implemented Interfaces:
java.io.Serializable, CodedNodeGraph
Direct Known Subclasses:
PagingCodedNodeGraphImpl

public abstract class AbstractQueryBuildingCodedNodeGraph
extends AbstractCodedNodeGraph

The Class AbstractQueryBuildingCodedNodeGraph.

Author:
Kevin Peterson
See Also:
Serialized Form

Constructor Summary
AbstractQueryBuildingCodedNodeGraph()
           
AbstractQueryBuildingCodedNodeGraph(java.lang.String codingSchemeUri, java.lang.String version, java.lang.String relationsContainerName)
          Instantiates a new paging coded node graph impl.
 
Method Summary
 java.lang.Boolean areCodesRelated(NameAndValue association, ConceptReference sourceCode, ConceptReference targetCode, boolean directOnly)
          Determine whether there is an directed edge (or transitive closure of an edge) from the source code to the target code in this graph.
protected  boolean doGetAreCodesRelated(ConceptReference sourceCode, ConceptReference targetCode, NameAndValue association, boolean directOnly)
           
 ResolvedConceptReferenceList doResolveAsList(ConceptReference graphFocus, boolean resolveForward, boolean resolveBackward, int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList propertyNames, CodedNodeSet.PropertyType[] propertyTypes, SortOptionList sortOptions, LocalNameList filterOptions, int maxToReturn, boolean keepLastAssociationLevelUnresolved)
          Do resolve as list.
protected  ResolvedConceptReferenceList doResolveAsValidatedParameterList(ConceptReference graphFocus, boolean resolveForward, boolean resolveBackward, int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList propertyNames, CodedNodeSet.PropertyType[] propertyTypes, SortOptionList sortOptions, LocalNameList filterOptions, int maxToReturn, boolean keepLastAssociationLevelUnresolved, CycleDetectingCallback cycleDetectingCallback)
           
protected abstract  ResolvedConceptReferenceList doResolveAsValidatedParameterList(ConceptReference graphFocus, boolean resolveForward, boolean resolveBackward, int resolveCodedEntryDepth, int resolveAssociationDepth, LocalNameList propertyNames, CodedNodeSet.PropertyType[] propertyTypes, SortOptionList sortOptions, LocalNameList filterOptions, int maxToReturn, boolean keepLastAssociationLevelUnresolved, PagingCodedNodeGraphImpl.ArtificialRootResolvePolicy artificialRootResolvePolicy, CycleDetectingCallback cycleDetectingCallback)
           
 java.lang.String getCodingSchemeUri()
          Gets the coding scheme uri.
 GraphQueryBuilder getGraphQueryBuilder()
          Gets the graph query builder.
 java.lang.String getRelationsContainerName()
          Gets the relations container name.
 java.lang.String getVersion()
          Gets the version.
 boolean isStrictFocusValidation()
           
 java.util.List<java.lang.String> listCodeRelationships(ConceptReference sourceCode, ConceptReference targetCode, boolean directOnly)
          Return a list of all of the associations in the graph that have the supplied source and target codes or, if directOnly is false, all associations whose transitive closure has the supplied associations.
 CodedNodeGraph restrictToAnonymous(java.lang.Boolean restrictToAnonymous)
          Return a graph that contains only the codes that are either Anonymous, Non-Anonymous, or Not Specified in the supplied list, and all edges that still have a source and target code remaining.
 CodedNodeGraph restrictToAssociations(NameAndValueList association, NameAndValueList associationQualifiers)
          Restrict the graph to the nodes that participate as a source or target of the named association and, if supplied, the named association qualifiers.
 CodedNodeGraph restrictToCodes(CodedNodeSet codes)
          Return a graph that contains only the codes that are present in the supplied list, and all edges that still have a source and target code remaining.
 CodedNodeGraph restrictToCodeSystem(java.lang.String codingScheme)
          Restrict the graph to codes (source and target) that originate from the supplied code system.
 CodedNodeGraph restrictToDirectionalNames(NameAndValueList directionalNames, NameAndValueList associationQualifiers)
          Restrict the graph to the nodes that participate as a source or target of an association whose directional name matches the one provided and, if supplied, the named association qualifiers.
 CodedNodeGraph restrictToEntityTypes(LocalNameList localNameList)
          Return a graph that contains only the codes that contain an Entity Type in the supplied list, and all edges that still have a source and target code remaining.
 CodedNodeGraph restrictToSourceCodes(CodedNodeSet codes)
          Restrict the graph to associations that have one of the codes in the supplied list as source codes.
 CodedNodeGraph restrictToSourceCodeSystem(java.lang.String codingScheme)
          Restrict the graph to edges that have codes from the specified code system as a source.
 CodedNodeGraph restrictToTargetCodes(CodedNodeSet codes)
          Restrict the graph to associations that have one of the codes in the supplied list as target codes.
 CodedNodeGraph restrictToTargetCodeSystem(java.lang.String codingScheme)
          Restrict the graph to edges that have codes from the specified code system as a target.
 void setCodingSchemeUri(java.lang.String codingSchemeUri)
          Sets the coding scheme uri.
 void setGraphQueryBuilder(GraphQueryBuilder graphQueryBuilder)
          Sets the graph query builder.
 void setRelationsContainerName(java.lang.String relationsContainerName)
          Sets the relations container name.
 void setStrictFocusValidation(boolean strictFocusValidation)
           
 void setVersion(java.lang.String version)
          Sets the version.
 CodedNodeSet toNodeList(ConceptReference graphFocus, boolean resolveForward, boolean resolveBackward, int resolveAssociationDepth, int maxToReturn)
          Transform the graph into a simple of list of code references, removing all association information.
 
Methods inherited from class org.LexGrid.LexBIG.Impl.pagedgraph.AbstractCodedNodeGraph
getLogger, intersect, isCodeInGraph, listCodeRelationships, resolveAsList, resolveAsList, resolveAsList, union
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractQueryBuildingCodedNodeGraph

public AbstractQueryBuildingCodedNodeGraph()

AbstractQueryBuildingCodedNodeGraph

public AbstractQueryBuildingCodedNodeGraph(java.lang.String codingSchemeUri,
                                           java.lang.String version,
                                           java.lang.String relationsContainerName)
                                    throws LBParameterException
Instantiates a new paging coded node graph impl.

Parameters:
codingSchemeUri - the coding scheme uri
version - the version
relationsContainerName - the relations container name
Throws:
LBParameterException
Method Detail

listCodeRelationships

public java.util.List<java.lang.String> listCodeRelationships(ConceptReference sourceCode,
                                                              ConceptReference targetCode,
                                                              boolean directOnly)
                                                       throws LBInvocationException,
                                                              LBParameterException
Description copied from interface: CodedNodeGraph
Return a list of all of the associations in the graph that have the supplied source and target codes or, if directOnly is false, all associations whose transitive closure has the supplied associations.

Parameters:
sourceCode - Source end of the association. If null, all sources for the specified target are included.
targetCode - Target end of the association. If null, all targets for the specified source are included.
directOnly - True means only direct associations are tested. False means that the transitive closure of transitive (and undefined) associations are tested for membership.

Note that while the class of the returned value appears to imply concepts only, each contained reference inherits from the more general CodedNodeReference and is capable of representing any type of node contained by the graph.

Returns:
The list of matching associations.
Throws:
LBInvocationException
LBParameterException

areCodesRelated

public java.lang.Boolean areCodesRelated(NameAndValue association,
                                         ConceptReference sourceCode,
                                         ConceptReference targetCode,
                                         boolean directOnly)
                                  throws LBInvocationException,
                                         LBParameterException
Description copied from interface: CodedNodeGraph
Determine whether there is an directed edge (or transitive closure of an edge) from the source code to the target code in this graph. The last parameter determines whether only direct associations are considered or whether the transitive closure of the edge is used.

Parameters:
association - Identifies the association to be tested. The name and value will be compared against the id and URI of supported associations for participating coding schemes.
sourceCode - Source code system/code to be tested.
targetCode - Target code system/code to be tested.
directOnly - True means only asserted association instances are tested. False means that, if the association is defined as transitive, the transitive closure of the association instances are tested.
Returns:
True if a directed edge exists; otherwise False.
Throws:
LBInvocationException
LBParameterException

doResolveAsList

public ResolvedConceptReferenceList doResolveAsList(ConceptReference graphFocus,
                                                    boolean resolveForward,
                                                    boolean resolveBackward,
                                                    int resolveCodedEntryDepth,
                                                    int resolveAssociationDepth,
                                                    LocalNameList propertyNames,
                                                    CodedNodeSet.PropertyType[] propertyTypes,
                                                    SortOptionList sortOptions,
                                                    LocalNameList filterOptions,
                                                    int maxToReturn,
                                                    boolean keepLastAssociationLevelUnresolved)
                                             throws LBInvocationException,
                                                    LBParameterException
Description copied from class: AbstractCodedNodeGraph
Do resolve as list.

Specified by:
doResolveAsList in class AbstractCodedNodeGraph
Parameters:
graphFocus - the graph focus
resolveForward - the resolve forward
resolveBackward - the resolve backward
resolveCodedEntryDepth - the resolve coded entry depth
resolveAssociationDepth - the resolve association depth
propertyNames - the property names
propertyTypes - the property types
sortOptions - the sort options
filterOptions - the filter options
maxToReturn - the max to return
keepLastAssociationLevelUnresolved - the keep last association level unresolved
Returns:
the resolved concept reference list
Throws:
LBInvocationException - the LB invocation exception
LBParameterException - the LB parameter exception

doResolveAsValidatedParameterList

protected ResolvedConceptReferenceList doResolveAsValidatedParameterList(ConceptReference graphFocus,
                                                                         boolean resolveForward,
                                                                         boolean resolveBackward,
                                                                         int resolveCodedEntryDepth,
                                                                         int resolveAssociationDepth,
                                                                         LocalNameList propertyNames,
                                                                         CodedNodeSet.PropertyType[] propertyTypes,
                                                                         SortOptionList sortOptions,
                                                                         LocalNameList filterOptions,
                                                                         int maxToReturn,
                                                                         boolean keepLastAssociationLevelUnresolved,
                                                                         CycleDetectingCallback cycleDetectingCallback)
                                                                  throws LBInvocationException,
                                                                         LBParameterException
Throws:
LBInvocationException
LBParameterException

doResolveAsValidatedParameterList

protected abstract ResolvedConceptReferenceList doResolveAsValidatedParameterList(ConceptReference graphFocus,
                                                                                  boolean resolveForward,
                                                                                  boolean resolveBackward,
                                                                                  int resolveCodedEntryDepth,
                                                                                  int resolveAssociationDepth,
                                                                                  LocalNameList propertyNames,
                                                                                  CodedNodeSet.PropertyType[] propertyTypes,
                                                                                  SortOptionList sortOptions,
                                                                                  LocalNameList filterOptions,
                                                                                  int maxToReturn,
                                                                                  boolean keepLastAssociationLevelUnresolved,
                                                                                  PagingCodedNodeGraphImpl.ArtificialRootResolvePolicy artificialRootResolvePolicy,
                                                                                  CycleDetectingCallback cycleDetectingCallback)
                                                                           throws LBInvocationException,
                                                                                  LBParameterException
Throws:
LBInvocationException
LBParameterException

doGetAreCodesRelated

protected boolean doGetAreCodesRelated(ConceptReference sourceCode,
                                       ConceptReference targetCode,
                                       NameAndValue association,
                                       boolean directOnly)
                                throws LBParameterException,
                                       LBInvocationException
Throws:
LBParameterException
LBInvocationException

restrictToAssociations

public CodedNodeGraph restrictToAssociations(NameAndValueList association,
                                             NameAndValueList associationQualifiers)
                                      throws LBInvocationException,
                                             LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to the nodes that participate as a source or target of the named association and, if supplied, the named association qualifiers.

Parameters:
association - List of associations used to restrict the graph. The name and value for each item in the list will be compared against the id and URI of supported associations for participating coding schemes.
associationQualifiers - If supplied, restriction only applies to associations that are qualified by one or more of the supplied qualifiers. The name and value for each item in the list will be compared against the id and URI of supported association qualifiers for participating coding schemes.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

restrictToCodeSystem

public CodedNodeGraph restrictToCodeSystem(java.lang.String codingScheme)
                                    throws LBInvocationException,
                                           LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to codes (source and target) that originate from the supplied code system. Note: edges defined by other code systems will still be resolved if associated with both source and target nodes for the restricted code system.

Parameters:
codingScheme - The local name or URI of the coding scheme to filter on.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

restrictToAnonymous

public CodedNodeGraph restrictToAnonymous(java.lang.Boolean restrictToAnonymous)
                                   throws LBInvocationException,
                                          LBParameterException
Description copied from interface: CodedNodeGraph
Return a graph that contains only the codes that are either Anonymous, Non-Anonymous, or Not Specified in the supplied list, and all edges that still have a source and target code remaining. A True value signifies Anonymous codes only A False value signifies Non-Anonymous only A Null value signifies all codes will matched

Returns:
the coded node graph
Throws:
LBInvocationException - the LB invocation exception
LBParameterException - the LB parameter exception

restrictToEntityTypes

public CodedNodeGraph restrictToEntityTypes(LocalNameList localNameList)
                                     throws LBInvocationException,
                                            LBParameterException
Description copied from interface: CodedNodeGraph
Return a graph that contains only the codes that contain an Entity Type in the supplied list, and all edges that still have a source and target code remaining.

Parameters:
localNameList - the local name list
Returns:
the coded node graph
Throws:
LBInvocationException - the LB invocation exception
LBParameterException - the LB parameter exception

restrictToCodes

public CodedNodeGraph restrictToCodes(CodedNodeSet codes)
                               throws LBInvocationException,
                                      LBParameterException
Description copied from interface: CodedNodeGraph
Return a graph that contains only the codes that are present in the supplied list, and all edges that still have a source and target code remaining.

Parameters:
codes - Codes to filter on.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

restrictToDirectionalNames

public CodedNodeGraph restrictToDirectionalNames(NameAndValueList directionalNames,
                                                 NameAndValueList associationQualifiers)
                                          throws LBInvocationException,
                                                 LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to the nodes that participate as a source or target of an association whose directional name matches the one provided and, if supplied, the named association qualifiers. A directional name is considered to be either the forward or reverse label registered to an association defined by the ontology. Forward and reverse names are optionally assigned to each association. For example, an association 'lineage' may have a forward name 'ancestorOf' and reverse name 'descendantOf'.

Parameters:
directionalNames - List of directionalNames used to restrict the graph. A directional name is compared against the forward and reverse names for defined associations. If a given name matches more than one forward or reverse label, all corresponding associations are included in the restriction.
associationQualifiers - If supplied, restriction only applies to associations that are qualified by one or more of the supplied qualifiers. The name and value for each item in the list will be compared against the id and URI of supported association qualifiers for participating coding schemes.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException - ,LBParameterException
LBParameterException

restrictToSourceCodeSystem

public CodedNodeGraph restrictToSourceCodeSystem(java.lang.String codingScheme)
                                          throws LBInvocationException,
                                                 LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to edges that have codes from the specified code system as a source.

Parameters:
codingScheme - The local name or URI of the coding scheme to filter on.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

restrictToSourceCodes

public CodedNodeGraph restrictToSourceCodes(CodedNodeSet codes)
                                     throws LBInvocationException,
                                            LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to associations that have one of the codes in the supplied list as source codes.

Parameters:
codes - Codes to filter on.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

restrictToTargetCodeSystem

public CodedNodeGraph restrictToTargetCodeSystem(java.lang.String codingScheme)
                                          throws LBInvocationException,
                                                 LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to edges that have codes from the specified code system as a target.

Parameters:
codingScheme - The local name or URI of the coding scheme to filter on.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

restrictToTargetCodes

public CodedNodeGraph restrictToTargetCodes(CodedNodeSet codes)
                                     throws LBInvocationException,
                                            LBParameterException
Description copied from interface: CodedNodeGraph
Restrict the graph to associations that have one of the codes in the supplied list as target codes.

Parameters:
codes - Codes to filter on.
Returns:
A new CodedNodeGraph representing the filtered result.
Throws:
LBInvocationException
LBParameterException

toNodeList

public CodedNodeSet toNodeList(ConceptReference graphFocus,
                               boolean resolveForward,
                               boolean resolveBackward,
                               int resolveAssociationDepth,
                               int maxToReturn)
                        throws LBInvocationException,
                               LBParameterException
Description copied from interface: CodedNodeGraph
Transform the graph into a simple of list of code references, removing all association information.

Parameters:
graphFocus - Set the top or "focus" node of the graph. If present, only the nodes that are reachable via this node will be returned. If null, nodes with no incoming or outgoing associations are used as starting points for navigation of forward and reverse relationships, respectively.
resolveForward - True means include all "forward" (source->target) associations.
resolveBackward - True means render all "reverse" (target->source) associations
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.
maxToReturn - Maximum number of entries to return; a value less than 1 indicates to return unlimited entries (to the limit specified in the runtime configuration file).
Returns:
A set with matching items, up to the maximum number specified. Note that in the event that a maximum number 'n' is specified and exactly 'n' items are returned, there is currently no flag or notification provided to indicate whether all available items were returned.
Throws:
LBInvocationException
LBParameterException

getGraphQueryBuilder

public GraphQueryBuilder getGraphQueryBuilder()
Gets the graph query builder.

Returns:
the graph query builder

setGraphQueryBuilder

public void setGraphQueryBuilder(GraphQueryBuilder graphQueryBuilder)
Sets the graph query builder.

Parameters:
graphQueryBuilder - the new graph query builder

getCodingSchemeUri

public java.lang.String getCodingSchemeUri()
Gets the coding scheme uri.

Returns:
the coding scheme uri

setCodingSchemeUri

public void setCodingSchemeUri(java.lang.String codingSchemeUri)
Sets the coding scheme uri.

Parameters:
codingSchemeUri - the new coding scheme uri

getVersion

public java.lang.String getVersion()
Gets the version.

Returns:
the version

setVersion

public void setVersion(java.lang.String version)
Sets the version.

Parameters:
version - the new version

getRelationsContainerName

public java.lang.String getRelationsContainerName()
Gets the relations container name.

Returns:
the relations container name

setRelationsContainerName

public void setRelationsContainerName(java.lang.String relationsContainerName)
Sets the relations container name.

Parameters:
relationsContainerName - the new relations container name

setStrictFocusValidation

public void setStrictFocusValidation(boolean strictFocusValidation)

isStrictFocusValidation

public boolean isStrictFocusValidation()

Copyright: (c) 2004-2006 Mayo Foundation for Medical Education and Research (MFMER). All rights reserved. MAYO, MAYO CLINIC, and the triple-shield Mayo logo are trademarks and service marks of MFMER.