sparql-examples

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

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

43_Select_the_child_reactions_of_a_given_reaction_in_the_Rhea_hierarchy

rq turtle/ttl

Select the child reaction(s) of a given reaction (RHEA:11628) in the Rhea hierarchy, (using rdfs:subClassOf)

Use at

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

SELECT ?reaction ?equation ?childReaction ?childEquation 
WHERE {
  BIND (rh:11628 AS ?reaction)
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  ?reaction rh:equation ?equation .

  ?childReaction rdfs:subClassOf rh:Reaction .
  ?childReaction rh:status rh:Approved .
  ?childReaction rdfs:subClassOf ?reaction .
  ?childReaction rh:equation ?childEquation .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?childEquation"):::projected 
  v3("?childReaction"):::projected 
  v2("?equation"):::projected 
  v1("?reaction"):::projected 
  c4(["rh:Approved"]):::iri 
  c2(["rh:Reaction"]):::iri 
  bind0[/"'rh:11628'"/]
  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 --"rdfs:subClassOf"-->  v1
  v3 --"rh:equation"-->  v4