Skip to content

Fix OWL + shex polymorphic types + references #177

@tmprd

Description

@tmprd

Polymorphic references aren't represented in OWL

Example: https://build.fhir.org/condition.html

Condition.subject is a reference that is either a Patient or Group. But in OWL we only specify this as a Reference type. ShEx shows the full type with a union.

<Condition> EXTENDS @<DomainResource> CLOSED {   
    a [fhir:Condition]?;
    fhir:subject @<Reference> AND {fhir:link 
    			@<Group> OR 
    			@<Patient> ? };  # Who has the condition?

Solution

We can do the same in the OWL ontology like this:

fhir:Condition rdfs:subClassOf
-                             [ rdf:type           owl:Restriction;
-                                    owl:allValuesFrom  fhir:Reference;
-                                    owl:onProperty     fhir:subject
-                          ];
+                          [ rdf:type owl:Restriction ;
+                           owl:onProperty fhir:subject ;
+                             owl:allValuesFrom [ owl:intersectionOf ( fhir:Reference
+                                                                      [ rdf:type owl:Class ;
+                                                                        owl:unionOf ( fhir:Group
+                                                                                      fhir:Patient
+                                                                                    )
+                                                                      ]
+                                                                    ) ;
+                                                 rdf:type owl:Class
+                                               ]
+                           ] ;

Choice types have wrong unionOf axiom

Choice types are otherwise represented in OWL with owl:unionOf but have the wrong restrictions added. For example, Condition.abatement can be a dateTime, Age, Period, Range, or string.
However, Condition.abatement has a cardinality restriction that's also added as a disjunct here. But that's not optional, nor does suffice for the type. Also, it's added with duplicates here.

fhir:Condition  rdf:type             owl:Class;
 rdfs:subClassOf      
- [ owl:unionOf  ( [ rdf:type           owl:Restriction;
-                        owl:allValuesFrom  fhir:dateTime;
-                        owl:onProperty     fhir:abatement
-                      ]
-                     [ rdf:type            owl:Restriction;
-                       owl:maxCardinality  1;
-                       owl:onProperty      fhir:abatement
-                      ]
-                      [ rdf:type           owl:Restriction;
-                        owl:allValuesFrom  fhir:Age;
-                        owl:onProperty     fhir:abatement
-                      ]
-                      [ rdf:type            owl:Restriction;
-                        owl:maxCardinality  1;
-                        owl:onProperty      fhir:abatement
-                      ]
-                      [ rdf:type           owl:Restriction;
-                        owl:allValuesFrom  fhir:Period;
-                       owl:onProperty     fhir:abatement
-                      ]
-                      [ rdf:type            owl:Restriction;
-                        owl:maxCardinality  1;
-                        owl:onProperty      fhir:abatement
-                      ]
-                      [ rdf:type           owl:Restriction;
-                        owl:allValuesFrom  fhir:Range;
-                        owl:onProperty     fhir:abatement
-                      ]
-                      [ rdf:type            owl:Restriction;
-                        owl:maxCardinality  1;
-                        owl:onProperty      fhir:abatement
-                      ]
-                      [ rdf:type           owl:Restriction;
-                        owl:allValuesFrom  fhir:string;
-                        owl:onProperty     fhir:abatement
-                      ]
-                      [ rdf:type            owl:Restriction;
-                        owl:maxCardinality  1;
-                        owl:onProperty      fhir:abatement
-                      ]
-                    )
+ [ owl:unionOf ( [ rdf:type owl:Restriction ;
+                      owl:onProperty fhir:abatement ;
+                      owl:allValuesFrom fhir:Age
+                    ]
+                    [ rdf:type owl:Restriction ;
+                      owl:onProperty fhir:abatement ;
+                      owl:allValuesFrom fhir:Period
+                    ]
+                    [ rdf:type owl:Restriction ;
+                      owl:onProperty fhir:abatement ;
+                      owl:allValuesFrom fhir:Range
+                    ]
+                    [ rdf:type owl:Restriction ;
+                      owl:onProperty fhir:abatement ;
+                      owl:allValuesFrom fhir:dateTime
+                    ]
+                    [ rdf:type owl:Restriction ;
+                      owl:onProperty fhir:abatement ;
+                      owl:allValuesFrom fhir:string
+                    ]
+                  )
+    ]
+    [ rdf:type owl:Restriction ;
+      owl:onProperty fhir:abatement ;
+      owl:maxCardinality 1
+    ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurtleFHIR specification Turtle examples

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions