Ejemplo n.º 1
0
  private void gen(String bn, ValueSet vs) throws FHIRException {
    Section section = section(bn);
    section.triple(bn, "a", "fhir:ValueSet");
    if (vs.hasVersion()) section.triple(bn, "fhir:version", literal(vs.getVersion()));
    if (vs.hasName()) section.label(bn, vs.getName());
    if (vs.hasDescription())
      section.comment(
          bn,
          vs.getDescription()
              .replace("code system", "value set")
              .replace("Code System", "Value Set")
              .replace("Code system", "Value set"));
    if (vs.hasCopyright()) section.triple(bn, "dc:rights", literal(vs.getCopyright()));
    if (vs.hasDate()) section.triple(bn, "dc:date", literal(vs.getDateElement().asStringValue()));

    for (UsageContext cc : vs.getUseContext())
      codedTriple(section, bn, "fhir:useContext", cc.getValueCodeableConcept());
    section.triple(
        bn,
        "fhir:status",
        complex().predicate("a", "fhir:conformance-resource-status\\#" + vs.getStatus().toCode()));
    section.triple(
        bn,
        "fhir:canonicalStatus",
        complex().predicate("a", getCanonicalStatus("ValueSet.status", vs.getStatus().toCode())));
  }
Ejemplo n.º 2
0
  private void genExtension(StructureDefinition extension) throws FHIRException {
    // for now, only simple extensions
    if (extension.getSnapshot().getElement().size() == 5
        && !hasSection("Extension: " + tail(extension.getUrl()))) {
      ElementDefinition base = extension.getSnapshot().getElement().get(0);
      ElementDefinition valueX = extension.getSnapshot().getElement().get(4);
      Section section = section("Extension: " + tail(extension.getUrl()));
      Subject subject = section.subject("ex:birthplace");
      subject.predicate("a", "fhir:ExtensionDefinition");
      subject.label(extension.getTitle());
      subject.comment(extension.getDescription());
      if (extension.hasVersion())
        subject.predicate("fhir:version", literal(extension.getVersion()));
      if (extension.hasCopyright())
        subject.predicate("dc:rights", literal(extension.getCopyright()));
      subject.predicate(
          "fhir:status",
          complex()
              .predicate(
                  "a", "fhir:conformance-resource-status\\#" + extension.getStatus().toCode()));
      subject.predicate(
          "fhir:canonicalStatus",
          complex()
              .predicate(
                  "a", getCanonicalStatus("ValueSet.status", extension.getStatus().toCode())));
      for (UsageContext cc : extension.getUseContext())
        codedTriple(subject, "fhir:useContext", cc.getValueCodeableConcept());
      if (extension.hasDate())
        subject.predicate("dc:date", literal(extension.getDateElement().asStringValue()));

      subject.predicate("rdfs:range", processType(valueX.getType().get(0).getCode()));
      if (base.getIsModifier()) subject.predicate("fhir:flag", "fhir:isModifier");
    }
  }