sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

036

rq turtle/ttl

Lists all gene products in a given pathway, returning the pathway identifier and gene product labels. This example uses the default value (Pathway ID "WP1560"); the WikiPathways SNORQL UI lets you change it.

Use at

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>

select distinct ?pathway (str(?label) as ?geneProduct) where {
    {
        SELECT ?pathwayRev ?pathway WHERE {
            ?pathwayRev dcterms:identifier "WP1560" .
            ?pathwayRev a wp:Pathway .
            ?pathwayRev dc:identifier ?pathway .
        }
    }
    ?gene dcterms:isPartOf ?pathwayRev .
    ?gene a wp:GeneProduct .
    ?gene rdfs:label ?label .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?gene")
  v5("?geneProduct")
  v4("?label"):::projected 
  v2("?pathway"):::projected 
  v1("?pathwayRev")
  c7(["wp:GeneProduct"]):::iri 
  c2(["WP1560"]):::literal 
  c4(["wp:Pathway"]):::iri 
  v1 --"dcterms:identifier"-->  c2
  v1 --"a"-->  c4
  v1 --"dc:identifier"-->  v2
  v3 --"dcterms:isPartOf"-->  v1
  v3 --"a"-->  c7
  v3 --"rdfs:label"-->  v4
  bind0[/"str(?label)"/]
  v4 --o bind0
  bind0 --as--o v5