Search in sources :

Example 16 with TTLObject

use of org.hl7.fhir.dstu3.utils.formats.Turtle.TTLObject in project org.hl7.fhir.core by hapifhir.

the class TurtleParser method parseChildren.

private void parseChildren(Turtle src, String path, TTLComplex object, Element element, boolean primitive) throws FHIRException {
    List<Property> properties = element.getProperty().getChildProperties(element.getName(), null);
    Set<String> processed = new HashSet<String>();
    if (primitive)
        processed.add(FHIR_URI_BASE + "value");
    // first pass: process the properties
    for (Property property : properties) {
        if (property.isChoice()) {
            for (TypeRefComponent type : property.getDefinition().getType()) {
                String eName = property.getName().substring(0, property.getName().length() - 3) + Utilities.capitalize(type.getCode());
                parseChild(src, object, element, processed, property, path, getFormalName(property, eName));
            }
        } else {
            parseChild(src, object, element, processed, property, path, getFormalName(property));
        }
    }
    // second pass: check for things not processed
    if (policy != ValidationPolicy.NONE) {
        for (String u : object.getPredicates().keySet()) {
            if (!processed.contains(u)) {
                TTLObject n = object.getPredicates().get(u);
                logError(n.getLine(), n.getCol(), path, IssueType.STRUCTURE, context.formatMessage(I18nConstants.UNRECOGNISED_PREDICATE_, u), IssueSeverity.ERROR);
            }
        }
    }
}
Also used : TypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent) TTLObject(org.hl7.fhir.utilities.turtle.Turtle.TTLObject) HashSet(java.util.HashSet)

Aggregations

TTLObject (org.hl7.fhir.utilities.turtle.Turtle.TTLObject)8 TTLList (org.hl7.fhir.utilities.turtle.Turtle.TTLList)6 HashSet (java.util.HashSet)4 TTLObject (org.hl7.fhir.dstu3.utils.formats.Turtle.TTLObject)4 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)4 TTLObject (org.hl7.fhir.r4.utils.formats.Turtle.TTLObject)4 TTLURL (org.hl7.fhir.utilities.turtle.Turtle.TTLURL)4 TTLList (org.hl7.fhir.dstu3.utils.formats.Turtle.TTLList)3 TTLList (org.hl7.fhir.r4.utils.formats.Turtle.TTLList)3 SpecialElement (org.hl7.fhir.dstu3.elementmodel.Element.SpecialElement)2 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)2 TTLURL (org.hl7.fhir.dstu3.utils.formats.Turtle.TTLURL)2 SpecialElement (org.hl7.fhir.r4.elementmodel.Element.SpecialElement)2 StructureDefinition (org.hl7.fhir.r4.model.StructureDefinition)2 TTLURL (org.hl7.fhir.r4.utils.formats.Turtle.TTLURL)2 SpecialElement (org.hl7.fhir.r4b.elementmodel.Element.SpecialElement)2 NamedElement (org.hl7.fhir.r4b.elementmodel.ParserBase.NamedElement)2 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)2 SpecialElement (org.hl7.fhir.r5.elementmodel.Element.SpecialElement)2 NamedElement (org.hl7.fhir.r5.elementmodel.ParserBase.NamedElement)2