Exemplo n.º 1
0
  private static ResolvedConceptReferenceList searchConceptCode(
      LexEVSApplicationService evsService, String dtsVocab, String CCode, int sMetaLimit) {

    ResolvedConceptReferenceList concepts = new ResolvedConceptReferenceList();

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

      ConceptReferenceList crefs =
          ConvenienceMethods.createConceptReferenceList(new String[] {CCode}, dtsVocab);
      metaNodes = metaNodes.restrictToCodes(crefs);

      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)
              null, // PropertyTypess to resolve (null resolves all)
              sMetaLimit // cap the number of results returned (-1 resolves all)
              );

      codesSize = concepts.getResolvedConceptReferenceCount();

    } catch (Exception ex) {
      System.out.println("Error do_EVSSearch get concept: " + ex.toString());
    }
    return concepts;
  }
  /**
   * 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());
  }
Exemplo n.º 3
0
  @Test
  public void testT1_FNC_16() throws LBException {

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

    cns = cns.restrictToStatus(null, new String[] {"Retired"});
    ResolvedConceptReference[] rcr =
        cns.resolveToList(null, null, null, 0).getResolvedConceptReference();

    assertTrue(rcr.length == 1);
    assertTrue(rcr[0].getConceptCode().equals("73"));
  }
Exemplo n.º 4
0
  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;
  }
Exemplo n.º 5
0
  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;
  }