sparql-examples

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

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

039

rq turtle/ttl

Retrieves all ontology tags associated with a given pathway, returning the ontology term URI, pathway title, and identifier. 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 wp: <http://vocabularies.wikipathways.org/wp#>

SELECT (?o as ?pwOntologyTerm) (str(?titleLit) as ?title) ?pathway
WHERE {
  ?pathwayRDF wp:ontologyTag ?o ;
    dc:identifier ?pathway ;
    dc:title ?titleLit ;
    dcterms:identifier "WP1560" .

  FILTER (! regex(str(?pathway), "group"))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?o"):::projected 
  v1("?pathway"):::projected 
  v2("?pathwayRDF")
  v5("?pwOntologyTerm")
  v6("?title")
  v4("?titleLit"):::projected 
  c6(["WP1560"]):::literal 
  f0[["not regex(str(?pathway),'group')"]]
  f0 --> v1
  v2 --"wp:ontologyTag"-->  v3
  v2 --"dc:identifier"-->  v1
  v2 --"dc:title"-->  v4
  v2 --"dcterms:identifier"-->  c6
  bind1[/"?o"/]
  v3 --o bind1
  bind1 --as--o v5
  bind2[/"str(?titleLit)"/]
  v4 --o bind2
  bind2 --as--o v6