This document describes the OWL ontology for FHIR Resources represented in RDF.

Revision History

The detailed list of changes and their diffs can be found in the Git repository.

Why an Ontology

The Ontology is the formal statement of the intended structure of the individual resources (instances) when exchanged and at rest. The resource instance represented in OWL and formatted in Turtle must be consistent with the ontology.

The Ontology defines Classes, Object Properties, Data Properties, Datatypes and Annotation Properties.

Overview of the Ontology

The ontology is based on the implicit structures defined in FHIR and is separated into Structural Definition and ValueSet mappings to OWL.

Structural Definition Mapping

In general the mapping between types, elements in XML and Classes, individuals in RDF is generally the same. This section defines that default mapping and other section describe deviations from the default mapping.

Instance Mapping

Mapped to Class Name

 url Σ1..1uriAbsolute URL used to reference this StructureDefinition

Mapped to Class Annotation Properties

identifier Σ0..*IdentifierOther identifiers for the StructureDefinition.

version Σ0..1stringLogical id for this version of the StructureDefinition

.name Σ1..1stringInformal name for this StructureDefinition

.display Σ0..1stringUse this name when displaying the value

status ?! Σ1..1codedraft | active | retired ConformanceResourceStatus (Required).

experimental Σ0..1booleanIf for testing purposes, not real usage.

publisher Σ0..1stringName of the publisher (Organization or individual)

.contact Σ0..*BackboneElementContact details of the publisher

.name Σ0..1stringName of a individual to contact

.telecom Σ0..*ContactPointContact details for individual or publisher.

date Σ0..1dateTimeDate for this version of the StructureDefinition.

description Σ0..1stringNatural language description of the StructureDefinition.

useContext Σ0..*CodeableConceptContent intends to support these contexts Context of Use ValueSet (Extensible).

requirements 0..1stringScope and Usage this structure definition is for.

copyright 0..1stringUse and/or publishing restrictions.

code Σ0..*CodingAssist with indexing and finding Structure Definition Codes (Example).

fhirVersion Σ0..1idFHIR Version this StructureDefinition targets.

mapping I0..*BackboneElementExternal specification that the content is mapped to
Must have at a name or a uri (or both)

identity 1..1idInternal id when this mapping is used.

uri I0..1uriIdentifies what this mapping refers to.

name I0..1stringNames what this mapping refers to.

comments 0..1stringVersions, Issues, Scope limitations etc..

kind Σ1..1codedatatype | resource | logical StructureDefinitionKind (Required).

constrainedType Σ I0..1codeAny datatype or resource, including abstract ones FHIRDefinedType (Required).

abstract Σ1..1booleanWhether the structure is abstract.

contextType Σ I0..1coderesource | datatype | mapping | extension ExtensionContext (Required).

context Σ I0..*stringWhere the extension can be used in instances.

base Σ I0..1uriStructure that this set of constraints applies to

Mapped to Classes

snapshot I0..1BackboneElementSnapshot view of the structure Each element definition in a snapshot must have a formal definition and cardinalities.

This is just a container for the elements for snapshot.(TBD - define the transformation for Snapshot Elements)

element I1..*ElementDefinitionDefinition of elements in the resource (if no StructureDefinition)

See Element definitiion below

differential I0..1BackboneElementDifferential view of the structure.

This is just a container for the elemnts for differential (TBD - define the transformation for Differential Elements)

element 1..*ElementDefinitionDefinition of elements in the resource (if no StructureDefinition)

Element Definition

A FHIR Element Definition corresponds to an RDF/OWL Class and associated Object Properties and Data Properties

 <path value="[string]"/><!-- 1..1 The path of the element (see the Detailed Descriptions) -->

The path defines the association between classes.

fhir:”[string]” rdf:type owl:Class ; string is first letter capitalized
fhir: ”[string]” rdf:type owl:ObjectProperty ;  applied to te parent Class string is lower case

 <representation value="[code]"/><!-- 0..* How this element is represented in instances -->

This code - "xmlAttr" indicates that the element is a Data Property

 <name value="[string]"/><!-- 0..1 Name for this particular element definition (reference target) -->

The name value forms part of the Named Class along with the namespace to form the URI for the Class Name

 <label value="[string]"/><!-- 0..1 Name for element to display with or prompt for element -->

Mapped to the rdfs:label of the Class

 <code><!-- 0..* Coding Defining code --></code>

 <slicing<!-- 0..1 This element is sliced - slices follow -->

  <discriminator value="[string]"/><!-- 0..* Element values that used to distinguish the slices -->

  <description value="[string]"/><!-- ?? 0..1 Text description of how slicing works (or not) -->

  <ordered value="[boolean]"/><!-- 0..1 If elements must be in same order as slices -->

  <rules value="[code]"/><!-- 1..1 closed | open | openAtEnd -->

 </slicing>

 <short value="[string]"/><!-- 0..1 Concise definition for xml presentation -->

 <definition value="[markdown]"/><!-- 0..1 Full formal definition as narrative text -->

 <comments value="[markdown]"/><!-- 0..1 Comments about the use of this element -->

 <requirements value="[markdown]"/><!-- 0..1 Why is this needed? -->

 <alias value="[string]"/><!-- 0..* Other names -->

 <min value="[integer]"/><!--  0..1 Minimum Cardinality -->

 <max value="[string]"/><!--  0..1 Maximum Cardinality (a number or *) -->

 <base<!-- 0..1 Base definition information for tools -->

A base element defines that this element will be a subClass of the base element.

  <path value="[string]"/><!-- 1..1 Path that identifies the base element -->
  <min value="[integer]"/><!-- 1..1 Min cardinality of the base element -->
  <max value="[string]"/><!-- 1..1 Max cardinality of the base element -->

 </base>

 <type<!--  0..* Data type and Profile for this element -->

  <code value="[code]"/><!-- 1..1 Name of Data type or Resource -->

Name of the Class of the element - e.g. Narrative

  <profile value="[uri]"/><!-- 0..* Profile (StructureDefinition) to apply (or IG) -->
  <aggregation value="[code]"/><!--  0..* contained | referenced | bundled - how aggregated -->

 </type>

 <nameReference value="[string]"/><!--  0..1 To another element constraint (by element.name) -->

 <defaultValue[x]><!--  0..1 * Specified value it missing from instance --></defaultValue[x]>

 <meaningWhenMissing value="[markdown]"/><!--  0..1 Implicit meaning when this element is missing -->

 <fixed[x]><!--  0..1 * Value must be exactly this --></fixed[x]>

 <pattern[x]><!--  0..1 * Value must have at least these property values --></pattern[x]>

 <example[x]><!-- 0..1 * Example value: [as defined for type] --></example[x]>

 <minValue[x]><!-- 0..1 * Minimum Allowed Value (for some types) --></minValue[x]>

 <maxValue[x]><!-- 0..1 * Maximum Allowed Value (for some types) --></maxValue[x]>

 <maxLength value="[integer]"/><!-- 0..1 Max length for strings -->

 <condition value="[id]"/><!-- 0..* Reference to invariant about presence -->

 <constraint<!-- 0..* Condition that must evaluate to true -->

  <key value="[id]"/><!--  1..1 Target of 'condition' reference above -->

  <requirements value="[string]"/><!-- 0..1 Why this constraint necessary or appropriate -->

  <severity value="[code]"/><!-- 1..1 error | warning -->

  <human value="[string]"/><!-- 1..1 Human description of constraint -->

  <xpath value="[string]"/><!-- 1..1 XPath expression of constraint -->

 </constraint>

 <mustSupport value="[boolean]"/><!-- 0..1 If the element must supported -->

 <isModifier value="[boolean]"/><!-- 0..1 If this modifies the meaning of other elements -->

 <isSummary value="[boolean]"/><!-- 0..1 Include when _summary = true? -->

 <binding<!--  0..1 ValueSet details if this is coded -->

  <strength value="[code]"/><!-- 1..1 required | extensible | preferred | example -->

  <description value="[string]"/><!--  0..1 Human explanation of the value set -->

  <valueSet[x]><!--  0..1 uri|Reference(ValueSet) Source of value set --></valueSet[x]>

 </binding>

 <mapping<!-- 0..* Map element to another set of definitions -->

  <identity value="[id]"/><!-- 1..1 Reference to mapping declaration -->

  <language value="[code]"/><!-- 0..1 Computable language of mapping -->

  <map value="[string]"/><!-- 1..1 Details of the mapping -->

XML Attribute

An XML attribute represents a simple type and in FHIR is always “value”. FHIR datatypes have attributes of XSD datatypes.

  fhir:CodingBase.display [ a fhir:string; fhir:value "Admin"] ;
Shows an anonymous individual in [] of datatype fhir:string with value data property “Admin”.

Default Type Mapping

Nested Elements

An XML tag is unique within the namespace that it is declared in. FHIR does not use global declarations. The XML tag is mapped to an Object Property where the name is prefixed with the Class name in which it was declared. A tag “bar” declared in a complex type “Foo” would become an Object Property “Foo.bar”. This is aligned with the structural definition mechanism in FHIR.

Datatypes

In RDF the value attribute of a datatype is a Data Property named “value” with undefined range. Each FHIR data type has a restriction on the range of the Data Property (see section on Datatypes).

Structural Definition Example

<?xml version="1.0" encoding="UTF-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="example"/>
  <text>
---
  </text>
  <url value="http://hl7.org/fhir/StructureDefinition/example"/>
  <name value="Example Lipid Profile"/>
  <publisher value="Grahame Grieve"/>
  <contact>
    <telecom>
      <system value="url"/>
      <value value="grahame@healthintersections.com.au"/>
    </telecom>
  </contact>
  <description value="Describes how the lab report is used for a standard Lipid Profile - Cholesterol, Triglyceride and
Cholesterol fractions. Uses LOINC codes"/>
  <status value="draft"/>
  <date value="2012-05-12"/>
  <type value="constraint"/>
  <abstract value="false"/>
  <snapshot>
    <element>
------
    </element>
  </snapshot>
</StructureDefinition>
          

Element XML Example

The following is the Element Definition for fhir:Reference:

 <entry>
   <fullUrl value="http://hl7.org/fhir/DataElement/Reference"/>
    <resource>
      <DataElement>
         <id value="Reference"/>
          <meta>
            <lastUpdated value="2015-12-31T00:38:37.614+00:00"/>
         </meta>
         <url value="http://hl7.org/fhir/DataElement/Reference"/>
         <status value="draft"/>
         <experimental value="true"/>
         <stringency value="fully-specified"/>
          <element>
            <path value="Reference"/>
            <short value="A reference from one resource to another"/>
            <definition value="A reference from one resource to another."/>
            <min value="0"/>
            <max value="*"/>
            <type>
                <code value="Element"/>
            </type>
            <constraint>
                <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-expression">
                  <valueString value="reference.startsWith("#").not() or ($context.reference.substring(1).log("url") in $resource.contained.id.log("ids"))"/>
               </extension>
               <key value="ref-1"/>
               <severity value="error"/>
               <human value="SHALL have a local reference if the resource is provided inline"/>
               <xpath value="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])"/>
            </constraint>
            <isSummary value="true"/>
            <mapping>
               <identity value="rim"/>
               <map value="The target of a resource reference is a RIM entry point (Act, Role, or Entity)"/>
            </mapping>
         </element>
      </DataElement>
   </resource>
</entry 
          

Element Property example

 <entry>
   <fullUrl value="http://hl7.org/fhir/DataElement/Reference.display"/>
    <resource>
      <DataElement>
         <id value="Reference.display"/>
          <meta>
            <lastUpdated value="2015-12-31T00:38:37.614+00:00"/>
         </meta>
         <url value="http://hl7.org/fhir/DataElement/Reference.display"/>
         <status value="draft"/>
         <experimental value="true"/>
         <stringency value="fully-specified"/>
          <element>
            <path value="Reference.display"/>
            <short value="Text alternative for the resource"/>
            <definition value="Plain text narrative that identifies the resource in addition to the resource reference."/>
            <comments value="This is generally not the same as the Resource.text of the referenced resource. The purpose is to identify what's being referenced, not to fully describe it."/>
            <min value="0"/>
            <max value="1"/>
            <type>
                <code value="string"/>
            </type>
            <isSummary value="true"/>
            <mapping>
               <identity value="rim"/>
               <map value="N/A"/>
            </mapping>
         </element>
      </DataElement>
   </resource>
</entry> 
          

Element Example “Reference” in OWL

###  http://hl7.org/fhir/Reference
fhir:Reference rdf:type owl:Class ;
               
               rdfs:subClassOf fhir:Element ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.link ;
                                 owl:allValuesFrom fhir:DomainResource
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.display ;
                                 owl:maxCardinality "1"^^xsd:nonNegativeInteger
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.display ;
                                 owl:allValuesFrom fhir:string
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.reference ;
                                 owl:allValuesFrom fhir:string
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.reference ;
                                 owl:maxCardinality "1"^^xsd:nonNegativeInteger
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.link ;
                                 owl:maxCardinality "1"^^xsd:nonNegativeInteger
                               ] ;
               fhir:lastUpdated "2015-12-31T00:38:37.614+00:00"^^xsd:dateTime ;
               fhir:isSummary "true"^^xsd:boolean ;
               fhir:experimental "true"^^xsd:boolean ;
               fhir:concept_definition "A reference from one resource to another" ;
               fhir:status "draft" ;
               fhir:stringency "fully-specified" ;
               fhir:short "A reference from one resource to another" .
          

The object property restrictions are all defined in the containing element as opposed to FHIR Element definitions.

Property “Reference.display” example in OWL

###  http://hl7.org/fhir/Reference.display
fhir:Reference.display rdf:type owl:ObjectProperty ;
                       rdfs:domain fhir:Reference ;
                       rdfs:subPropertyOf fhir:objectProperty ;
                       rdfs:range fhir:string .
          

Datatypes (section 1.18.0.1)

Difference in the treatment of datatypes code, string and uri as classes with primitive values as rdf:Datatypes. Datatypes are transformed into OWL Classes where the value is expressed as a an OWL DataProperty with restrictions (facets etc).

Id

Id instance

Id schema

fhir:id rdf:type owl:Class ;
        rdfs:subClassOf fhir:Element ,
                        [ rdf:type owl:Restriction ;
                          owl:onProperty fhir:value ;
                          owl:allValuesFrom [ rdf:type rdfs:Datatype ;
                                              owl:onDatatype xsd:string ;
                                              owl:withRestrictions ( [ xsd:pattern "[A- Za -z0-9\\-\\.]{1,64}" ] )
                                            ]
                        ] ,
                        [ rdf:type owl:Restriction ;
                          owl:onProperty fhir:value ;
                          owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                          owl:onDataRange xsd:string
                        ] ;
        rdfs:comment "Any combination of letters, numerals, ‘-' and ‘.’ with a length limit of 64 characters.  (This might be an integer, an unprefixed OID, UUID or any other identifier pattern that meets these constraints.)  Ids are case-insensitive." .
          

Decimal

Decimal has an additional DataProperty fhir:fractionaDigits which allows the explicit declaration of scale.

Decimal OWL instance

[ a fhir:decimal ; fhir:value 123.4 ; fhir:fractionalDigits 3 ]

Decimal OWL Schema

fhir:decimal rdf:type owl:Class ;
             rdfs:subClassOf fhir:Element ,
                             [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:fractionDigits ;
                               owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                               owl:onDataRange xsd:nonNegativeInteger
                             ] ,
                             [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:fractionDigits ;
                               owl:allValuesFrom xsd:nonNegativeInteger
                             ] ,
                             [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:value ;
                               owl:allValuesFrom xsd:decimal
                             ] ,
                             [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:value ;
                               owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                               owl:onDataRange xsd:decimal
                             ] ;
             rdfs:comment "A rational number with implicit precision" .
          

FHIR CodeableConcept and Coding Structure Definition

FHIR XML

Codeable Concept example

  <substance>
    <coding>
      <system value="http://snomed.info/sct"/>
      <code value="90614001"/>
      <display value=" beta-lactam (antibiotic)"/>
    </coding>
    <text value=" beta-lactam (antibiotic)"/>
  </substance>
          

CodeableConcept Structural Definition

< [name] xmlns="http://hl7.org/fhir">
 <!-- from Element: extension -->
 < coding ><!-- 0..* Coding Code defined by a terminology system --></coding>
 < text value="[ string ]"/><!-- 0..1 Plain text representation of the concept -->
</[name]> 
          

Coding Structural Definition

