Skip to content

Instantly share code, notes, and snippets.

@andrawaag
Created August 20, 2016 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrawaag/4da71db85e6cb8e6cf3513de124ac2f9 to your computer and use it in GitHub Desktop.
Save andrawaag/4da71db85e6cb8e6cf3513de124ac2f9 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 * 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 .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment