NIH | National Cancer Institute | NCI Wiki  

Java 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);
		}
	}

  • No labels