Help SPARQLEndpoint

From ToxBankWiki

Help SPARQLEndpoint
Jump to: navigation, search

Contents

Accessing the SPARQL endpoint

In ToxBank Gold Compound Wiki the SPARQLExtension for Semantic MediaWiki provide a SPARQL endpoint as a web service that answers SPARQL queries. An integrated webform Special:SPARQLEndpoint can also be used as an easy graphical human-readable interface to the SPARQL endpoint. Data analysis or other software can make direct request to the HTTP-based service.

Application Example:

Example R-client

How the Gold Compound wiki can be accessed from within R see [gcwiki-r-client on github] .

With the common command line tool curl

To receive a XML-result list of all goldcompounds send an HTTP post request with the SPARQL-string and the wanted format to the wiki's SPARQL endpoint:

 SPARQL_STRING="
 PREFIX cat: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/Category-3A>
 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 
 SELECT DISTINCT ?substance ?name WHERE {
   ?substance a cat:GoldCompounds ;
     rdfs:label ?name .
 } ORDER BY ?name
 "
 
 curl -X POST -d "output=xml" -d "query=$SPARQL_STRING"  http://wiki.toxbank.net/wiki/Special:SPARQLEndpoint

SPARQL Examples:

 PREFIX cat: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/Category-3A>
 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 
 SELECT DISTINCT ?substance ?name WHERE {
   ?substance a cat:GoldCompounds ;
     rdfs:label ?name .
 } ORDER BY ?name


 PREFIX wiki: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/>
 
 SELECT ?predicate ?value WHERE {
   wiki:Acetaminophen ?predicate ?value
 }
 ORDER BY ?predicate


 PREFIX prop: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/Property-3A>
 
 SELECT DISTINCT ?effect WHERE {
   ?subject prop:Has_toxic_effect ?effect
 }


 PREFIX wiki: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/>
 PREFIX prop: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/Property-3A>
 SELECT DISTINCT ?subject WHERE {
   ?subject prop:Has_toxic_effect wiki:Apoptosis
 }


 PREFIX cat: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/Category-3A>
 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
 PREFIX prop: <http://wiki.toxbank.net/w/index.php/Special:URIResolver/Property-3A>
 
 SELECT DISTINCT ?name ?inchi ?substance
 WHERE {
   ?substance a cat:HepatotoxicCompounds 
   OPTIONAL { ?substance rdfs:label ?name } 
   OPTIONAL { ?substance prop:Has_InChI ?inchi }
   FILTER ( ?inchi != )
 }  ORDER BY ?name

Authors of this ToxBank wiki page

Micha Rautenberg
Personal tools
Namespaces
Variants
Actions
Navigation
Hepatotoxins
Cardiotoxins
Renal Toxins
Special Substances
Undifferentiated Stem Cells
hiPSC Lines
Liver Cell Lines
iPS-derived Cardiomyocytes
Reagents (Growth Factors)
Reagents (Antibodies)
Reagents (Others)
Suppliers (Cells)
Toolbox