本文整理汇总了Java中org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList类的典型用法代码示例。如果您正苦于以下问题:Java AssociatedConceptList类的具体用法?Java AssociatedConceptList怎么用?Java AssociatedConceptList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssociatedConceptList类属于org.LexGrid.LexBIG.DataModel.Collections包,在下文中一共展示了AssociatedConceptList类的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: printChain
点赞 3
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Displays the given concept chain, taking into account any branches
* that might be imbedded.
* @param assoc
* @param depth
* @throws LBException
*/
protected void printChain(Association assoc, int depth, boolean displayConcepts)
throws LBException {
StringBuffer indent = new StringBuffer();
for (int i = 0; i <= depth; i++)
indent.append(INDENT);
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int i = 0; i < concepts.getAssociatedConceptCount(); i++) {
// Print focus of this branch ...
AssociatedConcept concept = concepts.getAssociatedConcept(i);
String desc = concept.getEntityDescription() == null ?
"NO DESCRIPTION" : concept.getEntityDescription().getContent();
if (displayConcepts)
_buffer.append(indent + assoc.getAssociationName() + "->" +
concept.getConceptCode() + ":" + desc + "\n");
// Find and recurse printing for next batch ...
AssociationList nextLevel = concept.getSourceOf();
if (nextLevel != null && nextLevel.getAssociationCount() != 0)
for (int j = 0; j < nextLevel.getAssociationCount(); j++)
printChain(nextLevel.getAssociation(j), depth + 1, displayConcepts);
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:31,
代码来源:ListHierarchyPathToRoot2.java
示例2: printChain
点赞 3
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Displays the given concept chain, taking into account any branches that
* might be imbedded.
*
* @param assoc
* @param depth
* @throws LBException
*/
protected void printChain(Association assoc, int depth) throws LBException {
StringBuffer indent = new StringBuffer();
for (int i = 0; i <= depth; i++)
indent.append(" ");
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int i = 0; i < concepts.getAssociatedConceptCount(); i++) {
// Print focus of this branch ...
AssociatedConcept concept = concepts.getAssociatedConcept(i);
Util_displayMessage(new StringBuffer(indent).append(assoc.getAssociationName()).append("->").append(
concept.getConceptCode()).append(':').append(
concept.getEntityDescription() == null ? "NO DESCRIPTION" : concept.getEntityDescription()
.getContent()).toString());
// Find and recurse printing for next batch ...
AssociationList nextLevel = concept.getSourceOf();
if (nextLevel != null && nextLevel.getAssociationCount() != 0)
for (int j = 0; j < nextLevel.getAssociationCount(); j++)
printChain(nextLevel.getAssociation(j), depth + 1);
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:30,
代码来源:BuildTreeForCode2.java
示例3: printChain
点赞 3
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Displays the given concept chain, taking into account any branches
* that might be imbedded.
* @param assoc
* @param depth
* @throws LBException
*/
protected void printChain(Association assoc, int depth) throws LBException {
StringBuffer indent = new StringBuffer();
for (int i = 0; i <= depth; i++)
indent.append(" ");
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int i = 0; i < concepts.getAssociatedConceptCount(); i++) {
// Print focus of this branch ...
AssociatedConcept concept = concepts.getAssociatedConcept(i);
Util.displayMessage(
new StringBuffer(indent)
.append(assoc.getAssociationName()).append("->")
.append(concept.getConceptCode()).append(':')
.append(concept.getEntityDescription() == null ? "NO DESCRIPTION" : concept.getEntityDescription().getContent())
.toString());
// Find and recurse printing for next batch ...
AssociationList nextLevel = concept.getSourceOf();
if (nextLevel != null && nextLevel.getAssociationCount() != 0)
for (int j = 0; j < nextLevel.getAssociationCount(); j++)
printChain(nextLevel.getAssociation(j), depth + 1);
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:31,
代码来源:ListHierarchyPathToRoot.java
示例4: associationListToDirectoryEntry
点赞 3
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
protected <T> List<T> associationListToDirectoryEntry(
AssociationList list, TransformClosure<T> closure, int start, int max){
List<T> returnList = new ArrayList<T>();
int counter = 0;
if(list != null){
for(Association association : list.getAssociation()){
AssociatedConceptList conceptList = association.getAssociatedConcepts();
if(conceptList != null){
for(AssociatedConcept ac : conceptList.getAssociatedConcept()){
if(counter >= start && returnList.size() < max){
returnList.add(closure.transform(ac));
}
counter++;
}
}
}
}
return returnList;
}
开发者ID:NCIP,
项目名称:lexevs-service,
代码行数:22,
代码来源:LexEvsAssociationEntityQueryService.java
示例5: processForAnonomousNodes
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
protected static Association processForAnonomousNodes(Association assoc){
//clone Association except associatedConcepts
Association temp = new Association();
temp.setAssociatedData(assoc.getAssociatedData());
temp.setAssociationName(assoc.getAssociationName());
temp.setAssociationReference(assoc.getAssociationReference());
temp.setDirectionalName(assoc.getDirectionalName());
temp.setAssociatedConcepts(new AssociatedConceptList());
for(int i = 0; i < assoc.getAssociatedConcepts().getAssociatedConceptCount(); i++)
{
//Conditionals to deal with anonymous nodes and UMLS top nodes "V-X"
//The first three allow UMLS traversal to top node.
//The last two are specific to owl anonymous nodes which can act like false
//top nodes.
if(
assoc.getAssociatedConcepts().getAssociatedConcept(i).getReferencedEntry() != null &&
assoc.getAssociatedConcepts().getAssociatedConcept(i).getReferencedEntry().getIsAnonymous() != null &&
assoc.getAssociatedConcepts().getAssociatedConcept(i).getReferencedEntry().getIsAnonymous() != false &&
!assoc.getAssociatedConcepts().getAssociatedConcept(i).getConceptCode().equals("@") &&
!assoc.getAssociatedConcepts().getAssociatedConcept(i).getConceptCode().equals("@@")
)
{
//do nothing
}
else{
temp.getAssociatedConcepts().addAssociatedConcept(assoc.getAssociatedConcepts().getAssociatedConcept(i));
}
}
return temp;
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:32,
代码来源:SearchUtils.java
示例6: printLevelPrev
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Displays ancestors for a code within the specified hierarchy
* up to the given distance or until paths to root nodes are exhausted,
* recursing as necessary.
* @param lbcsm
* @param scheme
* @param csvt
* @param hierarchyID
* @param code
* @param maxDistance
* @param currentDistance
* @throws LBException
*/
protected void printLevelPrev(
LexBIGServiceConvenienceMethods lbscm,
String scheme,
CodingSchemeVersionOrTag csvt,
String hierarchyID,
String code,
int maxDistance,
int currentDistance) throws LBException
{
if (maxDistance < 0 || currentDistance < maxDistance) {
StringBuffer indent = new StringBuffer();
for (int i = 0; i <= currentDistance; i++)
indent.append(" ");
AssociationList associations = lbscm.getHierarchyLevelPrev(scheme, csvt, hierarchyID, code, false, null);
for (int i = 0; i < associations.getAssociationCount(); i++) {
Association assoc = associations.getAssociation(i);
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int j = 0; j < concepts.getAssociatedConceptCount(); j++) {
AssociatedConcept concept = concepts.getAssociatedConcept(j);
String prevCode = concept.getConceptCode();
String prevDesc = concept.getEntityDescription() == null ? "NO DESCRIPTION" : concept.getEntityDescription().getContent();
Util.displayMessage(indent + assoc.getDirectionalName() + "<-" + prevCode + ":" + prevDesc);
printLevelPrev(lbscm, scheme, csvt, hierarchyID, prevCode, maxDistance, currentDistance + 1);
}
}
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:42,
代码来源:ListHierarchyByCode.java
示例7: printLevelNext
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Displays descendents for a code within the specified hierarchy
* up to the given distance or until all paths to leaf nodes is exhausted,
* recursing as necessary.
* @param lbscm
* @param scheme
* @param csvt
* @param hierarchyID
* @param code
* @param maxDistance
* @param currentDistance
* @throws LBException
*/
protected void printLevelNext(
LexBIGServiceConvenienceMethods lbscm,
String scheme,
CodingSchemeVersionOrTag csvt,
String hierarchyID,
String code,
int maxDistance,
int currentDistance) throws LBException
{
if (maxDistance < 0 || currentDistance < maxDistance) {
StringBuffer indent = new StringBuffer();
for (int i = 0; i <= currentDistance; i++)
indent.append(" ");
AssociationList associations = lbscm.getHierarchyLevelNext(scheme, csvt, hierarchyID, code, false, null);
for (int i = 0; i < associations.getAssociationCount(); i++) {
Association assoc = associations.getAssociation(i);
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int j = 0; j < concepts.getAssociatedConceptCount(); j++) {
AssociatedConcept concept = concepts.getAssociatedConcept(j);
String nextCode = concept.getConceptCode();
String nextDesc = concept.getEntityDescription().getContent();
Util.displayMessage(indent + assoc.getDirectionalName() + "->" + nextCode + ":" + nextDesc);
printLevelNext(lbscm, scheme, csvt, hierarchyID, nextCode, maxDistance, currentDistance + 1);
}
}
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:42,
代码来源:ListHierarchyByCode.java
示例8: printChainForNode
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Handles recursive display of hierarchy for an individual node,
* up to the maximum specified depth.
* @param lbscm
* @param scheme
* @param sab
* @param csvt
* @param ref
* @param currentDepth
* @param maxDepth
* @param assocName
* @throws LBException
*/
protected void printChainForNode(
LexBIGServiceConvenienceMethods lbscm,
String scheme,
String sab,
CodingSchemeVersionOrTag csvt,
ResolvedConceptReference ref,
int currentDepth,
int maxDepth,
String assocName) throws LBException
{
// Print the referenced node; indent based on current depth ...
StringBuffer indent = new StringBuffer();
for (int i = 0; i <= currentDepth; i++)
indent.append(" ");
String code = ref.getConceptCode();
EntityDescription desc = ref.getEntityDescription();
Util.displayMessage(new StringBuffer()
.append(indent)
.append(assocName != null ? (assocName+"->") : "")
.append(code).append(':').append(desc != null ? desc.getContent() : "")
.toString());
if (currentDepth < maxDepth) {
AssociationList aList = lbscm.getHierarchyLevelNext(
scheme, csvt, null, code, false,
ConvenienceMethods.createNameAndValueList(sab, "Source"));
for (int i = 0; i < aList.getAssociationCount(); i++) {
Association assoc = aList.getAssociation(i);
AssociatedConceptList acList = assoc.getAssociatedConcepts();
for (Iterator<AssociatedConcept> nodes = acList.iterateAssociatedConcept(); nodes.hasNext(); ) {
printChainForNode(lbscm, scheme, sab, csvt, nodes.next(), currentDepth + 1, maxDepth, assoc.getDirectionalName());
}
}
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:50,
代码来源:ListHierarchyMetaBySource.java
示例9: printHierarchyBranch
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Handles recursive display of hierarchy for the given start node,
* up to the maximum specified depth.
* @param lbscm
* @param scheme
* @param csvt
* @param hierarchyID
* @param branchRoot
* @param currentDepth
* @param maxDepth
* @param assocName
* @throws LBException
*/
protected void printHierarchyBranch(
LexBIGServiceConvenienceMethods lbscm,
String scheme,
CodingSchemeVersionOrTag csvt,
String hierarchyID,
ResolvedConceptReference branchRoot,
int currentDepth,
int maxDepth,
String assocName) throws LBException
{
// Print the referenced node; indent based on current depth ...
StringBuffer indent = new StringBuffer();
for (int i = 0; i < currentDepth; i++)
indent.append(" ");
String code = branchRoot.getConceptCode();
EntityDescription desc = branchRoot.getEntityDescription();
Util.displayMessage(new StringBuffer()
.append(indent)
.append(assocName != null ? (assocName+"->") : "")
.append(code).append(':').append(desc != null ? desc.getContent() : "")
.toString());
// Print each association and recurse ...
if (currentDepth < maxDepth) {
AssociationList assocList = lbscm.getHierarchyLevelNext(scheme, csvt, hierarchyID, code, false, null);
if (assocList != null)
for (int i = 0; i < assocList.getAssociationCount(); i++) {
Association assoc = assocList.getAssociation(i);
AssociatedConceptList nodes = assoc.getAssociatedConcepts();
for (Iterator<AssociatedConcept> subsumed = nodes.iterateAssociatedConcept(); subsumed.hasNext(); ) {
printHierarchyBranch(lbscm, scheme, csvt, hierarchyID, subsumed.next(), currentDepth + 1, maxDepth, assoc.getDirectionalName());
}
}
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:50,
代码来源:ListHierarchy.java
示例10: buildTree
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Recursively builds the Tree, adding one level at a time.
*
* @param vocabularyName
* @param rootCode
* @return
* @throws Exception
*
* AssociatedConcept = A concept reference that is the source or target of an association.
* AssociatedConceptList = A list of AssociatedConcept's
* Association = The representation of a particular association as it appears in a CodedNode
* CodedNode =
*/
protected void buildTree(String vocabularyName, ResolvedConceptReference rootCode) throws Exception {
//System.out.println("Entered buildTree with rootCode: " + rootCode.getConceptCode());
DefaultMutableTreeNode branch = new DefaultMutableTreeNode();
finalTree = createRootNode(rootCode);
AssociatedConceptList conceptList = getChildrenOfNode(rootCode.getConceptCode(), lbSvc, vocabularyName, null);
//System.out.println(rootCode + " has " + conceptList.getAssociatedConceptCount() + " children. " );
for (int j = 0; j < conceptList.getAssociatedConceptCount(); j++) {
AssociatedConcept assocConcept = conceptList.getAssociatedConcept(j);
//1. Construct a next level concept based on an AssociatedConcept
//2. Construct a TreeNode called child_node and attached concept to TreeNode as a member variable
//3. Create a child_dmtn based on the user object child_node
//4. Insert child_dmtn to the original dmtn as a child node
TreeNode child_node = new TreeNode();
Concept concept = new Concept();
concept.setEntityDescription(assocConcept.getEntityDescription());
concept.setEntityCode(assocConcept.getConceptCode());
child_node.setConcept(concept);
DefaultMutableTreeNode child_dmtn = new DefaultMutableTreeNode(child_node);
populateTreeNode(vocabularyName, assocConcept, child_dmtn);
}
}
开发者ID:NCIP,
项目名称:camod,
代码行数:40,
代码来源:RecursiveTreeBuilder.java
示例11: populateTreeNode
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
protected void populateTreeNode(String vocabularyName, AssociatedConcept assocConcept, DefaultMutableTreeNode parent_dmtn) throws Exception {
//System.out.println("Enter populateTreeNode for code: " + assocConcept.getConceptCode());
// 1. find children for node
// 2. create child nodes and add them to the parent node
// 3. recursively call this method
AssociatedConceptList conceptList = getChildrenOfNode(assocConcept.getConceptCode(), lbSvc, vocabularyName, null);
//System.out.println(assocConcept.getConceptCode() + " has " + conceptList.getAssociatedConceptCount() + " children in populateTreeNode.");
for (int i = 0; i < conceptList.getAssociatedConceptCount(); i++) {
AssociatedConcept aConcept = conceptList.getAssociatedConcept(i);
TreeNode child_node = new TreeNode();
Concept concept = new Concept();
concept.setEntityDescription(aConcept.getEntityDescription());
concept.setEntityCode(aConcept.getConceptCode());
//System.out.println("populateTreeNode working on code: " + aConcept.getConceptCode());
child_node.setConcept(concept);
DefaultMutableTreeNode child_dmtn = new DefaultMutableTreeNode(child_node);
if(hasChildren(aConcept.getConceptCode(), lbSvc, vocabularyName, null)) {
//System.out.println("populateTreeNode: " + aConcept.getConceptCode() + " has children.");
populateTreeNode(vocabularyName, aConcept, child_dmtn);
}
parent_dmtn.insert(child_dmtn, i);
}
finalTree.add(parent_dmtn);
}
开发者ID:NCIP,
项目名称:camod,
代码行数:28,
代码来源:RecursiveTreeBuilder.java
示例12: getSuperconceptCodes
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
public Vector getSuperconceptCodes(String scheme, String version, String code) { //throws LBException{
long ms = System.currentTimeMillis();
Vector v = new Vector();
try {
//EVSApplicationService lbSvc = new RemoteServerUtil().createLexBIGService(this.url);
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbSvc.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbSvc);
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
csvt.setVersion(version);
String desc = null;
try {
desc = lbscm.createCodeNodeSet(new String[] {code}, scheme, csvt)
.resolveToList(null, null, null, 1)
.getResolvedConceptReference(0)
.getEntityDescription().getContent();
} catch (Exception e) {
desc = "<not found>";
}
// Iterate through all hierarchies and levels ...
String[] hierarchyIDs = lbscm.getHierarchyIDs(scheme, csvt);
for (int k = 0; k < hierarchyIDs.length; k++) {
String hierarchyID = hierarchyIDs[k];
AssociationList associations = lbscm.getHierarchyLevelPrev(scheme, csvt, hierarchyID, code, false, null);
for (int i = 0; i < associations.getAssociationCount(); i++) {
Association assoc = associations.getAssociation(i);
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int j = 0; j < concepts.getAssociatedConceptCount(); j++) {
AssociatedConcept concept = concepts.getAssociatedConcept(j);
String nextCode = concept.getConceptCode();
v.add(nextCode);
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
_logger.debug("Run time (ms): " + (System.currentTimeMillis() - ms));
}
return v;
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:43,
代码来源:SearchUtils.java
示例13: getSuperconceptCodes_Local
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
public Vector getSuperconceptCodes_Local(String scheme, String version, String code) { //throws LBException{
long ms = System.currentTimeMillis();
Vector v = new Vector();
try {
LexBIGService lbSvc = new LexBIGServiceImpl();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbSvc.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbSvc);
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
csvt.setVersion(version);
String desc = null;
try {
desc = lbscm.createCodeNodeSet(new String[] {code}, scheme, csvt)
.resolveToList(null, null, null, 1)
.getResolvedConceptReference(0)
.getEntityDescription().getContent();
} catch (Exception e) {
desc = "<not found>";
}
// Iterate through all hierarchies and levels ...
String[] hierarchyIDs = lbscm.getHierarchyIDs(scheme, csvt);
for (int k = 0; k < hierarchyIDs.length; k++) {
String hierarchyID = hierarchyIDs[k];
AssociationList associations = lbscm.getHierarchyLevelPrev(scheme, csvt, hierarchyID, code, false, null);
for (int i = 0; i < associations.getAssociationCount(); i++) {
Association assoc = associations.getAssociation(i);
AssociatedConceptList concepts = assoc.getAssociatedConcepts();
for (int j = 0; j < concepts.getAssociatedConceptCount(); j++) {
AssociatedConcept concept = concepts.getAssociatedConcept(j);
String nextCode = concept.getConceptCode();
v.add(nextCode);
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
_logger.debug("Run time (ms): " + (System.currentTimeMillis() - ms));
}
return v;
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:42,
代码来源:SearchUtils.java
示例14: addPathFromRoot
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* The given path represents a multi-tier association with associated
* concepts and targets. This method expands the association content
* and adds results to the given tree item, recursing as necessary to
* process each level in the path.
* <p>
* Nodes in the association acts as the backbone for the display.
* For each backbone node, additional children are resolved one level
* deep along with an indication of further expandability.
*/
protected void addPathFromRoot(TreeItem ti,
LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm,
String scheme, CodingSchemeVersionOrTag csvt,
Association path, String[] associationsToNavigate, boolean associationsNavigatedFwd,
Map<String, EntityDescription> codesToDescriptions)
throws LBException {
// First, add the branch point from the path ...
ConceptReference branchRoot = path.getAssociationReference();
String branchCode = branchRoot.getConceptCode();
String branchCodeDescription = codesToDescriptions.containsKey(branchCode) ? codesToDescriptions
.get(branchCode).getContent() : getCodeDescription(lbsvc, scheme, csvt, branchCode);
TreeItem branchPoint = new TreeItem(branchCode, branchCodeDescription);
String branchNavText = getDirectionalLabel(lbscm, scheme, csvt, path, associationsNavigatedFwd);
// Now process elements in the branch ...
AssociatedConceptList concepts = path.getAssociatedConcepts();
for (int i = 0; i < concepts.getAssociatedConceptCount(); i++) {
// Add all immediate leafs in the branch, and indication of
// sub-nodes. Do not process codes already in the backbone here;
// they will be printed in the recursive call ...
AssociatedConcept concept = concepts.getAssociatedConcept(i);
String code = concept.getConceptCode();
TreeItem branchItem = new TreeItem(code, getCodeDescription(concept));
branchPoint.addChild(branchNavText, branchItem);
addChildren(branchItem, lbsvc, lbscm, scheme, csvt, code, codesToDescriptions.keySet(),
associationsToNavigate, associationsNavigatedFwd);
// Recurse to process the remainder of the backbone ...
AssociationList nextLevel = concept.getSourceOf();
if (nextLevel != null) {
if (nextLevel.getAssociationCount() != 0) {
// More levels left to process ...
for (int j = 0; j < nextLevel.getAssociationCount(); j++)
addPathFromRoot(branchPoint, lbsvc, lbscm, scheme, csvt, nextLevel.getAssociation(j), associationsToNavigate,
associationsNavigatedFwd, codesToDescriptions);
} else {
// End of the line ...
// Always add immediate children ot the focus code.
addChildren(branchItem, lbsvc, lbscm, scheme,
csvt, concept.getConceptCode(), Collections.EMPTY_SET,
associationsToNavigate, associationsNavigatedFwd);
}
}
}
// Add the populated tree item to those tracked from root.
ti.addChild(branchNavText, branchPoint);
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:63,
代码来源:TreeUtils.java
示例15: addChildren
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Populate child nodes for a single branch of the tree,
* and indicates whether further expansion (to grandchildren)
* is possible.
*/
protected void addChildren(TreeItem ti,
LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm,
String scheme, CodingSchemeVersionOrTag csvt,
String branchRootCode, Set<String> codesToExclude, String[] associationsToNavigate,
boolean associationsNavigatedFwd)
throws LBException {
// Resolve the next branch, representing children of the given
// code, navigated according to the provided relationship and
// direction. Resolve the children as a code graph, looking 2
// levels deep but leaving the final level unresolved.
CodedNodeGraph cng = lbsvc.getNodeGraph(scheme, csvt, null);
ConceptReference focus = Constructors.createConceptReference(branchRootCode, scheme);
cng = cng.restrictToAssociations(Constructors.createNameAndValueList(associationsToNavigate), null);
/*
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
*/
// to be reversed after loading the patch
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, false);
// The resolved branch will be represented by the first node in
// the resolved list. The node will be subdivided by source or
// target associations (depending on direction). The associated
// nodes define the children.
for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
ResolvedConceptReference node = nodes.next();
AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
// Process each association defining children ...
for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
Association child = pathsToChildren.next();
String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
// Each association may have multiple children ...
AssociatedConceptList branchItemList = child.getAssociatedConcepts();
for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
.hasNext();) {
AssociatedConcept branchItemNode = branchNodes.next();
String branchItemCode = branchItemNode.getConceptCode();
// Add here if not in the list of excluded codes.
// This is also where we look to see if another level
// was indicated to be available. If so, mark the
// entry with a '+' to indicate it can be expanded.
if (!codesToExclude.contains(branchItemCode)) {
TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
AssociationList grandchildBranch =
associationsNavigatedFwd
? branchItemNode.getSourceOf()
: branchItemNode.getTargetOf();
if (grandchildBranch != null)
childItem.expandable = true;
ti.addChild(childNavText, childItem);
}
}
}
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:66,
代码来源:TreeUtils.java
示例16: reverseAssoc
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Recursive call to reverse order of the given association list, adding
* results to the given list. In context of this program we use this
* technique to determine the path from root, starting from the path to root
* provided by the standard convenience method.
*/
protected AssociationList reverseAssoc(LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm, String scheme,
CodingSchemeVersionOrTag csvt, Association assoc, AssociationList addTo,
Map<String, EntityDescription> codeToEntityDescriptionMap) throws LBException {
ConceptReference acRef = assoc.getAssociationReference();
AssociatedConcept acFromRef = new AssociatedConcept();
acFromRef.setCodingScheme(acRef.getCodingScheme());
acFromRef.setConceptCode(acRef.getConceptCode());
AssociationList acSources = new AssociationList();
acFromRef.setIsNavigable(Boolean.TRUE);
acFromRef.setSourceOf(acSources);
// Use cached description if available (should be cached
// for all but original root) ...
if (codeToEntityDescriptionMap.containsKey(acRef.getConceptCode()))
acFromRef.setEntityDescription(codeToEntityDescriptionMap.get(acRef.getConceptCode()));
// Otherwise retrieve on demand ...
else
acFromRef.setEntityDescription(Constructors.createEntityDescription(getCodeDescription(lbsvc, scheme, csvt,
acRef.getConceptCode())));
AssociatedConceptList acl = assoc.getAssociatedConcepts();
for (AssociatedConcept ac : acl.getAssociatedConcept()) {
// Create reverse association (same non-directional name)
Association rAssoc = new Association();
rAssoc.setAssociationName(assoc.getAssociationName());
// On reverse, old associated concept is new reference point.
ConceptReference ref = new ConceptReference();
ref.setCodingScheme(ac.getCodingScheme());
ref.setConceptCode(ac.getConceptCode());
rAssoc.setAssociationReference(ref);
// And old reference is new associated concept.
AssociatedConceptList rAcl = new AssociatedConceptList();
rAcl.addAssociatedConcept(acFromRef);
rAssoc.setAssociatedConcepts(rAcl);
// Set reverse directional name, if available.
String dirName = assoc.getDirectionalName();
if (dirName != null)
try {
rAssoc.setDirectionalName(lbscm.isForwardName(scheme, csvt, dirName) ? lbscm
.getAssociationReverseName(assoc.getAssociationName(), scheme, csvt) : lbscm
.getAssociationReverseName(assoc.getAssociationName(), scheme, csvt));
} catch (LBException e) {
}
// Save code desc for future reference when setting up
// concept references in recursive calls ...
codeToEntityDescriptionMap.put(ac.getConceptCode(), ac.getEntityDescription());
AssociationList sourceOf = ac.getSourceOf();
if (sourceOf != null)
for (Association sourceAssoc : sourceOf.getAssociation()) {
AssociationList pos = reverseAssoc(lbsvc, lbscm, scheme, csvt, sourceAssoc, addTo,
codeToEntityDescriptionMap);
pos.addAssociation(rAssoc);
}
else
addTo.addAssociation(rAssoc);
}
return acSources;
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:71,
代码来源:TreeUtils.java
示例17: getAssociationTargets
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
public HashMap getAssociationTargets(String scheme, String version, String code, String assocName)
{
HashMap hmap = new HashMap();
TreeItem ti = null;
long ms = System.currentTimeMillis();
Util.StopWatch stopWatch = new Util.StopWatch(); //DYEE
Set<String> codesToExclude = Collections.EMPTY_SET;
CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
if (version != null) csvt.setVersion(version);
ResolvedConceptReferenceList matches = null;
Vector v = new Vector();
try {
//EVSApplicationService lbSvc = new RemoteServerUtil().createLexBIGService();
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
LexBIGServiceConvenienceMethods lbscm = (LexBIGServiceConvenienceMethods) lbSvc
.getGenericExtension("LexBIGServiceConvenienceMethods");
lbscm.setLexBIGService(lbSvc);
String name = getCodeDescription(lbSvc, scheme, csvt, code);
ti = new TreeItem(code, name);
ti.expandable = false;
CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
ConceptReference focus = Constructors.createConceptReference(code, scheme);
cng = cng.restrictToAssociations(Constructors.createNameAndValueList(assocName), null);
boolean associationsNavigatedFwd = true;
/*
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
*/
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, false);
for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
ResolvedConceptReference node = nodes.next();
AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
// Process each association defining children ...
for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
Association child = pathsToChildren.next();
String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
// Each association may have multiple children ...
AssociatedConceptList branchItemList = child.getAssociatedConcepts();
for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
.hasNext();) {
AssociatedConcept branchItemNode = branchNodes.next();
String branchItemCode = branchItemNode.getConceptCode();
// Add here if not in the list of excluded codes.
// This is also where we look to see if another level
// was indicated to be available. If so, mark the
// entry with a '+' to indicate it can be expanded.
if (!codesToExclude.contains(branchItemCode)) {
TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
ti.expandable = true;
AssociationList grandchildBranch =
associationsNavigatedFwd
? branchItemNode.getSourceOf()
: branchItemNode.getTargetOf();
if (grandchildBranch != null)
childItem.expandable = true;
ti.addChild(childNavText, childItem);
}
}
}
}
hmap.put(code, ti);
} catch (Exception ex) {
ex.printStackTrace();
}
_logger.debug("Run time (milliseconds) getSubconcepts: " + (System.currentTimeMillis() - ms) + " to resolve " );
_logger.debug("DYEE: getSubconcepts: " + stopWatch.getResult() + " to resolve " );
return hmap;
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:79,
代码来源:TreeUtils.java
示例18: printHierarchyBranch
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Handles recursive display of hierarchy for the given start node,
* up to the maximum specified depth.
* @param hierarchyID
* @param branchRoot
* @param currentDepth
* @param maxDepth
* @param assocName
* @param displayConcepts
* @throws LBException
*/
protected void printHierarchyBranch(
int ctr,
String hierarchyID,
ResolvedConceptReference branchRoot,
int currentDepth,
int maxDepth,
String assocName,
boolean displayConcepts) throws LBException
{
// Print the referenced node; indent based on current depth ...
StringBuffer indent = new StringBuffer();
for (int i = 0; i < currentDepth-1; i++)
indent.append(INDENT);
String code = branchRoot.getConceptCode();
EntityDescription desc = branchRoot.getEntityDescription();
String conceptInfo = code + ":" + (desc != null ? desc.getContent() : "");
if (displayConcepts)
_buffer.append(indent + Integer.toString(ctr) + ") " +
(assocName != null ? (assocName+"->") : "") +
conceptInfo + "\n");
// Print each association and recurse ...
if (currentDepth < maxDepth) {
AssociationList assocList = _lbscm.getHierarchyLevelNext(
_scheme, _csvt, hierarchyID, code, false, null);
if (assocList == null)
return;
int j = 0;
for (int i = 0; i < assocList.getAssociationCount(); i++) {
Association assoc = assocList.getAssociation(i);
AssociatedConceptList nodes = assoc.getAssociatedConcepts();
for (Iterator<AssociatedConcept> subsumed = nodes.iterateAssociatedConcept(); subsumed.hasNext(); ) {
printHierarchyBranch(++j, hierarchyID, subsumed.next(), currentDepth + 1, maxDepth, assoc.getDirectionalName(), displayConcepts);
}
}
if (currentDepth == 1 || displayConcepts)
_buffer.append(indent + "* " + conceptInfo + " (children=" + j + ")\n");
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:52,
代码来源:ListHierarchy2.java
示例19: addChildren
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Populate child nodes for a single branch of the tree,
* and indicates whether further expansion (to grandchildren)
* is possible.
*/
protected void addChildren(TreeItem ti,
LexBIGService lbsvc, LexBIGServiceConvenienceMethods lbscm,
String scheme, CodingSchemeVersionOrTag csvt,
String branchRootCode, Set<String> codesToExclude, String[] associationsToNavigate,
boolean associationsNavigatedFwd)
throws LBException {
// Resolve the next branch, representing children of the given
// code, navigated according to the provided relationship and
// direction. Resolve the children as a code graph, looking 2
// levels deep but leaving the final level unresolved.
CodedNodeGraph cng = lbsvc.getNodeGraph(scheme, csvt, null);
ConceptReference focus = Constructors.createConceptReference(branchRootCode, scheme);
cng = cng.restrictToAssociations(Constructors.createNameAndValueList(associationsToNavigate), null);
ResolvedConceptReferenceList branch = cng.resolveAsList(focus, associationsNavigatedFwd,
!associationsNavigatedFwd, -1, 2, noopList_, null, null, null, -1, true);
// The resolved branch will be represented by the first node in
// the resolved list. The node will be subdivided by source or
// target associations (depending on direction). The associated
// nodes define the children.
for (Iterator<ResolvedConceptReference> nodes = branch.iterateResolvedConceptReference(); nodes.hasNext();) {
ResolvedConceptReference node = nodes.next();
AssociationList childAssociationList = associationsNavigatedFwd ? node.getSourceOf() : node.getTargetOf();
// Process each association defining children ...
for (Iterator<Association> pathsToChildren = childAssociationList.iterateAssociation(); pathsToChildren.hasNext();) {
Association child = pathsToChildren.next();
String childNavText = getDirectionalLabel(lbscm, scheme, csvt, child, associationsNavigatedFwd);
// Each association may have multiple children ...
AssociatedConceptList branchItemList = child.getAssociatedConcepts();
for (Iterator<AssociatedConcept> branchNodes = branchItemList.iterateAssociatedConcept(); branchNodes
.hasNext();) {
AssociatedConcept branchItemNode = branchNodes.next();
String branchItemCode = branchItemNode.getConceptCode();
// Add here if not in the list of excluded codes.
// This is also where we look to see if another level
// was indicated to be available. If so, mark the
// entry with a '+' to indicate it can be expanded.
if (!codesToExclude.contains(branchItemCode)) {
TreeItem childItem = new TreeItem(branchItemCode, getCodeDescription(branchItemNode));
AssociationList grandchildBranch =
associationsNavigatedFwd
? branchItemNode.getSourceOf()
: branchItemNode.getTargetOf();
if (grandchildBranch != null)
childItem.expandable = true;
ti.addChild(childNavText, childItem);
}
}
}
}
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:61,
代码来源:BuildTreeForCode2.java
示例20: profileHierarchy
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Recursive traversal method gauges maximum depth, average depth
*
* @param lbs - service context
* @param lbscm - convenience methods
* @param schemeName - coding scheme name
* @param csVorT - coding scheme version or tag (version in this case)
* @param hID - hierarchy ID
* @param root - concept to navigate from
* @param level - current level of recursion
* @return references representing deepest path in branch (root first)
* @throws LBException
*/
protected List<ResolvedConceptReference> profileHierarchy(LexBIGService lbs, LexBIGServiceConvenienceMethods lbscm, String schemeName, CodingSchemeVersionOrTag csVorT,
String hID, ResolvedConceptReference root, int level)
throws LBException
{
List<ResolvedConceptReference> deepestPath = new ArrayList<ResolvedConceptReference>();
deepestPath.add(root);
AssociationList assocList = lbscm.getHierarchyLevelNext(schemeName, csVorT, hID, root.getConceptCode(), false, null);
if (assocList.getAssociationCount() > 0) {
List<ResolvedConceptReference> deepestSubpath = new ArrayList<ResolvedConceptReference>();
// Traverse registered associations ...
for (Association assoc: assocList.getAssociation()) {
AssociatedConceptList conceptList = assoc.getAssociatedConcepts();
// If tree splits here, mark it as starting point of new sub-branches.
// Bump cumulative statistics, and since this recursion can be
// extensive provide periodic feedback to the user to indicate the
// process is still active ...
if (conceptList.getAssociatedConceptCount() > 1) {
numBranchPoints++;
if (numBranchPoints % 10 == 0) System.out.print('.');
if (numBranchPoints % 780 == 0) System.out.println();
}
// Recurse through all child nodes.
for (Iterator<AssociatedConcept> subsumed = conceptList.iterateAssociatedConcept(); subsumed.hasNext(); ) {
AssociatedConcept childConcept = subsumed.next();
// Recurse to determine depth of sub-branch for this child.
List<ResolvedConceptReference> tempPath = profileHierarchy(lbs, lbscm, schemeName, csVorT, hID, childConcept, level+1);
// Sub-branch starting at this child is deepest so far?
if (tempPath.size() > deepestSubpath.size()) {
deepestSubpath = tempPath;
}
}
}
// Add the deepest subpath to root for return as deepest path at this level.
deepestPath.addAll(deepestSubpath);
} else {
// Branch ends here, mark a complete branch and add depth to cumulative stats.
numBranches++;
combinedDepth += (level + 1);
}
// Contains only the root if it is a leaf; otherwise follows with
// an example path traversing from root to deepest level.
return deepestPath;
}
开发者ID:NCIP,
项目名称:nci-term-browser,
代码行数:66,
代码来源:ProfileScheme.java
示例21: getChildrenOfNode
点赞 2
import org.LexGrid.LexBIG.DataModel.Collections.AssociatedConceptList; //导入依赖的package包/类
/**
* Display relations from the given code to other concepts.
* @param code
* @param relation
* @param lbSvc
* @param scheme
* @param csvt
* @throws LBException
*/
protected static AssociatedConceptList getChildrenOfNode(String code, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
throws LBException
{
//System.out.println("Entered getChildrenOfNode() for scheme: " + scheme);
String[] associationsToNavigate;
if(scheme.equals(Constants.ZEBRAFISH_SCHEMA)){
//System.out.println("getChildrenOfNode() for scheme (Zebrafish) loop: " + scheme);
associationsToNavigate = new String[3];
associationsToNavigate[0] = "subClassOf";
associationsToNavigate[1] = "is_a";
associationsToNavigate[2] = "part_of";
} else {
//System.out.println("getChildrenOfNode() for scheme (NCI_Thesaurus): " + scheme);
associationsToNavigate = new String[2];
associationsToNavigate[0] = "subClassOf";
associationsToNavigate[1] = "R82";
//associationsToNavigate[1] = "Anatomic_Structure_Is_Physical_Part_Of";
}
// Perform the query ...
AssociatedConceptList conceptList = new AssociatedConceptList();
ResolvedConceptReferenceList matches =
lbSvc.getNodeGraph(scheme, csvt, null)
.restrictToAssociations(Constructors.createNameAndValueList(associationsToNavigate), null)
//.restrictToAssociations(nvList, null)
.resolveAsList(ConvenienceMethods.createConceptReference(code, scheme),
false, true, 1, 1, new LocalNameList(), null, null, 1024);
// Analyze the result ...
if (matches.getResolvedConceptReferenceCount() > 0) {
ResolvedConceptReference ref =
(ResolvedConceptReference) matches.enumerateResolvedConceptReference().nextElement();
//System.out.println("getChildrenOfNode() ref.getCode(): " + ref.getCode());
// Print the associations - added this not null check for Rat Diagnosis - *** Find out why later ***
if(ref.getTargetOf() !=null){
AssociationList targetof = ref.getTargetOf();
Association[] associations = targetof.getAssociation();
for (int i = 0; i < associations.length; i++) {
Association assoc = associations[i];
AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
for (int j = 0; j < acl.length; j++) {
AssociatedConcept ac = acl[j];
// Tried to filter out anonymous equivalent classes for human diagnosis (skipped) (add in LexEVS 6.0)
conceptList.addAssociatedConcept(ac);
//EntityDescription ed = ac.getEntityDescription();
//System.out.println("\t\t Code: " + code + " has child: "+ ac.getConceptCode() + "/"+ (ed == null?"**No Description**":ed.getContent()));
}
}
}
}
return conceptList;
}
开发者ID:NCIP,
项目名称:camod,
代码行数:65,
代码来源:RecursiveTreeBuilder.java