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


Java LexBIGService.getNodeGraph方法代码示例

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


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

示例1: main

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    args = parse(args);
    LexBIGService lbs = RemoteServerUtil.createLexBIGService();
    
    CodedNodeSet cns =
        lbs.getCodingSchemeConcepts("NCI MetaThesaurus", null);
    cns =
        cns.restrictToMatchingDesignations("single dose",
            SearchDesignationOption.ALL, "LuceneQuery", null);

    CodedNodeGraph cng = lbs.getNodeGraph("NCI MetaThesaurus", null, null);
    cng = cng.restrictToTargetCodes(cns);
    ResolvedConceptReferenceList list =
        cng.resolveAsList(null, true, false, 0, 0, null, null, null, null,
            500);

    for (ResolvedConceptReference ref : list.getResolvedConceptReference()) {
        System.out.println("Code: " + ref.getCode());
        System.out.println(" Entity Description"
            + ref.getEntityDescription().getContent());
    }
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:23,代码来源:KevinTest.java

示例2: search

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public static void search(String searchString, String searchAlgorithm, 
    int resolveCodedEntryDepth,
    int resolveAssociationDepth, int maxToReturn, boolean printList)
        throws Exception {
    LexBIGService lbs = RemoteServerUtil.createLexBIGService();
    String codingScheme = "NCI MetaThesaurus";

    System.out.println("----------------------------------------");
    System.out.println("* searchString: " + searchString
        + ", searchAlgorithm: " + searchAlgorithm);

    System.out.println("* resolveCodedEntryDepth: "
        + resolveCodedEntryDepth + ", resolveAssociationDepth: "
        + resolveAssociationDepth + ", maxToReturn: " + maxToReturn);

    CodedNodeSet cns = lbs.getCodingSchemeConcepts(codingScheme, null);
    cns =
        cns.restrictToMatchingDesignations(searchString,
            SearchDesignationOption.ALL, searchAlgorithm, null);

    CodedNodeGraph cng = lbs.getNodeGraph(codingScheme, null, null);
    cng = cng.restrictToTargetCodes(cns);

    ResolvedConceptReferenceList list =
        cng.resolveAsList(null, true, false, resolveCodedEntryDepth,
            resolveAssociationDepth, null, null, null, null, maxToReturn);

    int size = list.getResolvedConceptReferenceCount();
    int i = 0;
    if (printList) {
        for (ResolvedConceptReference ref : list
            .getResolvedConceptReference()) {
            System.out.println((i++) + ") " + ref.getCode() + ": "
                + ref.getEntityDescription().getContent());
        }
    }
    System.out.println("size: " + size);
    System.out.println("");
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:40,代码来源:MyTest.java

示例3: getAssociationSources

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public Vector getAssociationSources(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 {
        // EVSApplicationService lbSvc = new
        // RemoteServerUtil().createLexBIGService();
        LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
        NameAndValueList nameAndValueList =
            createNameAndValueList(new String[] { assocName }, null);

        NameAndValueList nameAndValueList_qualifier = null;
        cng =
            cng.restrictToAssociations(nameAndValueList,
                nameAndValueList_qualifier);
        ConceptReference graphFocus =
            ConvenienceMethods.createConceptReference(code, scheme);

        boolean resolveForward = false;
        boolean resolveBackward = true;

        int resolveAssociationDepth = 1;
        int maxToReturn = 1000;

        ResolvedConceptReferencesIterator iterator =
            codedNodeGraph2CodedNodeSetIterator(cng, graphFocus,
                resolveForward, resolveBackward, resolveAssociationDepth,
                maxToReturn);

        v = resolveIterator(iterator, maxToReturn, code);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return v;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:40,代码来源:DataUtils.java

示例4: getAssociationTargets

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public Vector getAssociationTargets(String scheme, String version,
    String code, String[] assocNames) {
    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();
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
        NameAndValueList nameAndValueList =
            createNameAndValueList(assocNames, null);

        NameAndValueList nameAndValueList_qualifier = null;
        cng =
            cng.restrictToAssociations(nameAndValueList,
                nameAndValueList_qualifier);
        ConceptReference graphFocus =
            ConvenienceMethods.createConceptReference(code, scheme);

        boolean resolveForward = true;
        boolean resolveBackward = false;

        int resolveAssociationDepth = 1;
        int maxToReturn = 1000;

        ResolvedConceptReferencesIterator iterator =
            codedNodeGraph2CodedNodeSetIterator(cng, graphFocus,
                resolveForward, resolveBackward, resolveAssociationDepth,
                maxToReturn);

        v = resolveIterator(iterator, maxToReturn, code);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return v;
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:40,代码来源:DataUtils.java

示例5: getAssociationSources

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public Vector getAssociationSources(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 {
		//EVSApplicationService lbSvc = new RemoteServerUtil().createLexBIGService();
		LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
		CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
		NameAndValueList nameAndValueList =
			createNameAndValueList(
				new String[] {assocName}, null);

		NameAndValueList nameAndValueList_qualifier = null;
		cng = cng.restrictToAssociations(nameAndValueList, nameAndValueList_qualifier);
           ConceptReference graphFocus = ConvenienceMethods.createConceptReference(code, scheme);

           boolean resolveForward = false;
           boolean resolveBackward = true;

           int resolveAssociationDepth = 1;
           int maxToReturn = 1000;

        ResolvedConceptReferencesIterator iterator = codedNodeGraph2CodedNodeSetIterator(
						cng,
						graphFocus,
						resolveForward,
						resolveBackward,
						resolveAssociationDepth,
						maxToReturn);

		v = resolveIterator(iterator, maxToReturn, code);
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return v;
   }
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:39,代码来源:SearchUtils.java

示例6: getAssociationTargets

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public Vector getAssociationTargets(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 {
		//EVSApplicationService lbSvc = new RemoteServerUtil().createLexBIGService();
		LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
		CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
		NameAndValueList nameAndValueList =
			createNameAndValueList(
				new String[] {assocName}, null);

		NameAndValueList nameAndValueList_qualifier = null;
		cng = cng.restrictToAssociations(nameAndValueList, nameAndValueList_qualifier);
           ConceptReference graphFocus = ConvenienceMethods.createConceptReference(code, scheme);

           boolean resolveForward = true;
           boolean resolveBackward = false;

           int resolveAssociationDepth = 1;
           int maxToReturn = 1000;

        ResolvedConceptReferencesIterator iterator = codedNodeGraph2CodedNodeSetIterator(
						cng,
						graphFocus,
						resolveForward,
						resolveBackward,
						resolveAssociationDepth,
						maxToReturn);

		v = resolveIterator(iterator, maxToReturn, code);
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	return v;
   }
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:39,代码来源:SearchUtils.java

示例7: getAssociationTargets

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public Vector getAssociationTargets(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 {
        // EVSApplicationService lbSvc = new
        // RemoteServerUtil().createLexBIGService();
        LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
        NameAndValueList nameAndValueList =
            createNameAndValueList(new String[] { assocName }, null);

        NameAndValueList nameAndValueList_qualifier = null;
        cng =
            cng.restrictToAssociations(nameAndValueList,
                nameAndValueList_qualifier);
        ConceptReference graphFocus =
            ConvenienceMethods.createConceptReference(code, scheme);

        boolean resolveForward = true;
        boolean resolveBackward = false;

        int resolveAssociationDepth = 1;
        int maxToReturn = 1000;

        ResolvedConceptReferencesIterator iterator =
            codedNodeGraph2CodedNodeSetIterator(cng, graphFocus,
                resolveForward, resolveBackward, resolveAssociationDepth,
                maxToReturn);

        v = resolveIterator(iterator, maxToReturn, code);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return v;
}
 
开发者ID:NCIP,项目名称:nci-mapping-tool,代码行数:40,代码来源:DataUtils.java

示例8: getRestrictedCodedNodeGraph

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
public CodedNodeGraph getRestrictedCodedNodeGraph(LexBIGService lbSvc,
    String scheme, String version, String rel, String rela,
    CodedNodeSet cns, int direction) {
    CodedNodeGraph cng = null;
    CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
    versionOrTag.setVersion(version);

    _logger.warn("getRestrictedCodedNodeGraph rel: " + rel);
    _logger.warn("getRestrictedCodedNodeGraph rela: " + rela);

    try {
        cng = lbSvc.getNodeGraph(scheme, versionOrTag, null);
        NameAndValueList asso_list = null;
        String[] associationsToNavigate = null;

        if (rel == null) {
            Vector w = OntologyBean.getAssociationNames();
            if (w == null || w.size() == 0) {
                _logger
                    .warn("OntologyBean.getAssociationNames() returns null, or nothing???");
            } else {
                associationsToNavigate = new String[w.size()];
                for (int i = 0; i < w.size(); i++) {
                    String nm = (String) w.elementAt(i);
                    associationsToNavigate[i] = nm;
                }
            }
        } else {
            associationsToNavigate = new String[] { rel };
        }
        asso_list = createNameAndValueList(associationsToNavigate, null);

        NameAndValueList qualifier_list = null;
        if (rela != null) {
            qualifier_list =
                createNameAndValueList(new String[] { "rela" },
                    new String[] { rela });
        }

        cng = cng.restrictToAssociations(asso_list, qualifier_list);

        if (cns != null) {
            if (direction == -1) {
                _logger.warn("restrictToSourceCodes... ");

                cng = cng.restrictToSourceCodes(cns);
            } else if (direction == 1) {
                _logger.warn("restrictToTargetCodes... ");

                cng = cng.restrictToTargetCodes(cns);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return cng;
}
 
开发者ID:NCIP,项目名称:nci-metathesaurus-browser,代码行数:58,代码来源:ContainsRelationTest.java

示例9: getAssociationSourceCodes

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的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 {
        // EVSApplicationService lbSvc = new
        // RemoteServerUtil().createLexBIGService();
        LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
        CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);
        //Boolean restrictToAnonymous = Boolean.TRUE;
        Boolean restrictToAnonymous = Boolean.FALSE;
        //6.0 mod (KLO, 101810)
        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) {
/*
            Enumeration<ResolvedConceptReference> refEnum = matches.enumerateResolvedConceptReference();
            while (refEnum.hasMoreElements()) {
                ResolvedConceptReference ref = refEnum.nextElement();
            */

            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];
                    //6.0 mod (KLO, 101810)
                    //assoc = processForAnonomousNodes(assoc);
                    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,代码行数:66,代码来源:DataUtils.java

示例10: getAssociatedConcepts

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
/**
 * Returns Associated Concepts
 *
 * @param scheme
 * @param version
 * @param code
 * @param assocName
 * @param forward
 * @return
 */
public Vector<Entity> getAssociatedConcepts(String scheme, String version,
        String code, Vector<String> assocNames, boolean forward) {

        CodingSchemeVersionOrTag csvt = new CodingSchemeVersionOrTag();
        if (version != null) csvt.setVersion(version);
        boolean resolveForward = true;
        boolean resolveBackward = false;

        // Set backward direction
        if (!forward) {
            resolveForward = false;
            resolveBackward = true;
        }

        Vector<Entity> v = new Vector<Entity>();

        try {
LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();

            CodedNodeGraph cng = lbSvc.getNodeGraph(scheme, csvt, null);

            // Restrict coded node graph to the given association
            NameAndValueList nameAndValueList = createNameAndValueList(
                    assocNames, null);
            cng = cng.restrictToAssociations(nameAndValueList, null);

            ConceptReference graphFocus =
                ConvenienceMethods.createConceptReference(code, scheme);

            ResolvedConceptReferencesIterator iterator =
                codedNodeGraph2CodedNodeSetIterator(cng, graphFocus,
                    resolveForward, resolveBackward, RESOLVEASSOCIATIONDEPTH,
                    MAXTORETURN);
            v = resolveIterator(iterator, MAXTORETURN, code);

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

示例11: addChildren

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

示例12: getAssociationTargets

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

示例13: addChildren

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

示例14: profileAssociations

import org.LexGrid.LexBIG.LexBIGService.LexBIGService; //导入方法依赖的package包/类
/**
 * @param lbs - service context
 * @param lbscm - convenience methods
 * @param csVorT - coding scheme version or tag (version in this case)
 * @throws LBException
 */
protected void profileAssociations(LexBIGService lbs, LexBIGServiceConvenienceMethods lbscm, String schemeName, CodingSchemeVersionOrTag csVorT) throws LBException {
    // Init frequency for supported properties and qualifiers.  This way
    // we will know if property or qualifier was registered but not used.
    CodingScheme scheme = lbs.resolveCodingScheme(schemeName, csVorT);
    Set<String> assocNames = new TreeSet<String>();
    for (SupportedAssociation supported : scheme.getMappings().getSupportedAssociation()) {
        assocNames.add(supported.getLocalId());
        assoc2srcFreq.put(supported.getLocalId(), 0);
        assoc2tgtFreq.put(supported.getLocalId(), 0);
    }

    // For each association, determine frequencies ...
    int count = 0;
    try {
        // Resolve and evaluate all source to target relationships.
        // Since this step can be extensive provide periodic feedback to the user
        // to indicate the process is still active ...
        CodedNodeSet allCodes = lbs.getCodingSchemeConcepts(schemeName, csVorT);
        LocalNameList noProps = Constructors.createLocalNameList("--no-property--");
        ResolvedConceptReferencesIterator potentialSources =
            allCodes.resolve(null, noProps, null);
        
        // Brute force approach to evaluate each possible source, concept by concept.
        // Time intensive, but scales better and helps avoid possible bottlenecks related
        // to exceeding system-defined search limits.
        while (potentialSources.hasNext()) {
            ResolvedConceptReference potentialSource = potentialSources.next();
            CodedNodeGraph cng = lbs.getNodeGraph(schemeName, csVorT, null);
            ResolvedConceptReferenceList rcrList =
                cng.resolveAsList(potentialSource, true, false, -1, 1, noProps, null, null, null, -1);
            for (ResolvedConceptReference rcr : rcrList.getResolvedConceptReference()) {
                AssociationList assocList = rcr.getSourceOf();
                for (Association assoc : assocList.getAssociation()) {
                    // Bump source count ...
                    String assocName = assoc.getAssociationName();
                    Integer freq = assoc2srcFreq.get(assocName);
                    assoc2srcFreq.put(assocName, (freq == null ? 1 : freq + 1));
                    
                    // Bump target count ...
                    freq = assoc2tgtFreq.get(assocName);
                    int targetCount = assoc.getAssociatedConcepts().getAssociatedConceptCount();
                    assoc2tgtFreq.put(assocName, (freq == null ? targetCount : freq + targetCount));
                }
                if (count++ % 100 == 0) System.out.print('.');
                if (count % 7800 == 0) System.out.println();
            }
        }
    } catch (Exception e) {
        Util.displayMessage(e.getMessage());
    }
}
 
开发者ID:NCIP,项目名称:nci-term-browser,代码行数:58,代码来源:ProfileScheme.java


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