当前位置: 首页>>代码示例>>Java>>正文


Java ResolvedConceptReference.getTargetOf方法代码示例

本文整理汇总了Java中org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference.getTargetOf方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvedConceptReference.getTargetOf方法的具体用法?Java ResolvedConceptReference.getTargetOf怎么用?Java ResolvedConceptReference.getTargetOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference的用法示例。


在下文中一共展示了ResolvedConceptReference.getTargetOf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: print

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
 * Prints the.
 *
 * @param ref the ref
 * @param depth the depth
 */
private static void print(ResolvedConceptReference ref, int depth){
	String code = ref.getConceptCode();

	String description;
	if(ref.getEntityDescription() != null){
		description = ref.getEntityDescription().getContent();
	} else {
		description = "";
	}

	System.out.println(buildPrefix(depth) + "Code: " + code + ", Description: " + description + " Hash: " + ref.hashCode());
	if(ref.getSourceOf() != null){
		print(ref.getSourceOf(), depth+1);
	}
	if(ref.getTargetOf() != null){
		print(ref.getTargetOf(), depth+1);
	}
}
 
开发者ID:NCIP,项目名称:camod,代码行数:25,代码来源:PrintUtility.java

示例2: printFrom

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
 * Display relations to the given code from other concepts.
 *
 * @param code
 * @param lbSvc
 * @param scheme
 * @param csvt
 * @throws LBException
 */
@SuppressWarnings("unchecked")
protected void printFrom(PrintWriter pw, String scheme, CodingSchemeVersionOrTag csvt, String code)
        throws LBException {
    pw.println("Pointed at by ...");

    // Perform the query ...
    ResolvedConceptReferenceList matches = lbSvc.getNodeGraph(scheme, csvt, null).resolveAsList(
            ConvenienceMethods.createConceptReference(code, scheme), false, true, 1, 1, new LocalNameList(), null,
            null, 1024);

    // Analyze the result ...
    if (matches.getResolvedConceptReferenceCount() > 0) {
        Enumeration<? extends ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();

        while (refEnum.hasMoreElements()) {
            ResolvedConceptReference ref = refEnum.nextElement();
            AssociationList targetof = ref.getTargetOf();

            if (targetof != null) {
	Association[] associations = targetof.getAssociation();

	for (int i = 0; i < associations.length; i++) {
		Association assoc = associations[i];
		pw.println("\t" + assoc.getAssociationName());

		AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
		for (int j = 0; j < acl.length; j++) {
			AssociatedConcept ac = acl[j];
				String rela = replaceAssociationNameByRela(ac, assoc.getAssociationName());
			EntityDescription ed = ac.getEntityDescription();
			pw.println("\t\t" + ac.getConceptCode() + "/"
					+ (ed == null ? "**No Description**" : ed.getContent()) + " --> (" + rela + ") --> " + code);
		}
	}
   }
        }
    }

}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:49,代码来源:EntityExporter.java

示例3: printFrom

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
 * Display relations to the given code from other concepts.
 *
 * @param code
 * @param lbSvc
 * @param scheme
 * @param csvt
 * @throws LBException
 */
@SuppressWarnings("unchecked")
protected void printFrom(PrintWriter pw, String code, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
        throws LBException {
    displayMessage(pw, "\n\tPointed at by ...");

    // Perform the query ...
    ResolvedConceptReferenceList matches = lbSvc.getNodeGraph(scheme, csvt, null).resolveAsList(
            ConvenienceMethods.createConceptReference(code, scheme), false, true, 1, 1, new LocalNameList(), null,
            null, 1024);

    // Analyze the result ...
    if (matches.getResolvedConceptReferenceCount() > 0) {
        Enumeration<? extends ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();

        while (refEnum.hasMoreElements()) {
            ResolvedConceptReference ref = refEnum.nextElement();
            AssociationList targetof = ref.getTargetOf();

            if (targetof != null) {
	if (targetof != null) {
		Association[] associations = targetof.getAssociation();
		if (associations != null && associations.length > 0) {
			for (int i = 0; i < associations.length; i++) {
				Association assoc = associations[i];
				//displayMessage(pw, "\t" + assoc.getAssociationName());

				AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
				for (int j = 0; j < acl.length; j++) {
					AssociatedConcept ac = acl[j];
						String rela = replaceAssociationNameByRela(ac, assoc.getAssociationName());
					EntityDescription ed = ac.getEntityDescription();
					displayMessage(pw, "\t\t" + ac.getConceptCode() + "/"
							+ (ed == null ? "**No Description**" : ed.getContent()) + " --> (" + rela + ") --> " + code);
					if (ac.getAssociationQualifiers() != null && ac.getAssociationQualifiers().getNameAndValue() != null) {
								for(NameAndValue nv: ac.getAssociationQualifiers().getNameAndValue()){
						displayMessage(pw, "\t\t\tAssoc Qualifier - " + nv.getName() + ": " + nv.getContent());
						displayMessage(pw, "\n");
								}

					}
				}
			}
		}
	}
   }
        }
    }

}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:59,代码来源:PropsAndAssocForCode.java

示例4: resolveOneHit

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
protected List<? extends ResolvedConceptReference> resolveOneHit(ResolvedConceptReference hit) throws LBException{
	List<ResolvedConceptReference> returnList = new ArrayList<ResolvedConceptReference>();

	CodingSchemeVersionOrTag tagOrVersion = new CodingSchemeVersionOrTag();
	if (hit.getCodingSchemeVersion() != null) tagOrVersion.setVersion(hit.getCodingSchemeVersion());

          CodedNodeGraph cng = null;

          if (lbSvc == null) {
		return null;
	}


		cng = lbSvc.getNodeGraph(
			hit.getCodingSchemeName(),
			tagOrVersion,
			null);

          Boolean restrictToAnonymous = Boolean.FALSE;
          cng = cng.restrictToAnonymous(restrictToAnonymous);

          LocalNameList localNameList = new LocalNameList();
          localNameList.addEntry("concept");

          cng = cng.restrictToEntityTypes(localNameList);


	if (_associationNameAndValueList != null) {
		cng =
			cng.restrictToAssociations(
				_associationNameAndValueList,
				_associationQualifierNameAndValueList);
	}

	else {
		String scheme = hit.getCodingSchemeName();
		SimpleDataUtils simpleDataUtils = new SimpleDataUtils(lbSvc);
		boolean isMapping = simpleDataUtils.isMapping(scheme, null);
		if (isMapping) {
			NameAndValueList navl = simpleDataUtils.getMappingAssociationNames(scheme, null);
			if (navl != null) {
				cng = cng.restrictToAssociations(navl, null);
			}
		}
	}

	ConceptReference focus = new ConceptReference();
	focus.setCode(hit.getCode());

	focus.setCodingSchemeName(hit.getCodingSchemeName());
	focus.setCodeNamespace(hit.getCodeNamespace());

	LocalNameList propertyNames = new LocalNameList();
	CodedNodeSet.PropertyType[] propertyTypes = null;
	SortOptionList sortCriteria = null;

	ResolvedConceptReferenceList list =
		cng.resolveAsList(focus,
			_resolveForward, _resolveBackward, 0,
			_resolveAssociationDepth, propertyNames, propertyTypes, sortCriteria,
			_maxToReturn);

	for(ResolvedConceptReference ref : list.getResolvedConceptReference()){
		if (ref.getSourceOf() != null && this.getAssociations(ref.getSourceOf()).size() > 0) {
			returnList.addAll(this.getAssociations(ref.getSourceOf()));
		}

		//if(ref.getSourceOf() != null){
		//	returnList.addAll(this.getAssociations(ref.getSourceOf()));
		//}

		if (ref.getTargetOf() != null && this.getAssociations(ref.getTargetOf()).size() > 0) {
			returnList.addAll(this.getAssociations(ref.getTargetOf()));
		}
		//if(ref.getTargetOf() != null){
			//returnList.addAll(this.getAssociations(ref.getTargetOf()));
		//}
	}
	return returnList;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:81,代码来源:SearchByAssociationIteratorDecorator.java

示例5: getAssociationSourceCodes

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
public Vector getAssociationSourceCodes(String scheme, String version,
    String code, String assocName) {
    CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
    if (version != null)
        csvt.setVersion(version);
    ResolvedConceptReferenceList matches = null;
    Vector v = new Vector();
    try {
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
        Boolean restrictToAnonymous = Boolean.FALSE;
        cng = cng.restrictToAnonymous(restrictToAnonymous);
        NameAndValueList nameAndValueList =
            createNameAndValueList(new String[] { assocName }, null);

        NameAndValueList nameAndValueList_qualifier = null;
        cng =
            cng.restrictToAssociations(nameAndValueList,
                nameAndValueList_qualifier);

        matches =
            cng.resolveAsList(ConvenienceMethods.createConceptReference(
                code, scheme), false, true, 1, 1, new LocalNameList(),
                null, null, _maxReturn);

        if (matches.getResolvedConceptReferenceCount() > 0) {
            java.util.Enumeration<? extends ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();
            while (refEnum.hasMoreElements()) {
                ResolvedConceptReference ref = (ResolvedConceptReference) refEnum.nextElement();

                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];
                        v.add(ac.getReferencedEntry().getEntityCode());
                    }
                }
            }
            SortUtils.quickSort(v);
        }

    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return v;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:52,代码来源:ConceptDetails.java

示例6: addChildren

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的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

示例7: getAssociationTargets

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的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

示例8: printFrom

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
 * Display relations to the given code from other concepts.
 * @param code
 * @param lbSvc
 * @param scheme
 * @param csvt
 * @throws LBException
 */
@SuppressWarnings("unchecked")
//protected void printFrom(String code, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
protected void printFrom(String code, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)

		throws LBException
{
	Util.displayMessage("Pointed at by ...");

	// Perform the query ...
	/*
	ResolvedConceptReferenceList matches =
		lbSvc.getNodeGraph(scheme, csvt, null)
			.resolveAsList(
				ConvenienceMethods.createConceptReference(code, scheme),
				false, true, 1, 1, new LocalNameList(), null, null, 1024);
	*/

	CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
	ResolvedConceptReferenceList matches =
			cng.resolveAsList(
				ConvenienceMethods.createConceptReference(code, scheme),
				false, true, 1, 1, new LocalNameList(), null, null, 1024);


	// Analyze the result ...
	if (matches.getResolvedConceptReferenceCount() > 0) {
		Enumeration<ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();

		while (refEnum.hasMoreElements()) {
			ResolvedConceptReference ref = refEnum.nextElement();
			AssociationList targetof = ref.getTargetOf();
			Association[] associations = targetof.getAssociation();

			for (int i = 0; i < associations.length; i++) {
				Association assoc = associations[i];
				Util.displayMessage("\t" + assoc.getAssociationName());

				AssociatedConcept[] acl = assoc.getAssociatedConcepts().getAssociatedConcept();
				for (int j = 0; j < acl.length; j++) {
					AssociatedConcept ac = acl[j];
					EntityDescription ed = ac.getEntityDescription();
					Util.displayMessage(
						"\t\t" + ac.getConceptCode() + "/"
							+ (ed == null?
									"**No Description**":ed.getContent()));
				}
			}
		}
	}

}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:60,代码来源:FindPropsAndAssocForCode.java

示例9: printFrom

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
	 * Display relations from the given code to other concepts.
	 * @param code
	 * @param relation
	 * @param lbSvc
	 * @param scheme
	 * @param csvt
	 * @throws LBException
	 */
	protected void printFrom(String code, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
		throws LBException
	{
		Util.displayMessage("Pointed at by ...");

		// Perform the query ...
/*
		ResolvedConceptReferenceList matches =
			lbSvc.getNodeGraph(scheme, csvt, null)
				.resolveAsList(
					ConvenienceMethods.createConceptReference(code, scheme),
					false, true, 1, 1, new LocalNameList(), null, null, 1024);
*/
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
		ResolvedConceptReferenceList matches =
			cng.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();

			// Print the associations
			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];
					EntityDescription ed = ac.getEntityDescription();
					Util.displayMessage(
						"\t\t" + ac.getConceptCode() + "/"
							+ (ed == null?
									"**No Description**":ed.getContent()));
				}
			}
		}
	}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:51,代码来源:FindRelatedCodesWithPropertyLinks.java

示例10: printConcepts

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
protected void printConcepts(String code, ResolvedConceptReferenceList list, 
        boolean isTargetList) throws LBException {
    StringBuffer buffer = new StringBuffer();
    if (isTargetList)
        buffer.append("* Pointed at by ...\n");
    else buffer.append("* Pointed to ...\n");

    if (list.getResolvedConceptReferenceCount() <= 0) {
        buffer.append(INDENT + "* " + code + ": 0 results.");
        Util.displayMessage(buffer.toString());
        return;
    }

    ResolvedConceptReference concept = (ResolvedConceptReference) 
        list.enumerateResolvedConceptReference().nextElement();
    AssociationList aList = isTargetList ? concept.getTargetOf() : concept.getSourceOf();
    Association[] associations = aList.getAssociation();
    int ctr = 0;
    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];
            String childCode = ac.getConceptCode();
            EntityDescription ed = ac.getEntityDescription();
            String content = ed == null? "** No Description **" : ed.getContent(); 
            String msg = INDENT + (++ctr) + ") " + childCode + ": " + content;
            
            int childCount = numOfChildren(childCode);
            msg += "; children: " + childCount;
            if (_displayConcepts)
                buffer.append(msg + "\n");
        }
    }
    String parentCode = concept.getConceptCode();
    EntityDescription desc = concept.getEntityDescription();
    if (desc != null)
        buffer.append(INDENT + "* Concept name: " + desc.getContent() + "\n");
    buffer.append(INDENT + "* " + parentCode + " (children=" + ctr + ")");
    Util.displayMessage(buffer.toString());
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:42,代码来源:FindRelatedCodes2.java

示例11: addChildren

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的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

示例12: printFrom

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
	 * Display relations from the given code to other concepts.
	 * @param code
	 * @param relation
	 * @param lbSvc
	 * @param scheme
	 * @param csvt
	 * @throws LBException
	 */
	protected void printFrom(String code, String relation, EVSApplicationService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
		throws LBException
	{
		// Perform the query ...
		Util.displayMessage("Pointed at by ...");

		// Perform the query ...
		NameAndValue nv = new NameAndValue();
		NameAndValueList nvList = new NameAndValueList();
		nv.setName(relation);
		nvList.addNameAndValue(nv);

/*
		ResolvedConceptReferenceList matches =
			lbSvc.getNodeGraph(scheme, csvt, null)
				.restrictToAssociations(nvList, null)
				.resolveAsList(
					ConvenienceMethods.createConceptReference(code, scheme),
					false, true, 1, 1, new LocalNameList(), null, null, 1024);

*/
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
        cng = cng.restrictToAssociations(nvList, null);
		ResolvedConceptReferenceList matches =
					cng.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();

			// Print the associations
			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];
					EntityDescription ed = ac.getEntityDescription();
					Util.displayMessage(
						"\t\t" + ac.getConceptCode() + "/"
							+ (ed == null?
									"**No Description**":ed.getContent()));
				}
			}
		}

	}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:61,代码来源:FindRelatedCodes.java

