|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.LexGrid.LexBIG.example.BuildTreeForCode
public class BuildTreeForCode
Attempts to provide a tree, based on a focus code, that includes the following information:
- All paths from the hierarchy root to one or more focus codes. - Immediate children of every node in path to root - Indicator to show whether any unexpanded node can be further expandedThis example accepts two parameters... The first parameter is required, and must contain at least one code in a comma-delimited list. A tree is produced for each code. Time to produce the tree for each code is printed in milliseconds. In order to factor out costs of startup and shutdown, resolving multiple codes may offer a better overall estimate performance. The second parameter is optional, and can indicate the identifier of a supported hierarchy for the coding scheme to navigate when resolving child nodes. If not provided, "is_a" is assumed. Note: This example is written to handle sources that define the supported hierarchy in a uni-directional fashion. In particular, it does not support the Metathesaurus, which can define hierarchical relationships using both forward and backward navigation. For examples showing techniques to navigate the Metathesaurus, please refer to other examples such as BuildTreeForMetaCodeBySource, ListHierarchyMetaBySource and FindUMLSContextsForCUI.
Nested Class Summary | |
---|---|
protected class |
BuildTreeForCode.TreeItem
Inner class to hold tree items for printout. |
Constructor Summary | |
---|---|
BuildTreeForCode()
|
Method Summary | |
---|---|
protected void |
addChildren(BuildTreeForCode.TreeItem ti,
LexBIGService lbsvc,
LexBIGServiceConvenienceMethods lbscm,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
java.lang.String branchRootCode,
java.util.Set<java.lang.String> codesToExclude,
java.lang.String[] associationsToNavigate,
boolean associationsNavigatedFwd)
Populate child nodes for a single branch of the tree, and indicates whether further expansion (to grandchildren) is possible. |
protected void |
addPathFromRoot(BuildTreeForCode.TreeItem ti,
LexBIGService lbsvc,
LexBIGServiceConvenienceMethods lbscm,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
Association path,
java.lang.String[] associationsToNavigate,
boolean associationsNavigatedFwd,
java.util.Map<java.lang.String,EntityDescription> codesToDescriptions)
The given path represents a multi-tier association with associated concepts and targets. |
protected java.lang.String |
getCodeDescription(LexBIGService lbsvc,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
java.lang.String code)
Returns the entity description for the given code. |
protected java.lang.String |
getCodeDescription(ResolvedConceptReference ref)
Returns the entity description for the given resolved concept reference. |
protected java.lang.String |
getDirectionalLabel(LexBIGServiceConvenienceMethods lbscm,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
Association assoc,
boolean navigatedFwd)
Returns the label to display for the given association and directional indicator. |
protected AssociationList |
getPathsFromRoot(LexBIGService lbsvc,
LexBIGServiceConvenienceMethods lbscm,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
java.lang.String hierarchyID,
java.lang.String focusCode,
java.util.Map<java.lang.String,EntityDescription> codesToDescriptions)
Resolves one or more paths from the hierarchy root to the given code through a list of connected associations defined by the hierarchy. |
protected static SupportedHierarchy |
getSupportedHierarchy(LexBIGService lbsvc,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
java.lang.String hierarchyID)
Returns a description of the hierarchy defined by the given coding scheme and matching the specified ID. |
static void |
main(java.lang.String[] args)
Entry point for processing. |
protected void |
printTree(BuildTreeForCode.TreeItem ti,
java.lang.String focusCode,
int depth)
Prints the given tree item, recursing through all branches. |
protected AssociationList |
reverseAssoc(LexBIGService lbsvc,
LexBIGServiceConvenienceMethods lbscm,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
Association assoc,
AssociationList addTo,
java.util.Map<java.lang.String,EntityDescription> codeToEntityDescriptionMap)
Recursive call to reverse order of the given association list, adding results to the given list. |
void |
run(LexBIGService lbsvc,
LexBIGServiceConvenienceMethods lbscm,
java.lang.String scheme,
CodingSchemeVersionOrTag csvt,
SupportedHierarchy hierarchyDefn,
java.lang.String focusCode)
Prints the tree for an individual code. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BuildTreeForCode()
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- public void run(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, java.lang.String scheme, CodingSchemeVersionOrTag csvt, SupportedHierarchy hierarchyDefn, java.lang.String focusCode) throws LBException
LBException
protected void addPathFromRoot(BuildTreeForCode.TreeItem ti, LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, java.lang.String scheme, CodingSchemeVersionOrTag csvt, Association path, java.lang.String[] associationsToNavigate, boolean associationsNavigatedFwd, java.util.Map<java.lang.String,EntityDescription> codesToDescriptions) throws LBException
Nodes in the association act as the backbone for the display. For each backbone node, additional children are resolved one level deep along with an indication of further expandability.
LBException
protected void addChildren(BuildTreeForCode.TreeItem ti, LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, java.lang.String scheme, CodingSchemeVersionOrTag csvt, java.lang.String branchRootCode, java.util.Set<java.lang.String> codesToExclude, java.lang.String[] associationsToNavigate, boolean associationsNavigatedFwd) throws LBException
LBException
protected void printTree(BuildTreeForCode.TreeItem ti, java.lang.String focusCode, int depth)
ti
- protected java.lang.String getCodeDescription(LexBIGService lbsvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt, java.lang.String code) throws LBException
LBException
protected java.lang.String getCodeDescription(ResolvedConceptReference ref) throws LBException
LBException
protected java.lang.String getDirectionalLabel(LexBIGServiceConvenienceMethods lbscm, java.lang.String scheme, CodingSchemeVersionOrTag csvt, Association assoc, boolean navigatedFwd) throws LBException
LBException
protected AssociationList getPathsFromRoot(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, java.lang.String scheme, CodingSchemeVersionOrTag csvt, java.lang.String hierarchyID, java.lang.String focusCode, java.util.Map<java.lang.String,EntityDescription> codesToDescriptions) throws LBException
LBException
protected static SupportedHierarchy getSupportedHierarchy(LexBIGService lbsvc, java.lang.String scheme, CodingSchemeVersionOrTag csvt, java.lang.String hierarchyID) throws LBException
LBException
protected AssociationList reverseAssoc(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, java.lang.String scheme, CodingSchemeVersionOrTag csvt, Association assoc, AssociationList addTo, java.util.Map<java.lang.String,EntityDescription> codeToEntityDescriptionMap) throws LBException
LBException
|
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. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |