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 3 Next »

Java Code Snippet
    	public void testFullSynBySource(){
		try {
						String searchTerm = "gene";			
			CodedNodeSet nodeSet = lbSvc.getNodeSet("HUBt", null, null);

			//Tell the api that you want to get back only the PRESENTATION type properties                   
			CodedNodeSet.PropertyType[] types = new CodedNodeSet.PropertyType[1];                
			types[0] = CodedNodeSet.PropertyType.PRESENTATION;

			LocalNameList sourceLnL = new LocalNameList();
			sourceLnL.addEntry("CAHUB");
			
			LocalNameList propLnL = new LocalNameList();
			propLnL.addEntry("FULL_SYN");

			nodeSet = nodeSet.restrictToMatchingProperties(propLnL,types,sourceLnL,null, null,searchTerm,LBConstants.MatchAlgorithms.contains.name(),null);

			ResolvedConceptReferenceList rcl = nodeSet.resolveToList(null, null, null, 100);
			int count = rcl.getResolvedConceptReferenceCount();

			for (int i=0; i<rcl.getResolvedConceptReferenceCount();i++){
				ResolvedConceptReference rcr = rcl.getResolvedConceptReference(i);
				Entity entity = rcr.getReferencedEntry();
				Presentation[] presProps = entity.getPresentation();
				for(int y=0;y<presProps.length;y++){
					Presentation pres = presProps[y];
					if(pres.getPropertyName().equals("FULL_SYN")&& pres.getRepresentationalForm().equals("PT") && pres.getSource(0).getContent().equals("CAHUB")){
					System.out.println(pres.getValue().getContent());					
					}
				}
			}

		} catch (IndexOutOfBoundsException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (LBInvocationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (LBParameterException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (LBException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
  • No labels