< [name] xmlns="http://hl7.org/fhir">
 <!-- from Element: extension -->
 < system value="[ uri ]"/><!-- 0..1 Identity of the terminology system -->
 < version value="[ string ]"/><!-- 0..1 Version of the system - if relevant -->
 < code value="[ code ]"/><!-- 0..1 Symbol in syntax defined by the system -->
 < display value="[ string ]"/><!-- 0..1 Representation defined by the system -->
 < primary value="[ boolean ]"/><!-- 0..1 If this code was chosen directly by the user -->
</[name]>
          

RDF Data for Codeable Concept Instance

The RDF variant for fhir:Code, fhir:Coding and fhir:CodeableConcept are not straight translations of the FHIR representation. 3 new additional classes are introduced – codeBase, CodingBase and ConceptBase.

   fhir:AllergyIntolerance.substance [ rdf:type fhir:CodeableConcept ;
      fhir:ConceptBase.coding [ rdf:type fhir:CodingBase ;
         fhir:CodingBase.code [ rdf:type fhir:codeBase ; fhir:value "90614001" ] ;
         fhir:CodingBase.system [ rdf:type fhir:uri ; fhir:value "http://snomed.info/sct" ] ;
         fhir:CodingBase.display [ rdf:type fhir:string ; fhir:value "beta-lactam (antibiotic)" ]
      ] ;
      fhir:ConceptBase.text [ rdf:type fhir:string ; fhir:value "beta-lactam (antibiotic)" ]
   ] .
          

The fhir:CodeableConcept type assertion allows round trip back to the original XML type. The same approach will be taken for fhir:Coding and fhir:code.

This approach will be implemented by creating ConceptBase, CodingBase and codeBase individuals as blank nodes.

FHIR OWL Schema

 [ rdf:type owl:AllDisjointClasses ;
  owl:members ( fhir:CodingBase
                fhir:ConceptBase
                fhir:codeBase
              )
] .
          
#################################################################
#    Classes
#################################################################
###  http://hl7.org/fhir/ConceptBase
fhir:ConceptBase rdf:type owl:Class ;
                 rdfs:subClassOf fhir:Datatype ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:ConceptBase.coding ;
                                   owl:allValuesFrom fhir:CodingBase
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:ConceptBase.text ;
                                   owl:maxCardinality "1"^^xsd:nonNegativeInteger
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:ConceptBase.text ;
                                   owl:allValuesFrom fhir:string
                                 ]
.
###  http://hl7.org/fhir/CodingBase
fhir:CodingBase rdf:type owl:Class ;
                 rdfs:subClassOf fhir:Element ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.system ;
                                   owl:allValuesFrom fhir:uri
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.system ;
                                   owl:maxCardinality "1"^^xsd:nonNegativeInteger
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.version ;
                                   owl:allValuesFrom fhir:string
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.version ;
                                   owl:maxCardinality "1"^^xsd:nonNegativeInteger
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.code ;
                                   owl:allValuesFrom fhir:codeBase
                                 ]
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.code ;
                                   owl:maxCardinality "1"^^xsd:nonNegativeInteger
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.display ;
                                   owl:allValuesFrom fhir:string
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.display ;
                                   owl:maxCardinality "1"^^xsd:nonNegativeInteger
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.primary ;
                                   owl:maxCardinality "1"^^xsd:nonNegativeInteger
                                 ] ,
                                 [ rdf:type owl:Restriction ;
                                   owl:onProperty fhir:CodingBase.primary ;
                                   owl:allValuesFrom fhir:boolean
                                 ] .
          
fhir:codeBase rdf:type owl:Class ;
              rdfs:subClassOf fhir:Element ,
                              [ rdf:type owl:Restriction ;
                                owl:onProperty fhir:value ;
                                owl:allValuesFrom xsd:token
                              ] ,
                              [ rdf:type owl:Restriction ;
                                owl:onProperty fhir:value ;
                                owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                                owl:onDataRange xsd:token
                              ] .
          

The concrete subclasses of ConceptBase apply the additional restrictions:

###  http://hl7.org/fhir/CodeableConcept
fhir:CodeableConcept rdf:type owl:Class ;
   rdfs:subClassOf fhir:ConceptBase ;
   rdfs:comment "The set of possible coded values this coding was chosen from or constrained by." .
          
###  http://hl7.org/fhir/Coding
fhir:Coding rdf:type owl:Class ;
            rdfs:subClassOf fhir:ConceptBase ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:ConceptBase.text ;
                              owl:maxCardinality "0"^^xsd:nonNegativeInteger
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:ConceptBase.coding ;
                              owl:cardinality "1"^^xsd:nonNegativeInteger
                            ] .
          
