Portal:Semantic Web/SPARQL

From WikiPathways

(Difference between revisions)
Jump to: navigation, search
Line 13: Line 13:
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dcterms: <http://purl.org/dc/terms/>
-
SELECT DISTINCT ?pathway str(?label) as ?geneProduct
+
SELECT DISTINCT
 +
  ?pathway  
 +
  (str(?label) as ?geneProduct)
WHERE {
WHERE {
     ?geneProduct a wp:GeneProduct .  
     ?geneProduct a wp:GeneProduct .  

Revision as of 04:25, 10 October 2018

We provide an (experimental) 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"). 
}
Personal tools