Last active
November 20, 2017 07:11
-
-
Save jvsoest/de838fb15e68b5de8302f5e318a3e09d to your computer and use it in GitHub Desktop.
FHIR query DLRA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
prefix fhir: <http://hl7.org/fhir/> | |
SELECT ?subject ?givenName ?prefixName ?familyName ?procedure ?codeValue ?systemValue ?uriTerm ?uriLabel ?superTerm ?superLabel | |
WHERE { | |
#get the procedure | |
?procedure rdf:type fhir:Procedure; | |
fhir:Procedure.code ?pCode; | |
fhir:Procedure.subject ?bnode_subject. | |
#jump from procedure to the subject (line above and below) | |
?bnode_subject fhir:link ?subject. | |
#get the patient name | |
?subject fhir:Patient.name [ fhir:HumanName.family [fhir:value ?familyName]; | |
fhir:HumanName.given [fhir:value ?givenName]; | |
fhir:HumanName.prefix [fhir:value ?prefixName] ]. #prefix has a different definition than used here? | |
#get coding system from procedure | |
?pCode fhir:CodeableConcept.coding ?ccRes. | |
?ccRes fhir:Coding.code [fhir:value ?codeValue]; | |
fhir:Coding.system [fhir:value ?systemValue]. | |
#the bind should be enough, but as some terminological systems URLs are NOT the real URI's | |
# implementing a mapping table can temporarily solve this | |
#BIND (URI(CONCAT(?systemValue, "#", ?codeValue)) AS ?uriTerm). | |
VALUES (?systemValue ?terminology) { | |
("http://ncicb.nci.nih.gov/xml/owl/Thesaurus.owl" "http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#") | |
} | |
BIND (URI(CONCAT(?terminology, ?codeValue)) AS ?uriTerm). | |
?uriTerm rdfs:label ?uriLabel. | |
?uriTerm rdfs:subClassOf* ?superTerm. | |
?superTerm rdfs:label ?superLabel. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment