sparql-examples

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

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

45_Select_the_parent_reactions_of_a_given_reaction

rq turtle/ttl

Select the parent reaction(s) of a given reaction

Use at

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

SELECT 
  ?reactionChild 
  ?childEquation 
  ?reactionParent 
  ?parentEquation 
WHERE {
  BIND (rh:39155 AS ?reactionChild)
  ?reactionChild rdfs:subClassOf rh:Reaction .
  ?reactionChild rh:status rh:Approved .
  ?reactionChild rh:equation ?childEquation .
  ?reactionParent rdfs:subClassOf rh:Reaction .
  ?reactionParent rh:status rh:Approved .
  ?reactionParent rh:equation ?parentEquation .
  ?reactionChild rdfs:subClassOf ?reactionParent .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?childEquation"):::projected 
  v4("?parentEquation"):::projected 
  v1("?reactionChild"):::projected 
  v3("?reactionParent"):::projected 
  c4(["rh:Approved"]):::iri 
  c2(["rh:Reaction"]):::iri 
  bind0[/"'rh:39155'"/]
  bind0 --as--o v1
  v1 --"rdfs:subClassOf"-->  c2
  v1 --"rh:status"-->  c4
  v1 --"rh:equation"-->  v2
  v3 --"rdfs:subClassOf"-->  c2
  v3 --"rh:status"-->  c4
  v3 --"rh:equation"-->  v4
  v1 --"rdfs:subClassOf"-->  v3