Beispiel #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;
  }
Beispiel #2
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;
  }
Beispiel #3
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;
  }