sparql-examples

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

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

017

rq turtle/ttl

Lists pathways containing entities with identifiers from a selected data source, showing the pathway title and identifier URI. This example uses the default value (Data Source "Ensembl"); 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 wp: <http://vocabularies.wikipathways.org/wp#>

SELECT DISTINCT ?pathwayRes (str(?wpid) AS ?pathway) (str(?title) AS ?pathwayTitle) ?identifier
WHERE {
  ?gene dcterms:identifier ?id ;
    dcterms:isPartOf ?pathwayRes ;
    wp:bdbEnsembl ?identifier .
  ?pathwayRes a wp:Pathway ;
    dcterms:identifier ?wpid ;
    dc:title ?title .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?gene")
  v2("?id")
  v4("?identifier"):::projected 
  v7("?pathway")
  v3("?pathwayRes"):::projected 
  v8("?pathwayTitle")
  v6("?title"):::projected 
  v5("?wpid"):::projected 
  c5(["wp:Pathway"]):::iri 
  v1 --"dcterms:identifier"-->  v2
  v1 --"dcterms:isPartOf"-->  v3
  v1 --"wp:bdbEnsembl"-->  v4
  v3 --"a"-->  c5
  v3 --"dcterms:identifier"-->  v5
  v3 --"dc:title"-->  v6
  bind0[/"str(?wpid)"/]
  v5 --o bind0
  bind0 --as--o v7
  bind1[/"str(?title)"/]
  v6 --o bind1
  bind1 --as--o v8