コード例 #1
0
  /**
   * Test map synonymto preferred names.
   *
   * @throws LBException the LB exception
   */
  public void testMapSynonymtoPreferredNames() throws LBException {

    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);
    cns =
        cns.restrictToMatchingDesignations(
            "skeleton", SearchDesignationOption.ALL, "exactMatch", null);

    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    assertTrue(rcr.length == 2);

    boolean found = false;
    for (int i = 0; i < rcr.length; i++) {

      if (rcr[i].getConceptCode().equals("C12788")) {
        found = true;
        assertTrue(rcr[i].getReferencedEntry().getPropertyCount() == 5);
        assertTrue(
            rcr[i]
                .getReferencedEntry()
                .getEntityDescription()
                .getContent()
                .equals("Skeletal System"));
      }
    }
    assertTrue(found);
  }
コード例 #2
0
  /**
   * Test limit returned values.
   *
   * @throws LBException the LB exception
   */
  public void testLimitReturnedValues() throws LBException {

    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);

    cns =
        cns.restrictToMatchingDesignations(
            "heaart", SearchDesignationOption.ALL, "DoubleMetaphoneLuceneQuery", null);

    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 1).getResolvedConceptReference();

    assertTrue(rcr.length == 1);
  }
コード例 #3
0
  public void testNextInt() {
    try {
      LexBIGService lbs = ServiceHolder.instance().getLexBIGService();
      CodedNodeSet cns = lbs.getCodingSchemeConcepts("NCI Thesaurus", null);
      cns = cns.restrictToMatchingDesignations("heart", null, "startsWith", null);

      ResolvedConceptReferencesIterator rcrl = cns.resolve(null, null, null, null, false);

      ResolvedConceptReferenceList list1 = rcrl.next(10);
      ResolvedConceptReferenceList list2 = rcrl.next(10);

      assertFalse(compareResolvedConceptReferenceList(list1, list2));
    } catch (Exception e) {
      fail("Exception Thrown: " + e.getMessage());
      e.printStackTrace();
    }
  }
コード例 #4
0
  /**
   * Testfor current or obsolete conceptb.
   *
   * @throws LBException the LB exception
   */
  public void testforCurrentOrObsoleteConceptb() throws LBException {

    // same as above, but this time, using the new methods (that aren't deprecated)
    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);
    cns = cns.restrictToStatus(ActiveOption.ACTIVE_ONLY, null);
    cns =
        cns.restrictToCodes(
            Constructors.createConceptReferenceList(new String[] {"C38389"}, THES_SCHEME));
    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    assertTrue("1", rcr.length == 0);

    cns = ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);
    cns = cns.restrictToStatus(ActiveOption.ALL, null);
    cns =
        cns.restrictToCodes(
            Constructors.createConceptReferenceList(new String[] {"C38389"}, THES_SCHEME));
    rcr = cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    assertTrue("2", rcr.length == 1);

    // same test again - no status restriction
    cns = ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);
    cns =
        cns.restrictToCodes(
            Constructors.createConceptReferenceList(new String[] {"C38389"}, THES_SCHEME));
    rcr = cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    assertTrue("3", rcr.length == 1);

    // add a status restriction
    cns = ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);
    cns =
        cns.restrictToMatchingDesignations(
            "Sex Not Known", SearchDesignationOption.ALL, "exactMatch", null);
    cns = cns.restrictToStatus(ActiveOption.INACTIVE_ONLY, null);
    rcr = cns.resolveToList(null, null, null, 0).getResolvedConceptReference();
    assertTrue("4", rcr.length == 1);

    assertFalse("6", rcr[0].getReferencedEntry().getIsActive().booleanValue());
  }
コード例 #5
0
  public void testNext() {
    try {
      LexBIGService lbs = ServiceHolder.instance().getLexBIGService();
      CodedNodeSet cns = lbs.getCodingSchemeConcepts("NCI Thesaurus", null);
      cns = cns.restrictToMatchingDesignations("heart", null, "startsWith", null);

      ResolvedConceptReferencesIterator rcrl = cns.resolve(null, null, null, null, false);

      String conceptCode = null;

      while (rcrl.hasNext()) {
        ResolvedConceptReference ref = rcrl.next();
        String currentCode = ref.getConceptCode();
        assertFalse(currentCode.equals(conceptCode));
        conceptCode = currentCode;
      }
    } catch (Exception e) {
      fail("Exception Thrown: " + e.getMessage());
      e.printStackTrace();
    }
  }
コード例 #6
0
  public void testT1_FNC_17() throws LBException {

    CodedNodeSet cns =
        ServiceHolder.instance().getLexBIGService().getCodingSchemeConcepts(THES_SCHEME, null);

    cns =
        cns.restrictToMatchingDesignations(
            "heaart", SearchDesignationOption.ALL, "DoubleMetaphoneLuceneQuery", null);

    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    // should have found the concept code C48589 - "Base of the Heart"
    boolean found = false;
    for (int i = 0; i < rcr.length; i++) {
      if (rcr[i].getConceptCode().equals("Base_of_the_Heart")) {
        found = true;
      }
    }
    assertTrue(found);
  }
コード例 #7
0
ファイル: EVSSearch.java プロジェクト: NCIP/cadsr-admin-tool
  private static ResolvedConceptReferenceList searchPrefTerm(
      LexEVSApplicationService evsService,
      String dtsVocab,
      String prefName,
      int sMetaLimit,
      String algorithm) {

    ResolvedConceptReferenceList concepts = new ResolvedConceptReferenceList();
    int codesSize = 0;
    try {
      CodedNodeSet metaNodes = evsService.getNodeSet(dtsVocab, null, null);

      metaNodes =
          metaNodes.restrictToMatchingDesignations(
              prefName, // the text to match
              CodedNodeSet.SearchDesignationOption
                  .ALL, // whether to search all designation, only Preferred or only Non-Preferred
              algorithm, // the match algorithm to use
              null); // the language to match (null matches all)

      metaNodes = metaNodes.restrictToStatus(ActiveOption.ACTIVE_ONLY, null);

      concepts =
          metaNodes.resolveToList(
              null, // Sorts used to sort results (null means sort by match score)
              null, // PropertyNames to resolve (null resolves all)
              new CodedNodeSet.PropertyType[] {
                PropertyType.DEFINITION, PropertyType.PRESENTATION
              }, // PropertyTypess to resolve (null resolves all)
              sMetaLimit // cap the number of results returned (-1 resolves all)
              );
      codesSize = concepts.getResolvedConceptReferenceCount();
    } catch (Exception ex) {
      // ex.printStackTrace();
      System.out.println("Error do_EVSSearch DescLogic: " + ex.toString());
    }

    return concepts;
  }
コード例 #8
0
ファイル: EVSSearch.java プロジェクト: NCIP/cadsr-admin-tool
  public static String getEVSCode(String prefName, String dtsVocab) {
    LexEVSApplicationService evsService = null;

    try {
      evsService =
          (LexEVSApplicationService)
              ApplicationServiceProvider.getApplicationService("EvsServiceInfo");

    } catch (Exception e) {
      throw new RuntimeException(e);
    }

    if (dtsVocab == null) dtsVocab = "";
    String CCode = "";
    if (dtsVocab.equals("Thesaurus/Metathesaurus")
        || dtsVocab.equals("")
        || dtsVocab.equals("NCI Thesaurus")
        || dtsVocab.equals("NCI_Thesaurus")) dtsVocab = "NCI_Thesaurus";
    ResolvedConceptReferenceList codes2 = null;
    int codesSize = 0;

    try {
      CodedNodeSet metaNodes = evsService.getNodeSet("NCI MetaThesaurus", null, null);

      metaNodes =
          metaNodes.restrictToMatchingDesignations(
              prefName, // the text to match
              CodedNodeSet.SearchDesignationOption
                  .PREFERRED_ONLY, // whether to search all designation, only Preferred or only
                                   // Non-Preferred
              "exactMatch", // the match algorithm to use
              null); // the language to match (null matches all)

      metaNodes = metaNodes.restrictToStatus(ActiveOption.ACTIVE_ONLY, null);

      codes2 =
          metaNodes.resolveToList(
              null, // Sorts used to sort results (null means sort by match score)
              null, // PropertyNames to resolve (null resolves all)
              new CodedNodeSet.PropertyType[] {
                PropertyType.DEFINITION, PropertyType.PRESENTATION
              }, // PropertyTypess to resolve (null resolves all)  //PropertyTypess to resolve (null
                 // resolves all)
              10 // cap the number of results returned (-1 resolves all)
              );
      codesSize = codes2.getResolvedConceptReferenceCount();

    } catch (Exception ex) {
      System.err.println("Error do_getEVSCode:resolveToList: " + ex.toString());
      ex.printStackTrace();
    }

    if (codes2 != null) {
      ResolvedConceptReference conceptReference = new ResolvedConceptReference();
      // logger.debug("Got "+codesSize+" results for the do_getEVSCode search using prefName and
      // exactMatch");
      for (int i = 0; i < codesSize; i++) {
        conceptReference = (ResolvedConceptReference) codes2.getResolvedConceptReference(i);
        CCode = (String) conceptReference.getConceptCode();
      }
    }

    evsService = null;
    return CCode;
  }