示例13: transformSummaryDescription

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
@Override
public List<AssociationDirectoryEntry> transformSummaryDescription(
		ResolvedConceptReferenceAssociationPage ref) {
	
	ResolvedConceptReference subject = ref.getResolvedConceptReference();

	List<AssociationDirectoryEntry> returnList = new ArrayList<AssociationDirectoryEntry>();

	URIAndEntityName uriEntityName = new URIAndEntityName();
	uriEntityName.setName(subject.getCode());
	uriEntityName.setNamespace(this.sanitizeNamespace(subject.getCodeNamespace()));
	uriEntityName.setUri(this.getUriHandler().getEntityUri(subject));
	uriEntityName.setHref(this.getTransformUtils().createEntityHref(subject));
	
	AssociationList associations;
	switch(ref.getDirection()){
		case SOURCEOF:{
			associations = subject.getSourceOf();
			break;
		}
		case TARGETOF: {
			associations = subject.getTargetOf();
			break;
		}
		default : throw new IllegalStateException();
	}
	int counter = 0;
	
	if(associations != null){
		for (Association association : associations.getAssociation()) {
			//We can reuse these in each entry
			PredicateReference predReference = new PredicateReference();
			predReference.setName(association.getAssociationName());
			predReference.setUri(
					this.getUriHandler().
						getPredicateUri(
								subject.getCodingSchemeURI(),
								subject.getCodingSchemeVersion(),
								association.getAssociationName()));
			CodeSystemVersionReference codeSystemVersionReference = this.getTransformUtils().toCodeSystemVersionReference(
					this.getCodingSchemeNameTranslator().translateFromLexGrid(subject.getCodingSchemeName()), 
					subject.getCodingSchemeVersion(),
					subject.getCodingSchemeURI());

			for (AssociatedConcept target : association.getAssociatedConcepts()
					.getAssociatedConcept()) {
				if(counter++ >= ref.getStart()){
					AssociationDirectoryEntry entry = new AssociationDirectoryEntry();
					entry.setSubject(uriEntityName);
					entry.setAssertedBy(codeSystemVersionReference);
					entry.setPredicate(predReference);
					StatementTarget st = new StatementTarget();
					uriEntityName = new URIAndEntityName();
					uriEntityName.setName(target.getCode());
					uriEntityName.setNamespace(this.sanitizeNamespace(target.getCodeNamespace()));
					uriEntityName.setUri(this.getUriHandler().getEntityUri(target));
					uriEntityName.setHref(this.getTransformUtils().createEntityHref(target));
					st.setEntity(uriEntityName);
					entry.setTarget(st);
	
					returnList.add(entry);
					
					if(returnList.size() == ref.getEnd()){
						return returnList;
					}
				}
			}

		}
	}

	return returnList;
}
 
开发者ID:NCIP,项目名称:lexevs-service,代码行数:74,代码来源:AssociatedConceptToAssociationTransform.java

示例14: printFrom

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的package包/类
/**
 * Display relations from the given code to other concepts.
 * @param code
 * @param relation
 * @param lbSvc
 * @param scheme
 * @param csvt
 * @throws LBException
 */
protected static void printFrom(String code, String relation, LexBIGService lbSvc, String scheme, CodingSchemeVersionOrTag csvt)
	throws LBException
{
	// Perform the query ...
	System.out.println("Pointed at by ...");

	// Perform the query ...
	NameAndValue nv = new NameAndValue();
	NameAndValueList nvList = new NameAndValueList();
	nv.setName(relation);
	nvList.addNameAndValue(nv);

	ResolvedConceptReferenceList matches =
		lbSvc.getNodeGraph(scheme, csvt, 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();

		// Print the associations
		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];
				EntityDescription ed = ac.getEntityDescription();
				System.out.println(
					"\t\t" + ac.getConceptCode() + "/"
						+ (ed == null?
								"**No Description**":ed.getContent()));
			}
		}
	}

}
 
开发者ID:NCIP,项目名称:camod,代码行数:52,代码来源:PrintUtility.java

示例15: getChildrenOfNode

import org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference; //导入方法依赖的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


注:本文中的org.LexGrid.LexBIG.DataModel.Core.ResolvedConceptReference.getTargetOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。