W3C logo
slanted W3C logo

RDF Access to Relational Data(bases)

W3C Semantic Web in Health Care and Life Sciences.


Eric Prud'hommeaux, Sanitation Engineer.
URL: http://w3.org/brief/MTYw
Last modified: $Date: 2010/04/08 19:54:53 $
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License, with attribution to W3C.

Valid XHTML + RDFa

Agenda

Putting relational data on the Semantic Web.

Relational Data(bases)

[unrendered SVG image of HL7 data in a relational database]

Semantic Web

... about people, ...

... medicine, ...

... life sciences, ...

... in one universe.

Using Existing Data(bases)

[unrendered SVG image of HL7 data in RDF]

[unrendered SVG image of HL7 data in RDF]

Using Existing Data(bases)

[unrendered SVG image of HL7 data in RDF]

[unrendered SVG image of HL7 data in RDF]

Using Existing Data(bases)

[unrendered SVG image of HL7 data in RDF]

[unrendered SVG image of HL7 data in RDF]

Using Existing Data(bases)

[unrendered SVG image of HL7 data in RDF]

[unrendered SVG image of HL7 data in RDF]

Using Existing Data(bases)

[unrendered SVG image of HL7 data in RDF]

[unrendered SVG image of HL7 data in RDF]

Using Existing Data(bases)

[unrendered SVG image of HL7 data in RDF]

[unrendered SVG image of HL7 data in RDF]

What's in it for us?

most of the world's data
is in documents

machine-useful data
is in RDBs

today's questions
link RDBs

books

Mashups become queries.

SERVICE <http://uu3.org:8888/7tm_receptors>
  {
    ?iuphar  iface:family      ?family .
    ?iuphar  iface:code	       ?code .
    ?iuphar  iface:iupharName  ?iupharNm .
    ?human   iface:iuphar      ?iuphar .
    ?human   iface:geneName    "GABBR1" .
    ?human   iface:entrezGene  ?humanEntrez .
  }
SERVICE <http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&should-sponge=&>

  {
     _:gene  dbp:entrezgene    ?humanEntrez ;
             rdfs:label        ?label ;
    FILTER (lang(?label) = "en")
  }
SERVICE <http://hcls.deri.org/atag/data/gabab_example.html>
  {
     ?topic  rdfs:label        ?label .
     ?post   sioc:topic        ?topic
  }

Leverage Web architecture

loom

Scripting

spaghetti

Declarative

   PREFIX :study <http://cdisc.example/sdtm>
   PREFIX :mydb <http://cityhospital.example/dbs>
CONSTRUCT { ?o a               study:SubjectObservation .
            ?o study:subject   ?p .
            ?o study:clinician ?d .
            ?d :foaf:name ?dName }

    WHERE { ?o mydb:patient ?p .
            ?o mydb:doctor  ?d .
            ?d mydb:name    ?dName }

Integrate databases

Perform queries

HCLS demo #2 query: SPARQL query over MeSH, PubMed, Entrez Gene, GO

Learn stuff

Alzgene query results

Sacrifices

Thesis: triples of URIs promote sharing semantics.

At what cost?

SQL is optimized.

SemWeb standards are young.

Real hospital database

Real Hospital Database as RDF

... Sharable RDF

   PREFIX :study <http://cdisc.example/sdtm>
   PREFIX :mydb <http://cityhospital.example/dbs>
CONSTRUCT { ?o a               study:SubjectObservation .
            ?o study:subject   ?p .
            ?o study:clinician ?d .
            ?d :foaf:name ?dName }

    WHERE { ?o mydb:patient ?p .
            ?o mydb:doctor  ?d .
            ?d mydb:name    ?dName }

Query Transformation

PREFIX db: <…>
SELECT ?o ?d
 WHERE {
   ?o db:onPatient <Bob> .
   ?o db:byDoctor ?d .
 }

PREFIX db: <…>
SELECT observations... doctors...
  FROM observations, 
   patients ON id=observations.patient ...
   WHERE patients.name = "Bob"
 }

Use existing data.

LOD cloud

Contribute some of your own.

LODD cloud

What I want from you.

uncle sam

Extra stuff

Turtle Example: Blood Pressure






<encounter7> edns:patient <patient3> .

<patient3>   r:type galen:Patient ;
             foaf:family_name "Levin" ;
             foaf:firstName "Henry" .



      

Turtle Example: Blood Pressure






<encounter7> edns:patient <patient3> ;
             edns:screeningBP <s20090714c> .
<patient3>   r:type galen:Patient ;
             foaf:family_name "Levin" ;
             foaf:firstName "Henry" .
<s20090714c> dc:date "2009-07-14T18:23"^^xsd:dateTime ;
             edns:systolic "132"^^edns:mmHg ;
             edns:diastolic "86"^^edns:mmHg .
             
      

Turtle Example: Blood Pressure

@prefix edns: <http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix galen: <http://www.co-ode.org/ontologies/galen#> .
@prefix snomed: <http://termhost.example/SNOMED/> .

<encounter7> edns:patient <patient3> ;
             edns:screeningBP <s20090714c> .
<patient3>   r:type galen:Patient ;
             foaf:family_name "Levin" ;
             foaf:firstName "Henry" .
