Skip to content

Instantly share code, notes, and snippets.

@egonw
Forked from andrawaag/WD_WP_inchiKey.sparql
Created August 20, 2016 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egonw/4f8de6f74c7a1313cbbc522b850b37e4 to your computer and use it in GitHub Desktop.
Save egonw/4f8de6f74c7a1313cbbc522b850b37e4 to your computer and use it in GitHub Desktop.
SPARQL query to link Wikidata and Wikipathways with an InchiKey
#QUERY <http://sparql.wikipathways.org>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT str(?inchikeyLit) as ?inchikey str(?pathwayIDLit) as ?pathwayID WHERE {
SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
?wd_compound wdt:P235 ?inchikeyLit .
}
?wp_compound wp:bdbWikidata ?wd_compound .
?wp_compound dcterms:isPartOf ?pathway .
?pathway a wp:Pathway ;
dcterms:identifier ?pathwayIDLit .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment