@prefix fhir: <http://hl7.org/fhir/> .
@prefix loinc: <https://loinc.org/rdf/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sct: <http://snomed.info/id/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# - resource -------------------------------------------------------------------

<http://hl7.org/fhir/DocumentReference/example-comprehensive> a fhir:DocumentReference ;
  fhir:nodeRole fhir:treeRoot ;
  fhir:id [ fhir:v "example-comprehensive"] ; # 
  fhir:meta [
     fhir:security ( [
       fhir:system [
         fhir:v "http://terminology.hl7.org/CodeSystem/v3-ActReason"^^xsd:anyURI ;
         fhir:l <http://terminology.hl7.org/CodeSystem/v3-ActReason>
       ] ;
       fhir:code [ fhir:v "HTEST" ]
     ] )
  ] ; # 
  fhir:contained ( [
     a fhir:Practitioner ;
     fhir:id [ fhir:v "in-author" ] ;
     fhir:telecom ( [
       fhir:system [ fhir:v "email" ] ;
       fhir:value [ fhir:v "JohnMoehrke@gmail.com" ]
     ] )
  ] [
     a fhir:Patient ;
     fhir:id [ fhir:v "in-patient" ]
  ] ) ; # 
  fhir:extension ( [
     fhir:url [
       fhir:v "http://hl7.org/fhir/StructureDefinition/documentreference-sourcepatient"^^xsd:anyURI ;
       fhir:l <http://hl7.org/fhir/StructureDefinition/documentreference-sourcepatient>
     ] ;
     fhir:value [
       a fhir:Reference ;
       fhir:l <#in-patient> ;
       fhir:reference [ fhir:v "#in-patient" ]
     ]
  ] ) ; # 
  fhir:identifier ( [
     fhir:system [
       fhir:v "urn:ietf:rfc:3986"^^xsd:anyURI ;
       fhir:l <urn:ietf:rfc:3986>
     ] ;
     fhir:value [ fhir:v "urn:oid:1.2.840.113556.1.8000.2554.58783.21864.3474.19410.44358.58254.41281.46340" ]
  ] [
     fhir:system [
       fhir:v "urn:ietf:rfc:3986"^^xsd:anyURI ;
       fhir:l <urn:ietf:rfc:3986>
     ] ;
     fhir:value [ fhir:v "urn:uuid:0c287d32-01e3-4d87-9953-9fcc9404eb21" ]
  ] ) ; # 
  fhir:version [ fhir:v "urn:uuid:0c287d32-01e3-4d87-9953-9fcc9404eb21"] ; # 
  fhir:status [ fhir:v "current"] ; # 
  fhir:type [
     fhir:coding ( [
       a loinc:55107-7 ;
       fhir:system [
         fhir:v "http://loinc.org"^^xsd:anyURI ;
         fhir:l <http://loinc.org>
       ] ;
       fhir:code [ fhir:v "55107-7" ]
     ] )
  ] ; # 
  fhir:category ( [
     fhir:coding ( [
       a loinc:11369-6 ;
       fhir:system [
         fhir:v "http://loinc.org"^^xsd:anyURI ;
         fhir:l <http://loinc.org>
       ] ;
       fhir:code [ fhir:v "11369-6" ]
     ] )
  ] ) ; # 
  fhir:subject [
     fhir:l <http://hl7.org/fhir/Patient/xcda> ;
     fhir:reference [ fhir:v "Patient/xcda" ]
  ] ; # 
  fhir:event ( [
     fhir:concept [
       fhir:coding ( [
         fhir:system [
           fhir:v "http://terminology.hl7.org/CodeSystem/v3-ActCode"^^xsd:anyURI ;
           fhir:l <http://terminology.hl7.org/CodeSystem/v3-ActCode>
         ] ;
         fhir:code [ fhir:v "ACCTRECEIVABLE" ]
       ] )
     ]
  ] [
     fhir:reference [
       fhir:identifier [
         fhir:system [
           fhir:v "urn:ietf:rfc:3986"^^xsd:anyURI ;
           fhir:l <urn:ietf:rfc:3986>
         ] ;
         fhir:value [ fhir:v "urn:oid:1.2.840.113556.1.8000.2554.17917.46600.21181.17878.33419.62048.57128.2759" ]
       ]
     ]
  ] ) ; # should not be able to include this as there is a facilityType and/or practiceSetting
