Portal:Semantic Web/SPARQL
From WikiPathways
(Difference between revisions)
(New page: We provide [http://sparql.wikipathways.org/ an (experimental) SPARQL endpoint] where data queries can be done. === WikiPathways Example SPARQL Queries === We have a large collection of ...) |
Current revision (12:03, 8 January 2020) (view source) |
||
(4 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
- | We provide [http://sparql.wikipathways.org/ | + | We provide [http://sparql.wikipathways.org/sparql a SPARQL endpoint] where data queries can be done. |
=== WikiPathways Example SPARQL Queries === | === WikiPathways Example SPARQL Queries === | ||
- | We have a large collection of [http://www.wikipathways.org/index.php/Help:WikiPathways_SPARQL_queries example queries]. | + | We have a large collection of [http://www.wikipathways.org/index.php/Help:WikiPathways_SPARQL_queries general example queries] and |
+ | [https://www.wikipathways.org/index.php/Help:WikiPathways_Metabolomics metabolite related example queries]. | ||
+ | |||
+ | For example, to list all pathways per instance of a particular gene or protein (wp:GeneProduct), you can use the following SPARQL: | ||
+ | |||
+ | <PRE> | ||
+ | PREFIX wp: <http://vocabularies.wikipathways.org/wp#> | ||
+ | PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
+ | PREFIX dcterms: <http://purl.org/dc/terms/> | ||
+ | |||
+ | SELECT DISTINCT | ||
+ | ?pathway | ||
+ | (str(?label) as ?geneProduct) | ||
+ | WHERE { | ||
+ | ?geneProduct a wp:GeneProduct . | ||
+ | ?geneProduct rdfs:label ?label . | ||
+ | ?geneProduct dcterms:isPartOf ?pathway . | ||
+ | ?pathway a wp:Pathway . | ||
+ | |||
+ | FILTER regex(str(?label), "CYP"). | ||
+ | } | ||
+ | </PRE> |
Current revision
We provide a SPARQL endpoint where data queries can be done.
WikiPathways Example SPARQL Queries
We have a large collection of general example queries and metabolite related example queries.
For example, to list all pathways per instance of a particular gene or protein (wp:GeneProduct), you can use the following SPARQL:
PREFIX wp: <http://vocabularies.wikipathways.org/wp#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX dcterms: <http://purl.org/dc/terms/> SELECT DISTINCT ?pathway (str(?label) as ?geneProduct) WHERE { ?geneProduct a wp:GeneProduct . ?geneProduct rdfs:label ?label . ?geneProduct dcterms:isPartOf ?pathway . ?pathway a wp:Pathway . FILTER regex(str(?label), "CYP"). }