NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Java Code Snippet
      

    public void testTransitiveClosure(){

        /*

         * Check for all descendants of a given concept

         *         

         */

        System.out.println("***********************");

        System.out.println("Testing transitive closure");

        System.out.println("***********************");

        String scheme = "NCI Thesaurus";

        String code = "C20181";

        ConceptReference cr = ConvenienceMethods.createConceptReference(code,

                scheme);

        CodingSchemeVersionOrTag vt = new CodingSchemeVersionOrTag();

        vt.setTag("PRODUCTION");

        try {

            NameAndValueList nvList = Constructors.createNameAndValueList("subClassOf");

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

            cng.restrictToAssociations(nvList, null);

            CodedNodeSet nodeset = cng.toNodeList(ConvenienceMethods.createConceptReference(code, scheme), false, true,-1, -1);

            CodedNodeSet.AnonymousOption restrictToAnonymous = CodedNodeSet.AnonymousOption.NON_ANONYMOUS_ONLY;

            nodeset = nodeset.restrictToAnonymous(restrictToAnonymous);

            ResolvedConceptReferencesIterator iterator = nodeset.resolve(null, null,  null,null, false);

            while (iterator.hasNext()){

                ResolvedConceptReference rcr = iterator.next();

                String codeReturn = rcr.getCode();

                System.out.println(codeReturn);

            }

        } catch (Exception e) {

            e.printStackTrace();

        }

  }


  • No labels