fhir:code rdf:type owl:Class ;
   rdfs:subClassOf fhir:ConceptBase , [ rdf:type owl:Restriction ;
      owl:onProperty fhir:ConceptBase.coding ;
      owl:allValuesFrom [ rdf:type owl:Class ;
      owl:intersectionOf ( fhir:CodingBase
                           [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:CodingBase.code ;
                              owl:cardinality "1"^^xsd:nonNegativeInteger
                           ]
                           [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:CodingBase.display ;
                              owl:maxCardinality "0"^^xsd:nonNegativeInteger
                           ]
                           [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:CodingBase.primary ;
                              owl:maxCardinality "0"^^xsd:nonNegativeInteger
                           ]
                           [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:CodingBase.system ;
                              owl:maxCardinality "1"^^xsd:nonNegativeInteger
                           ]
                           [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:CodingBase.version ;
                              owl:maxCardinality "1"^^xsd:nonNegativeInteger
                           ]
                         )
                       ]
   ] ,
   [ rdf:type owl:Restriction ;
      owl:onProperty fhir:ConceptBase.coding ;
      owl:cardinality "1"^^xsd:nonNegativeInteger
   ] .
          

Terminology

Resource References

FHIR OWL Schema

###  http://hl7.org/fhir/Reference
fhir:Reference rdf:type owl:Class ;
               rdfs:subClassOf fhir:Element ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.reference ;
                                 owl:allValuesFrom fhir:string
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.reference ;
                                 owl:maxCardinality "1"^^xsd:nonNegativeInteger
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.display ;
                                 owl:allValuesFrom fhir:string
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.display ;
                                 owl:maxCardinality "1"^^xsd:nonNegativeInteger
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.link ;
                                 owl:allValuesFrom fhir:DomainResource
                               ] ,
                               [ rdf:type owl:Restriction ;
                                 owl:onProperty fhir:Reference.link ;
                                 owl:maxCardinality "1"^^xsd:nonNegativeInteger
                               ] .
        

Containment

Containment is where a resource or container contains other resources.

It applies to Bundle, Contained and Parameters.

Bundle

One common operation performed with resources is to gather a collection of resources into a single instance with containing context. In FHIR this is referred to as "bundling" the resources together. These resource bundles are useful for a variety of different reasons, including:

Bundle XML instance

<Bundle xmlns="http://hl7.org/fhir">
  <id value="bundle-example"/><!--   this example bundle is a search set   -->
  <meta>
    <lastUpdated value="2014-08-18T01:43:30Z"/>
  </meta><!--   when the search was executed   -->
  <type value="searchset"/><!--   the base URL of the server is responding to the search   -->
  <base value="http://example.com/base"/><!--   the total number of matches. This is a stupid example - there's a grand total of 3 matches, and we're only going to return the first 1, with a next link, in order to demonstrate what a page link looks like   -->
  <total value="3"/>
  <link>
    <relation value="self"/>
    <url value="https://example.com/base/MedicationPrescription?patient=347&amp;_include=MedicationPrescription.medication"/>
  </link><!--   now, the link to the next set of results.
  Note that a big set of results will include prev, first, last links as well as next   -->
  <link>
    <relation value="next"/>
    <url value="https://example.com/base/MedicationPrescription?patient=347&amp;searchId=ff15fd40-ff71-4b48-b366-09c706bed9d0&amp;page=2"/>
  </link><!--   now, the actual entries   -->
  <entry>
    <resource>
      <MedicationPrescription><!--   the matching resource   -->
        <id value="3123"/>
        <text>
          Omitted
        </text>
        <patient>
          <reference value="Patient/347"/>
        </patient>
        <medication>
          <reference value="Medication/example"/>
        </medication>
      </MedicationPrescription>
    </resource>
    <search><!--   this resource included as a match to the search criteria. Servers are not required to populate this, but should, because there are a few cases where it might be ambiguous whether a resource is added because it's a match or an include  -->
      <mode value="match"/><!--   score. For matches where the criteria are not determinate,
        e.g. text search on narrative, the server can include a score to indicate
        how well the resource matches the conditions. Since this search is by patient
        identifier, there's nothing fuzzy about it, but for example purposes:   -->
      <score value="1"/>
    </search>
  </entry>
  <entry>
    <resource>
      <Medication>
        <id value="example"/>
        <text>
        </text>
      </Medication>
    </resource><!--   snip   -->
    <search><!--   added because the client asked to include the medications   -->
      <mode value="include"/>
    </search>
  </entry>
</Bundle>
          

Bundle XML content description

< Bundle xmlns="http://hl7.org/fhir"> 
 <!-- from Resource: id, meta, implicitRules, and language -->
 <type value="[code]"/><!-- 1..1 document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection -->
 <total value="[unsignedInt]"/><!--  0..1 If search, the total number of matches -->
 <link>  <!-- 0..* Links related to this Bundle -->
  <relation value="[string]"/><!-- 1..1 http://www.iana.org/assignments/link-relations/link-relations.xhtml -->
  <url value="[uri]"/><!-- 1..1 Reference details for the link -->
 </link>
 <entry>  <!-- 0..* Entry in the bundle - will have a resource, or information -->
  <link><!-- 0..* Content as for Bundle.link Links related to this entry --></link>
  <fullUrl value="[uri]"/><!-- 0..1 Absolute URL for resource (server address, or UUID/OID) -->
  <resource><!-- 0..1 Resource A resource in the bundle --></resource>
  <search>  <!--  0..1 Search related information -->
   <mode value="[code]"/><!-- 0..1 match | include | outcome - why this is in the result set -->
   <score value="[decimal]"/><!-- 0..1 Search ranking (between 0 and 1) -->
  </search>
  <request>  <!-- 0..1 Transaction Related Information -->
   <method value="[code]"/><!-- 1..1 GET | POST | PUT | DELETE -->
   <url value="[uri]"/><!-- 1..1 URL for HTTP equivalent of this entry -->
   <ifNoneMatch value="[string]"/><!-- 0..1 For managing cache currency -->
   <ifModifiedSince value="[instant]"/><!-- 0..1 For managing update contention -->
   <ifMatch value="[string]"/><!-- 0..1 For managing update contention -->
   <ifNoneExist value="[string]"/><!-- 0..1 For conditional creates -->
  </request>
  <response>  <!-- 0..1 Transaction Related Information -->
   <status value="[string]"/><!-- 1..1 Status return code for entry -->
   <location value="[uri]"/><!-- 0..1 The location, if the operation returns a location -->
   <etag value="[string]"/><!-- 0..1 The etag for the resource (if relevant) -->
   <lastModified value="[instant]"/><!-- 0..1 Server's date time modified -->
  </response>
 </entry>
 <signature><!-- 0..1 Signature Digital Signature --></signature>
</Bundle>
          

Bundle RDF Schema

###  http://hl7.org/fhir/Bundle
fhir:Bundle rdf:type owl:Class ;
   rdfs:subClassOf fhir:Resource ,
      [ rdf:type owl:Restriction ; owl:onProperty fhir:Bundle.total ;
         owl:onClass fhir:unsignedInt ;
                              owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:Bundle.entry ;
                              owl:allValuesFrom fhir:Bundle.Entry
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:Bundle.signature ;
                              owl:onClass fhir:Signature ;
                              owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:Bundle.type ;
                              owl:onClass fhir:code ;
                              owl:qualifiedCardinality "1"^^xsd:nonNegativeInteger
                            ] ,
                            [ rdf:type owl:Restriction ;
                              owl:onProperty fhir:Bundle.link ;
                              owl:allValuesFrom fhir:Bundle.Link
                            ] .
###  http://hl7.org/fhir/Bundle.Entry
fhir:Bundle.Entry rdf:type owl:Class ;
                  rdfs:subClassOf fhir:BackboneElement ,
                                  [ rdf:type owl:Restriction ;
                                    owl:onProperty fhir:Bundle.Entry.search ;
                                    owl:onClass fhir:Bundle.Search ;
                                    owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger
                                  ] ,
                                  [ rdf:type owl:Restriction ;
                                    owl:onProperty fhir:Bundle.Entry.link ;
                                    owl:onClass fhir:Bundle.Link ;
                                    owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger
                                  ] ,
                                  [ rdf:type owl:Restriction ;
                                    owl:onProperty fhir:Bundle.Entry.resource ;
                                    owl:onClass fhir:Resource ;
                                    owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger
                                  ] ,
                                  [ rdf:type owl:Restriction ;
                                    owl:onProperty fhir:Bundle.Entry.fullURI ;
                                    owl:onClass fhir:uri ;
                                    owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger
                                  ] .
          

Ordering

RDF individual ordering example

Simple integer DataProperty fhir:index can be applied to individuals of subclasses of fhir:Element

###  http://hl7.org/fhir/index
fhir:index rdf:type owl:DatatypeProperty ;
           rdfs:range fhir:index-primitive .
###  http://hl7.org/fhir/index-primitive
fhir:index-primitive rdf:type rdfs:Datatype ;
                     owl:equivalentClass [ rdf:type rdfs:Datatype ;
                                           owl:onDatatype xsd:integer ;
                                           owl:withRestrictions ( [ xsd:minInclusive 1 ] )
                     ] .
###  http://hl7.org/fhir/Element
fhir:Element rdf:type owl:Class ;
             rdfs:label "Element" ;
             rdfs:subClassOf [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:Element.extension ;
                               owl:someValuesFrom fhir:Extension
                             ] ,
                             [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:Element.id ;
                               owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                               owl:onDataRange fhir:id-primitive
                             ] ,
                             [ rdf:type owl:Restriction ;
                               owl:onProperty fhir:index ;
                               owl:maxQualifiedCardinality "1"^^xsd:nonNegativeInteger ;
                               owl:onDataRange fhir:index-primitive
                             ] ;
             rdfs:comment "The base element used for all FHIR elements and resources - allows for them to be extended with extensions" .
 .
        

In general fhir:value and fhir:Element.id are converted to an attribute in XML. fhir:index dictates the sequence only.

RDF Object Property Ordering example

Where object properties need to be ordered to construct the sequence of properties in XML, the fhir:index is defined as an annotation property on the Object Property. The example of ordered properties inside CodingBase is shown:

###  http://hl7.org/fhir/index
fhir:index rdf:type owl:AnnotationProperty .
        
###  http://hl7.org/fhir/CodingBase.system
fhir:CodingBase.system rdf:type owl:ObjectProperty ;
                         fhir:index 1 ;
###  http://hl7.org/fhir/CodingBase.version
fhir:CodingBase.version rdf:type owl:ObjectProperty ;
                          fhir:index 2 .
###  http://hl7.org/fhir/CodingBase.code
fhir:CodingBase.code rdf:type owl:ObjectProperty ;
                       fhir:index 3 .
###  http://hl7.org/fhir/CodingBase.display
fhir:CodingBase.display rdf:type owl:ObjectProperty ;
                          fhir:index 4 ;
###  http://hl7.org/fhir/CodingBase.primary
fhir:CodingBase.primary rdf:type owl:ObjectProperty ;
                          fhir:index 5 ;
        

Profiles

The example shows a ‘profile” ontology restricting the Valueset of Substance:

The AllergyIntolerance Resource is declared again inside the Profile ontology.

<http://record/AllergyIntolerance/1> rdf:type <http://PatientSafetyProfile/AllergyIntolerance>, owl:NamedIndividual ;
      

profile:AllergyIntolerance.substance is defines a restriction to be applied to the valueset for substance

@prefix profile: <http://PatientSafetyProfile/> .
###  http://PatientSafetyProfile/AllergyIntolerance
profile:AllergyIntolerance rdf:type owl:Class ;
   rdfs:subClassOf fhir:AllergyIntolerance , [ rdf:type owl:Restriction ;
      owl:onProperty <http://hl7.org/fhir/AllergyIntolerance/AllergyIntolerance.substance> ;
      owl:allValuesFrom profile:substance-type
   ] .
      

The valueset definition applies:

###  http://PatientSafetyProfile/substance-type
<http://PatientSafetyProfile/substance-type> rdf:type owl:Class ;
  rdfs:subClassOf fhir:ValueSets ,
  [ rdf:type owl:Class ;
    owl:unionOf (
      <http://snomed.info/id/105590001>
      <http://snomed.info/id/373873005>
    )
  ] .
       

Slicing

Invariants

Extensions

Extension Definition

Extension Structural Definition

Using the ontology