Closed ericprud closed 2 years ago
Goal structure moves AND filter-operator
into rdf:first
:
{ "type": "Shape",
"id": "http://hl7.org/fhir/shape/CodeSystem.filter",
"closed": true,
"expression": {
"type": "EachOf",
"expressions": [
{ "type": "TripleConstraint",
"predicate": "http://hl7.org/fhir/extension", "min": 0, "max": -1,
"valueExpr": "http://hl7.org/fhir/shape/OneOrMore_Extension"
},
…
{ "type": "TripleConstraint",
"predicate": "http://hl7.org/fhir/operator", "min": 1, "max": -1,
"valueExpr": "http://hl7.org/fhir/shape/OneOrMore_code_filter-operator"
},
…
]
} },
{ "type": "Shape", # formulaic Collection shape typed for codes in filter-operator.
"id": "http://hl7.org/fhir/shape/OneOrMore_code_filter-operator",
"closed": true,
"expression": {
"type": "EachOf",
"expressions": [
{ "type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#first",
"valueExpr": {
"type": "ShapeAnd",
"shapeExprs": [
"http://hl7.org/fhir/shape/code", # conforms to code shape
{ "type": "Shape",
"expression": { # and code's value is in observation-status
"type": "TripleConstraint",
"predicate": "http://hl7.org/fhir/value",
"valueExpr": "http://hl7.org/fhir/ValueSet/filter-operator"
} }
]
}
},
{ "type": "TripleConstraint",
"predicate": "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",
"valueExpr": {
"type": "ShapeOr",
"shapeExprs": [
{ "type": "NodeConstraint",
"values": [ "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil" ]
},
"http://hl7.org/fhir/shape/OneOrMore_code_filter-operator"
]
} }
]
} }
relevant structureDefs:
per
if (elt.max !== "1" && elt.binding && elt.binding.strength === 'required')
console.log(elt.id);
Works with max card of 1 (i.e. not an rdf:Collection), e.g. Observation.status:
ObservationStatus (Required)
Observation Category Codes (Preferred)
ShEx-ified as:
(Note that
0..*
is expressed as a an optional property with a value of a non-empty list. I don't know if"category" []
is allowed in JSON-land or its analog in XML-land.)CodeSystem.filter.operator
has both a value constraint and a max card > 0:FilterOperator (Required)