sparql-examples

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

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

020

rq turtle/ttl

Retrieves pathways classified under metabolic pathway ontology terms, filtering by label to find metabolic pathway annotations.

Use at

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>

SELECT distinct ?pathway ?label ?tag
WHERE {
  ?tag1 a owl:Class ;
  rdfs:label ?label .
  ?tag rdfs:subClassOf* ?tag1.
  ?pathway a wp:Pathway; wp:ontologyTag ?tag.
FILTER regex(str(?label), "metabolic pathway")
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?label"):::projected 
  v4("?pathway"):::projected 
  v3("?tag"):::projected 
  v2("?tag1")
  c6(["wp:Pathway"]):::iri 
  c3(["owl:Class"]):::iri 
  f0[["regex(str(?label),'metabolic pathway')"]]
  f0 --> v1
  v2 --"a"-->  c3
  v2 --"rdfs:label"-->  v1
  v3 --"rdfs:subClassOf"-->  v2
  v4 --"a"-->  c6
  v4 --"wp:ontologyTag"-->  v3