use of org.hl7.fhir.utilities.turtle.Turtle.Section in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeComposition.
protected void composeComposition(Complex parent, String parentType, String name, Composition element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Composition", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "Composition", "identifier", element.getIdentifier(), -1);
if (element.hasStatusElement())
composeEnum(t, "Composition", "status", element.getStatusElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Composition", "type", element.getType(), -1);
if (element.hasClass_())
composeCodeableConcept(t, "Composition", "class", element.getClass_(), -1);
if (element.hasSubject())
composeReference(t, "Composition", "subject", element.getSubject(), -1);
if (element.hasEncounter())
composeReference(t, "Composition", "encounter", element.getEncounter(), -1);
if (element.hasDateElement())
composeDateTime(t, "Composition", "date", element.getDateElement(), -1);
for (int i = 0; i < element.getAuthor().size(); i++) composeReference(t, "Composition", "author", element.getAuthor().get(i), i);
if (element.hasTitleElement())
composeString(t, "Composition", "title", element.getTitleElement(), -1);
if (element.hasConfidentialityElement())
composeEnum(t, "Composition", "confidentiality", element.getConfidentialityElement(), -1);
for (int i = 0; i < element.getAttester().size(); i++) composeCompositionCompositionAttesterComponent(t, "Composition", "attester", element.getAttester().get(i), i);
if (element.hasCustodian())
composeReference(t, "Composition", "custodian", element.getCustodian(), -1);
for (int i = 0; i < element.getRelatesTo().size(); i++) composeCompositionCompositionRelatesToComponent(t, "Composition", "relatesTo", element.getRelatesTo().get(i), i);
for (int i = 0; i < element.getEvent().size(); i++) composeCompositionCompositionEventComponent(t, "Composition", "event", element.getEvent().get(i), i);
for (int i = 0; i < element.getSection().size(); i++) composeCompositionSectionComponent(t, "Composition", "section", element.getSection().get(i), i);
}
use of org.hl7.fhir.utilities.turtle.Turtle.Section in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCompositionSectionComponent.
protected void composeCompositionSectionComponent(Complex parent, String parentType, String name, Composition.SectionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "section", name, element, index);
if (element.hasTitleElement())
composeString(t, "Composition", "title", element.getTitleElement(), -1);
if (element.hasCode())
composeCodeableConcept(t, "Composition", "code", element.getCode(), -1);
if (element.hasText())
composeNarrative(t, "Composition", "text", element.getText(), -1);
if (element.hasModeElement())
composeEnum(t, "Composition", "mode", element.getModeElement(), -1);
if (element.hasOrderedBy())
composeCodeableConcept(t, "Composition", "orderedBy", element.getOrderedBy(), -1);
for (int i = 0; i < element.getEntry().size(); i++) composeReference(t, "Composition", "entry", element.getEntry().get(i), i);
if (element.hasEmptyReason())
composeCodeableConcept(t, "Composition", "emptyReason", element.getEmptyReason(), -1);
for (int i = 0; i < element.getSection().size(); i++) composeCompositionSectionComponent(t, "Composition", "section", element.getSection().get(i), i);
}
use of org.hl7.fhir.utilities.turtle.Turtle.Section in project org.hl7.fhir.core by hapifhir.
the class RdfParserBase method compose.
@Override
public void compose(OutputStream stream, Resource resource) throws IOException {
RdfGenerator ttl = new RdfGenerator(stream);
// ttl.setFormat(FFormat);
ttl.prefix("fhir", "http://hl7.org/fhir/");
ttl.prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
Section section = ttl.section("resource");
Subject subject;
if (url != null)
subject = section.triple("<" + url + ">", "a", "fhir:" + resource.getResourceType().toString());
else
subject = section.triple("_", "a", "fhir:" + resource.getResourceType().toString());
composeResource(subject, resource);
try {
ttl.commit(false);
} catch (Exception e) {
throw new IOException(e);
}
}
use of org.hl7.fhir.utilities.turtle.Turtle.Section in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilities method generateForChildren.
private void generateForChildren(SchematronWriter sch, String xpath, ElementDefinition ed, StructureDefinition structure, StructureDefinition base) throws IOException {
// generateForChild(txt, structure, child);
List<ElementDefinition> children = getChildList(structure, ed);
String sliceName = null;
ElementDefinitionSlicingComponent slicing = null;
for (ElementDefinition child : children) {
String name = tail(child.getPath());
if (child.hasSlicing()) {
sliceName = name;
slicing = child.getSlicing();
} else if (!name.equals(sliceName))
slicing = null;
ElementDefinition based = getByPath(base, child.getPath());
boolean doMin = (child.getMin() > 0) && (based == null || (child.getMin() != based.getMin()));
boolean doMax = !child.getMax().equals("*") && (based == null || (!child.getMax().equals(based.getMax())));
Slicer slicer = slicing == null ? new Slicer(true) : generateSlicer(child, slicing, structure);
if (slicer.check) {
if (doMin || doMax) {
Section s = sch.section(xpath);
Rule r = s.rule(xpath);
if (doMin)
r.assrt("count(f:" + name + slicer.criteria + ") >= " + Integer.toString(child.getMin()), name + slicer.name + ": minimum cardinality of '" + name + "' is " + Integer.toString(child.getMin()));
if (doMax)
r.assrt("count(f:" + name + slicer.criteria + ") <= " + child.getMax(), name + slicer.name + ": maximum cardinality of '" + name + "' is " + child.getMax());
}
}
}
for (ElementDefinitionConstraintComponent inv : ed.getConstraint()) {
if (inv.hasXpath()) {
Section s = sch.section(ed.getPath());
Rule r = s.rule(xpath);
r.assrt(inv.getXpath(), (inv.hasId() ? inv.getId() + ": " : "") + inv.getHuman() + (inv.hasUserData(IS_DERIVED) ? " (inherited)" : ""));
}
}
for (ElementDefinition child : children) {
String name = tail(child.getPath());
generateForChildren(sch, xpath + "/f:" + name, child, structure, base);
}
}
use of org.hl7.fhir.utilities.turtle.Turtle.Section in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeComposition.
protected void composeComposition(Complex parent, String parentType, String name, Composition element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Composition", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "Composition", "identifier", element.getIdentifier(), -1);
if (element.hasDateElement())
composeDateTime(t, "Composition", "date", element.getDateElement(), -1);
if (element.hasType())
composeCodeableConcept(t, "Composition", "type", element.getType(), -1);
if (element.hasClass_())
composeCodeableConcept(t, "Composition", "class", element.getClass_(), -1);
if (element.hasTitleElement())
composeString(t, "Composition", "title", element.getTitleElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "Composition", "status", element.getStatusElement(), -1);
if (element.hasConfidentialityElement())
composeCode(t, "Composition", "confidentiality", element.getConfidentialityElement(), -1);
if (element.hasSubject())
composeReference(t, "Composition", "subject", element.getSubject(), -1);
for (int i = 0; i < element.getAuthor().size(); i++) composeReference(t, "Composition", "author", element.getAuthor().get(i), i);
for (int i = 0; i < element.getAttester().size(); i++) composeCompositionCompositionAttesterComponent(t, "Composition", "attester", element.getAttester().get(i), i);
if (element.hasCustodian())
composeReference(t, "Composition", "custodian", element.getCustodian(), -1);
for (int i = 0; i < element.getEvent().size(); i++) composeCompositionCompositionEventComponent(t, "Composition", "event", element.getEvent().get(i), i);
if (element.hasEncounter())
composeReference(t, "Composition", "encounter", element.getEncounter(), -1);
for (int i = 0; i < element.getSection().size(); i++) composeCompositionSectionComponent(t, "Composition", "section", element.getSection().get(i), i);
}
Aggregations