NIH | National Cancer Institute | NCI Wiki  

WIKI MAINTENANCE NOTICE

Please be advised that NCI Wiki will be undergoing maintenance on Thursday, May 23rd between 1200 ET and 1300 ET.
Wiki will remain available, but users may experience screen refreshes or HTTP 502 errors during the maintenance period. If you encounter these errors, wait 1-2 minutes, then refresh your page.

If you have any questions or concerns, please contact the CBIIT Atlassian Management Team.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Code Block
languageJava
titleJava Code Snippet
    	
	public void testDefinitionSource(){

		String searchTerm = "C12435";
		String vocabName = "NCI_Thesaurus";
		String vocabTag = "PRODUCTION";
		ConceptReference cref = new ConceptReference();
		cref.setConceptCode(searchTerm);
		ConceptReferenceList ncrl = new ConceptReferenceList();
		ncrl.addConceptReference(cref);

		try {
            CodingSchemeVersionOrTag cvt = new CodingSchemeVersionOrTag();
			cvt.setTag(vocabTag);
			CodedNodeSet nodes = lbSvc.getNodeSet(vocabName, cvt, null);
			nodes = nodes.restrictToCodes(ncrl);
			ResolvedConceptReferenceList crl = nodes.resolveToList(null, null,
					null, 20);
			//codes are unique in NCIt, so you will only get one entity in the list
			Entity concept = crl.getResolvedConceptReference(0).getEntity();
			Definition[] defs = concept.getDefinition();
			for (Definition def : defs) {
				//Each definition in NCIt will only have one source.
				Source[] sources = def.getSource();
				Source defSource = sources[0];
				String source = defSource.getContent();
				System.out.println("Definition source "+ source);
			}

		} catch (Exception ex) {
			System.out.println(ex);
		}
	}