<s20090714c> dc:date "2009-07-14T18:23"^^xsd:dateTime ;
             edns:systolic "132"^^edns:mmHg ;
             edns:diastolic "86"^^edns:mmHg .
             

Turtle Example: Blood Pressure

@prefix edns: <http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix galen: <http://www.co-ode.org/ontologies/galen#> .
@prefix snomed: <http://termhost.example/SNOMED/> .

<encounter7> edns:patient <patient3> ;
             edns:screeningBP <s20090714c> .
<patient3>   r:type galen:Patient ;
             foaf:family_name "Levin" ;
             foaf:firstName "Henry" .
<s20090714c> dc:date "2009-07-14T18:23"^^xsd:dateTime ;
             edns:systolic "132"^^edns:mmHg ;
             edns:diastolic "86"^^edns:mmHg ;
             edns:posture snomed:_163035008 . # SNOMED:sitting

RDF/XML Example: Blood Pressure

<rdf:RDF xmlns:edns="http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#"
	 xmlns:foaf: "http://xmlns.com/foaf/0.1/" .
	 xmlns:galen: "http://www.co-ode.org/ontologies/galen#" .
	 xmlns:snomed: "http://termhost.example/SNOMED/">
<rdf:Description rdf:about="encounter7">
  <edns:patient rdf:resource="patient3"/>
  <edns:screeningBP>s20090714c</edns:screeningBP>
</rdf:Description>
<galen:Patient rdf:about="patient3" foaf:family_name="Levin" foaf:firstName="Henry">
<rdf:Description rdf:about="s20090714c">
  <dc:date xsi:dt="http://www.w3.org/2001/XMLSchemadateTime">2009-07-14T18:23</dc:date>
  <edns:systolic xsi:dt="http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#mmHg">132</edns:systolic>
  <edns:diastolic xsi:dt="http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#mmHg">86</edns:systolic>
  <edns:posture rdf:resource="http://termhost.example/SNOMED/_163035008</edns:posture> <!-- SNOMED:sitting -->
</rdf:Description>

SPARQL Example: ER Blood Pressure Query

PREFIX edns: <http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX galen: <http://www.co-ode.org/ontologies/galen#>
PREFIX snomed: <http://termhost.example/SNOMED/>

SELECT ?date ?systolic ?diastolic WHERE {

?encounter edns:patient     ?patient ;
           edns:screeningBP ?screenBP .
?patient   foaf:family_name "Levin" ;
           foaf:firstName   "Henry" .
?screenBP  dc:date          ?date ;
           edns:systolic    ?systolic ;
           edns:diastolic   ?diastolic ;
} ORDER DESC BY ?date

SPARQL Example: Study Blood Pressure Query

PREFIX edns: <http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX galen: <http://www.co-ode.org/ontologies/galen#>
PREFIX snomed: <http://termhost.example/SNOMED/>

SELECT ?date ?systolic ?diastolic WHERE {

?encounter edns:patient     ?patient ;
           edns:screeningBP ?screenBP .
?patient   foaf:family_name "Levin" ;
           foaf:firstName   "Henry" .
?screenBP  dc:date          ?date ;
           edns:systolic    ?systolic ;
           edns:diastolic   ?diastolic ;
           edns:posture ?posture . # SNOMED:sitting
FILTER (?posture = snomed:_163035008 || ?posture = snomed:_163035009)
} ORDER DESC BY ?date

SPARQL Example: Study Blood Pressure Query

PREFIX edns: <http://www.loa-cnr.it/ontologies/ExtendedDnS.owl#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX galen: <http://www.co-ode.org/ontologies/galen#>
PREFIX snomed: <http://termhost.example/SNOMED/>

SELECT ?date ?systolic ?diastolic ?posture WHERE {

?encounter edns:patient     ?patient ;
           edns:screeningBP ?screenBP .
?patient   foaf:family_name "Levin" ;
           foaf:firstName   "Henry" .
?screenBP  dc:date          ?date ;
           edns:systolic    ?systolic ;
           edns:diastolic   ?diastolic .
  OPTIONAL {
    ?screenBP  edns:posture ?posture .
  }
} ORDER DESC BY ?date

Query Federation

SELECT ?date ?systolic ?diastolic WHERE {
...
  GRAPH <ER_admission_screenings.rdf>  {
    ?sc1 edns:patient ?patient ; dc:date ?date ;
         edns:systolic ?systolic ; edns:diastolic ?diastolic .
  }
  SERVICE <http://countyHospital.example/SPARQL>  {
    ?sc2 edns:patient ?patient ; dc:date ?date ;
         edns:systolic ?systolic ; edns:diastolic ?diastolic .
  }
  SERVICE <http://countyHospital.example/SPARQL>  {
    ?patient foo:screening ?sc3 . ?sc3 foo:patient ; dc:date ?date ;
             foo:BPmeasurement ( ?systolic , ?diastolic )
  }
}

Result forms

3 types of queries:

SELECT and ASK results can be returned as XML or JSON. CONSTRUCT and DESCRIBE results can be returned via any RDF serialization (e.g. RDF/XML or Turtle).

SPARQL Resources

Inferring types

Collaboration

We want your help

join per <http://www.w3.org/2001/sw/hcls/#Participation>.