Skip to content

Finish type restrictions for canonical in shex #198

@dbooth-boston

Description

@dbooth-boston

Jim's PR also takes care of renaming to fhir:l for ShEx. I can see that it adds fhir:l to canonical, oid, url, uuid, and uri. And it does this for canonical references (example) and CodeableReferences (example) too.

ShEx has a few things missing for this. Just to confirm, <Reference> already specified that an IRI? should be used with fhir:l. We can do the same for <uri> to be consistent, which the other primitive types derive from.

<CodeableReference> EXTENDS @<DataType> CLOSED {   
    a [fhir:CodeableReference]?;
    fhir:concept @<CodeableConcept>?; 
    fhir:reference @<Reference>?; 
}  
<Reference> EXTENDS @<DataType> CLOSED {   
    a [fhir:Reference]?;
    fhir:l IRI?; # <------------------------------------ this was already here
    fhir:reference @<string>?; 
    fhir:type @<uri>?; 
    fhir:identifier @<Identifier>?; 
    fhir:display @<string>?; 
}  
<canonical> EXTENDS @<uri> CLOSED {   
    a [fhir:canonical]?;
}
<oid> EXTENDS @<uri> CLOSED {   
    a [fhir:oid]?;
}
<url> EXTENDS @<uri> CLOSED {   
    a [fhir:url]?;
}
<uuid> EXTENDS @<uri> CLOSED {   
    a [fhir:uuid]?;
} 
<uri> EXTENDS @<PrimitiveType> CLOSED {   
    a [fhir:uri]?;
+    fhir:l IRI?;
    fhir:v xsd:anyURI?; 
}
<string> EXTENDS @<PrimitiveType> CLOSED {   
    a [fhir:string]?;
    fhir:v xsd:string MAXLENGTH 1048576?; 
}

More importantly, we're missing type restrictions on profiles for canonical and CodeableReference.
ActivityDefinition is a good example that uses all types of references:

<ActivityDefinition> EXTENDS @<DomainResource> CLOSED {   
    a [fhir:ActivityDefinition]?;
    # ...
    fhir:url @<uri>?; 
    # ...
    fhir:subject @<CodeableConcept>  OR 
    			(@<Reference>  AND {fhir:link @<Group> OR 
    			 @<MedicinalProductDefinition> OR 
    			 @<SubstanceDefinition> OR 
    			 @<AdministrableProductDefinition> OR 
    			 @<ManufacturedItemDefinition> OR 
    			 @<PackagedProductDefinition> })  OR 
    			(@<canonical>  AND { fhir:l @<EvidenceVariable> })  ?;  # good
-    fhir:library @<OneOrMore_canonical>?; 
+    fhir:library @<OneOrMore_canonical_Library>?; 
    # ...
-    fhir:profile @<canonical>?; 
-    fhir:profile @<canonical> AND { fhir:l @<StructureDefinition> } ?; 
    # ...
-    fhir:location @<CodeableReference>?; 
+    fhir:location (@<CodeableReference> AND {fhir:reference @<Reference> AND {fhir:l @<Location> } }) ?; 
    # ...
    fhir:product (@<Reference>  AND {fhir:link @<Medication> OR 
    			 @<Ingredient> OR 
    			 @<Substance> OR 
    			 @<SubstanceDefinition> })  OR 
    			 @<CodeableConcept>  ?; 
}  

+<OneOrMore_canonical_Library> CLOSED {
+    rdf:first @<canonical_Library>  ;
+    rdf:rest [rdf:nil] OR @<OneOrMore_canonical_Library> 
+}

+<canonical_Library> EXTENDS @<canonical> CLOSED {   
+    a [fhir:canonical]?; # is this correct?
+     fhir:l @<Library>;
+}  

The OWL ontology will have fhir:l restrictions for Reference (and therefore CodeableReference) and canonical. It won't have restrictions for fhir:l on fhir:uri since it could be anything when generically used. But that change is part of #177

Originally posted by @tmprd in #120

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions