Skip to content

Instantly share code, notes, and snippets.

@andrawaag
Created August 20, 2016 13:20
Show Gist options
  • Save andrawaag/7f41e52eb4f8e7f91bb45d3c684f8b00 to your computer and use it in GitHub Desktop.
Save andrawaag/7f41e52eb4f8e7f91bb45d3c684f8b00 to your computer and use it in GitHub Desktop.
SPARQL query to find pathways with a inchikey as input
#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 ?wpurl ?wp_compound ?wp_compoundLabel ?inchikey ?wd_compound WHERE {
SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
# Below is the Wikidata specific part of the query
?wd_compound wdt:P235 ?inchikey .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
# Below is the Wikipathways specific part of the query
?wp_compound wp:bdbWikidata ?wd_compound ;
rdfs:label ?wp_compoundLabel ;
dcterms:isPartOf ?pathway .
?pathway dcterms:identifier ?wpid ;
dc:identifier ?wpurl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment