Пример #1
0
  /**
   * Primary entry point for the program.
   *
   * @throws Exception
   */
  public void run(String[] args) throws Exception {
    synchronized (ResourceManager.instance()) {

      // Parse the command line ...
      CommandLine cl = null;
      Options options = getCommandOptions();
      try {
        cl = new BasicParser().parse(options, args);
      } catch (ParseException e) {
        Util.displayCommandOptions(
            "TagScheme",
            options,
            "TagScheme -u \"urn:oid:2.16.840.1.113883.3.26.1.1\" -v \"05.09e\" -t \"TEST\"",
            e);
        Util.displayMessage(Util.getPromptForSchemeHelp());
        return;
      }

      // Interpret provided values ...
      String urn = cl.getOptionValue("u");
      String ver = cl.getOptionValue("v");
      String tag = cl.getOptionValue("t").trim();
      CodingSchemeSummary css = null;

      // Find in list of registered vocabularies ...
      if (urn != null && ver != null) {
        urn = urn.trim();
        ver = ver.trim();
        LexBIGService lbs = LexBIGServiceImpl.defaultInstance();
        Enumeration<? extends CodingSchemeRendering> schemes =
            lbs.getSupportedCodingSchemes().enumerateCodingSchemeRendering();
        while (schemes.hasMoreElements() && css == null) {
          CodingSchemeSummary summary = schemes.nextElement().getCodingSchemeSummary();
          if (urn.equalsIgnoreCase(summary.getCodingSchemeURI())
              && ver.equalsIgnoreCase(summary.getRepresentsVersion())) css = summary;
        }
      }

      // Found it? If not, prompt...
      if (css == null) {
        if (urn != null || ver != null) {
          Util.displayMessage("No matching coding scheme was found for the given URN or version.");
          Util.displayMessage("");
        }
        css = Util.promptForCodeSystem();
        if (css == null) return;
      }

      // Continue and perform the action ...
      Util.displayTaggedMessage("A matching coding scheme was found ...");
      LexBIGServiceManager lbsm =
          LexBIGServiceImpl.defaultInstance().getServiceManager(new Object());
      lbsm.setVersionTag(Constructors.createAbsoluteCodingSchemeVersionReference(css), tag);
      Util.displayTaggedMessage("Request complete");
    }
  }
Пример #2
0
  public void run() throws LBException {
    ValueSetDefinition vsd = Util.promptForValueSetDefinition(message);
    if (vsd != null) {
      AbsoluteCodingSchemeVersionReferenceList acsvList = null;
      Util.displayMessage("Now select Code System to use to resolve Value Set Definition");
      CodingSchemeSummary css = Util.promptForCodeSystem();
      if (css != null) {
        acsvList = new AbsoluteCodingSchemeVersionReferenceList();
        acsvList.addAbsoluteCodingSchemeVersionReference(
            Constructors.createAbsoluteCodingSchemeVersionReference(
                css.getCodingSchemeURI(), css.getRepresentsVersion()));
      }

      LexEVSValueSetDefinitionServices vsdServ =
          LexEVSValueSetDefinitionServicesImpl.defaultInstance();
      ResolvedValueSetDefinition rVSD = null;
      try {
        rVSD =
            vsdServ.resolveValueSetDefinition(
                new URI(vsd.getValueSetDefinitionURI()), null, acsvList, null, null);
      } catch (URISyntaxException e) {
        e.printStackTrace();
      }

      if (rVSD != null) {
        Util.displayMessage(
            "Member of Value Set Definition (" + vsd.getValueSetDefinitionURI() + ") are :");
        ResolvedConceptReferencesIterator conceptItr = rVSD.getResolvedConceptReferenceIterator();
        while (conceptItr.hasNext()) {
          ResolvedConceptReference concept = conceptItr.next();
          Util.displayMessage("Concept code : " + concept.getCode());
          Util.displayMessage("\tCoding Scheme Name...: " + concept.getCodingSchemeName());
          Util.displayMessage("\tCoding Scheme URI....: " + concept.getCodingSchemeURI());
          Util.displayMessage("\tCoding Scheme Version: " + concept.getCodingSchemeVersion());
        }
      } else {
        Util.displayMessage(
            "No members found for Value Set Definition : '" + vsd.getValueSetDefinitionURI() + "'");
      }
    }
  }