W3C logo
slanted W3C logo

RDF and non-RDF Databases on the Semantic Web

W3C Semantic Web Projects.

Eric Prud'hommeaux, Sanitation Engineer.
Last modified: $Date: 2009/06/09 21:27:17 $
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License, with attribution to W3C.

Valid XHTML + RDFa


Hospital Data

Diabetic Patient Data

Databases as RDF

Translation Tools

Construct Approach

Warning: vapid example:

CONSTRUCT Expressivity

   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 }

Transform Queries

PREFIX db: <…>
   ?O db:onPatient ?P .
   ?O db:byDoctor ?D .

Triples Transformation

(Virtual) Transformation Pipe


  cat sdtm.rq | \
  SWtransformer -q - hl7-sdtm.rq | \
  SWtransformer -q - db-hl7.rq -s http://hospital.example/DB/ | \
  mysql -u root DiabeticPatientsDataSet --table

SDTM Patient

Taking some medication

and not taking other medication

SDTM Query

PREFIX sdtm: <http://www.sdtm.org/vocabulary#>
PREFIX spl: <http://www.hl7.org/v3ballot/xml/infrastructure/vocabulary/vocabulary#>

SELECT ?patient ?dob ?sex ?takes ?indicDate # ?indicEnd ?contra
  ?patient a sdtm:Patient ;
          sdtm:middleName ?middleName ;
          sdtm:dateTimeOfBirth ?dob ;
          sdtm:sex ?sex .

  ?ip	  sdtm:subject ?patient ;
	  sdtm:standardizedMedicationName ?takes ;

	  # nothing by ingredient in sdtm/caBIG/...
#          sdtm:startDateTimeOfMedication ?indicDate ;
	  # ; sdtm:endDateTimeOfMedication ?indicEnd
	  spl:activeIngredient ?ic . ?ic spl:classCode 6809
  ?cp	  sdtm:subject ?patient ;
	  sdtm:standardizedMedicationName ?contra ;
# 	  sdtm:startDateTimeOfMedication ?contraDate ;
	  # ; sdtm:endDateTimeOfMedication   ?contraEnd
	  spl:activeIngredient ?cc . ?cc spl:classCode 11289
  FILTER (!BOUND(?cp))
} LIMIT 30

SDTM data fits a pattern

as does RIM

Graph transformations

via SemWeb rules

RIM Query

PREFIX rim: <http://www.hl7.org/v3ballot/xml/infrastructure/vocabulary/vocabulary#>

SELECT ?patient ?dob ?sex ?takes ?indicDate 
  ?patient a rim:Person> .
  ?patient rim:entityName ?middleName .
  ?patient rim:livingSubjectBirthTime ?dob .
  ?patient rim:administrativeGenderCodePrintName ?sex .
  ?patient rim:substanceAdministration _:admin .
      # substance administration
      _:admin a rim:SubstanceAdministration> .
      _:admin rim:consumable _:subst .
          # substance
          _:subst rim:displayName ?takes .
          _:subst rim:activeIngredient _:ingred .
              _:ingred rim:classCode 6809  .
      _:admin rim:effectiveTime _:when .
          _:when rim:start ?indicDate .

pushing our query

into the database

CONSTRUCT Advantages


Merged Data Ideal

Many DBs contributing
to a network of data.

Query the World

Configured query services
federating and distributing
to many DB Interfaces.

Conspicuously Absent


thanks to Lilly and Lincoln Labs for funding this work.