NIH | National Cancer Institute | NCI Wiki  

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Code Block
languageJava
titleJava Code Snippet
    	public void testFullSynBySource(){
		try {
						String searchTerm = "gene";			
			CodedNodeSet nodeSet = 

<ac:macro ac:name="code">
  <ac:parameter ac:name="title">Java Code Snippet</ac:parameter>
  <ac:parameter ac:name="language">Java</ac:parameter>
  <ac:plain-text-body><![CDATA[     public void testFullSynBySource(){

        try {

            String searchTerm = "gene";

...

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();

        }

...

					
					}
				}
			}

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