#    <context>
#    <reference value="Encounter/example"/>
#  </context>
  fhir:facilityType [
     fhir:coding ( [
       a sct:82242000 ;
       fhir:system [
         fhir:v "http://snomed.info/sct"^^xsd:anyURI ;
         fhir:l <http://snomed.info/sct>
       ] ;
       fhir:code [ fhir:v "82242000" ]
     ] )
  ] ; # 
  fhir:practiceSetting [
     fhir:coding ( [
       a sct:408467006 ;
       fhir:system [
         fhir:v "http://snomed.info/sct"^^xsd:anyURI ;
         fhir:l <http://snomed.info/sct>
       ] ;
       fhir:code [ fhir:v "408467006" ]
     ] )
  ] ; # 
  fhir:period [
     fhir:start [ fhir:v "2020-12-31T23:50:50-05:00"^^xsd:dateTime ] ;
     fhir:end [ fhir:v "2020-12-31T23:50:50-05:00"^^xsd:dateTime ]
  ] ; # 
  fhir:date [ fhir:v "2020-12-31T23:50:50-05:00"^^xsd:dateTime] ; # 
  fhir:author ( [
     fhir:l <#in-author> ;
     fhir:reference [ fhir:v "#in-author" ]
  ] ) ; # 
  fhir:attester ( [
     fhir:mode [
       fhir:coding ( [
         fhir:system [
           fhir:v "http://hl7.org/fhir/composition-attestation-mode"^^xsd:anyURI ;
           fhir:l <http://hl7.org/fhir/composition-attestation-mode>
         ] ;
         fhir:code [ fhir:v "professional" ]
       ] )
     ] ;
     fhir:party [
       fhir:l <#in-author> ;
       fhir:reference [ fhir:v "#in-author" ]
     ]
  ] ) ; # 
  fhir:relatesTo ( [
     fhir:code [
       fhir:coding ( [
         fhir:system [
           fhir:v "http://terminology.hl7.org/CodeSystem/document-relationship-type"^^xsd:anyURI ;
           fhir:l <http://terminology.hl7.org/CodeSystem/document-relationship-type>
         ] ;
         fhir:code [ fhir:v "appends" ]
       ] )
     ] ;
     fhir:target [
       fhir:l <http://hl7.org/fhir/DocumentReference/example> ;
       fhir:reference [ fhir:v "DocumentReference/example" ]
     ]
  ] ) ; # 
  fhir:description [ fhir:v "Example of a Comprehensive DocumentReference resource. This is fully filled for all mandatory elements and all optional elements."] ; # 
  fhir:securityLabel ( [
     fhir:coding ( [
       fhir:system [
         fhir:v "http://terminology.hl7.org/CodeSystem/v3-Confidentiality"^^xsd:anyURI ;
         fhir:l <http://terminology.hl7.org/CodeSystem/v3-Confidentiality>
       ] ;
       fhir:code [ fhir:v "N" ]
     ] )
  ] ) ; # 
  fhir:content ( [
     fhir:attachment [
       fhir:contentType [ fhir:v "text/plain" ] ;
       fhir:language [ fhir:v "en" ] ;
       fhir:url [
         fhir:v "http://example.com/nowhere.txt"^^xsd:anyURI ;
         fhir:l <http://example.com/nowhere.txt>
       ] ;
       fhir:size [ fhir:v "190"^^xsd:long ] ;
       fhir:hash [ fhir:v "OGEzOGYyNjMzMDA2ZmQ1MzUxNDljNDRhM2E3M2YzMTI0MzdiMzQ3OA=="^^xsd:base64Binary ] ;
       fhir:title [ fhir:v "DocumentReference for Comprehensive fully filled metadata" ] ;
       fhir:creation [ fhir:v "2020-12-31T23:50:50-05:00"^^xsd:dateTime ]
     ] ;
     fhir:profile ( [
       fhir:value [
         a fhir:Coding ;
         fhir:system [
           fhir:v "http://ihe.net/fhir/ihe.formatcode.fhir/CodeSystem/formatcode"^^xsd:anyURI ;
           fhir:l <http://ihe.net/fhir/ihe.formatcode.fhir/CodeSystem/formatcode>
         ] ;
         fhir:code [ fhir:v "urn:ihe:iti:xds-sd:text:2008" ]
       ]
     ] )
  ] ) . # 

<http://hl7.org/fhir/Patient/xcda> a fhir:Patient .

<http://hl7.org/fhir/DocumentReference/example> a fhir:DocumentReference .

# -------------------------------------------------------------------------------------

