sparql-examples

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

View the Project on GitHub sib-swiss/sparql-examples

5

Select all Rhea reactions mapped to KEGG reactions

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>

# Query 5 
# Select all Rhea reactions mapped to KEGG reactions
# KEGG reactions are mapped to Rhea bidirectional reactions
# Rhea web query: https://www.rhea-db.org/rhea?query=kegg:*
#
SELECT ?rhea ?kegg ?rheaDir 
WHERE {
  ?rhea rdfs:subClassOf rh:Reaction .
  ?rhea rh:bidirectionalReaction ?rheaDir .
  ?rheaDir rdfs:seeAlso ?kegg .
  FILTER (regex(str(?kegg),'kegg'))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?kegg"):::projected 
  v2("?rhea"):::projected 
  v3("?rheaDir"):::projected 
  c3(["rh:Reaction"]):::iri 
  f0[["regex(str(?kegg),'kegg')"]]
  f0 --> v1
  v2 --"rdfs:subClassOf"-->  c3
  v2 --"rh:bidirectionalReaction"-->  v3
  v3 --"rdfs:seeAlso"-->  v1