W3C logo
slanted W3C logo

TimBl's TED Talk 2009-02-04

This slide set was presented at the 4 Feb, 2009 TED conference in San Clara CA.


Eric Prud'hommeaux, Sanitation Engineer, +1.617.599.3509.
Last modified: $Date: 2009/05/04 15:04:37 $
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License, with attribution to TED.

Valid XHTML + RDFa

Web of Data

Uses of this Data

Federation Scenario

# Assign convenient prefixes to common for later syntactic shorthand.
PREFIX db: <http://www.w3.org/2003/01/21-RDF-RDB-access/ns#SqlDB?properties=..%2Ftest%2F>
PREFIX ma: <http://med.example/ma#>
PREFIX cs: <http://med.example/cs#>
PREFIX up: <http://med.example/up#>
PREFIX sa: <http://med.example/sa#>
PREFIX mt: <http://med.example/mt#>

SELECT ?name ?chemical ?motif ?saProt ?kd50 ?like ?ld


FROM NAMED db:MicroArray.prop
FROM NAMED db:Uniprot.rdf
FROM NAMED db:ScreeningAssay.prop
FROM NAMED db:ChemStructure.prop

FROM NAMED db:MouseToxicity.prop

WHERE
{
# Get a name and a chemical from the (SQL) MicroArray database.
GRAPH db:MicroArray.prop {
         ?g	ma:name		?name .
	 ?g	ma:expression	"up" .
	 ?g	ma:experiment	?kinase .
	 ?kinase ma:against	?chemical }


# The uniprot data (in RDF) has motif and pathway information.
GRAPH db:Uniprot.rdf {
         ?p	ma:name		?name .		# bound to ?ma.ma:name
	 ?p	up:motif	?motif .
	 ?p	up:pathway	"apoptosis" }


# Use the (SQL) Kinase databaes to limit to the interesting chemicals.
GRAPH db:ScreeningAssay.prop {
         ?a	sa:name		"KinaseAssay" .
	 ?a	cs:chemical	?chemical .	# bound to ?ma.cs:chemical
	 ?a	sa:upname	?saProt .
	 ?a	ma:kd50		?kd50

         FILTER (?kd50 >= .7 || ?kd50 < .2) }

# This (SQL) chemical database indexes like sidechains.
GRAPH db:ChemStructure.prop {
         ?c	cs:chemical	?chemical .	# bound to ?ma.cs:chemical, ?sa.cs:chemical

	 ?c	cs:structure	"asdfasdf" .
	 ?c	cs:sidechain	?side .
	 ?c2	cs:sidechain	?side .
	 ?c2	cs:chemical	?like }

# Limit by toxicity in the (SQL) MouseToxicity experiments.
GRAPH db:MouseToxicity.prop {
         ?t	cs:chemical	?like .		# bound to ?cs.cs:sidechain

	 ?t	mt:toxicity	?ld
         FILTER (?ld < .35) }
}

Federation Mechanics

# Get a name and a chemical from the (SQL) MicroArray database.
GRAPH db:MicroArray.prop {
         ?g	ma:name		?name .
	 ?g	ma:expression	"up" .
	 ?g	ma:experiment	?kinase .
	 ?kinase ma:against	?chemical }

}

gives me:

g name kinase chemical
g1Q9NY61kin:PIGF sugar
g2Q8WTP8 kin:FGFR1salt
g3O95831 kin:FGFR1sweat

Federation Mechanics

gnamekinaseaginchemical
g1Q9NY61kin:PIGFagin1sugar
g2Q8WTP8kin:FGFR1agin2salt
g3O95831kin:FGFR1agin2sweat

The next graph query

# The uniprot data (in RDF) has motif and pathway information.
GRAPH db:Uniprot.rdf {
         ?p	ma:name		?name .		# bound to ?ma.ma:name
	 ?p	up:motif	?motif .
	 ?p	up:pathway	"apoptosis" }

is constrained by the variable name.

Cost of Federation

  1. dispatch the next query unconstrained by the current results.
    # The uniprot data (in RDF) has motif and pathway information.
    GRAPH db:Uniprot.rdf {
             ?p	ma:name		?span .		# bound to ?ma.ma:name
    	 ?p	up:motif	?motif .
    	 ?p	up:pathway	"apoptosis" }
    
  2. issue the query three times, with each of (Q9NY61, Q8WTP8, O95831) substituted for ?name
    GRAPH db:Uniprot.rdf {
             ?p	ma:name		"Q9NY61" .		# bound to ?ma.ma:name
    	 ?p	up:motif	?motif .
    	 ?p	up:pathway	"apoptosis" }
    
    GRAPH db:Uniprot.rdf {
             ?p	ma:name		"Q8WTP8" .		# bound to ?ma.ma:name
    	 ?p	up:motif	?motif .
    	 ?p	up:pathway	"apoptosis" }
    
    GRAPH db:Uniprot.rdf {
             ?p	ma:name		"O95831" .		# bound to ?ma.ma:name
    	 ?p	up:motif	?motif .
    	 ?p	up:pathway	"apoptosis" }
    

SPARQLfed Extension to SPARQL

Send current (relevent) bindings with the query:

# The uniprot data (in RDF) has motif and pathway information.
GRAPH db:Uniprot.rdf {
         ?p	ma:name		?name .		# bound to ?ma.ma:name
	 ?p	up:motif	?motif .
	 ?p	up:pathway	"apoptosis" }
 BINDINGS ?name { 
  ("Q9NY61")
  ("Q8WTP8")
  ("O95831") }

Cost of Federation

Choreographed Queries

    # The uniprot data (in RDF) has motif and pathway information.
    GRAPH db:Uniprot.rdf {
	?p	ma:name		?name .		# bound to ?ma.ma:name
	?p	up:motif	?motif .
	?p	up:pathway	"apoptosis"
    }

Choreographed Queries