sparql-examples

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

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

44_Select_the_descendant_reactions_of_a_given_reaction_in_the_Rhea_hierarchy

rq turtle/ttl

Select the descendant 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 
  ?descendantReaction 
  ?descendantEquation 
WHERE {
  BIND(rh:11628 AS ?reaction)
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  ?reaction rh:equation ?equation .

  ?descendantReaction rdfs:subClassOf rh:Reaction .
  ?descendantReaction rh:status rh:Approved .
  ?descendantReaction rdfs:subClassOf+ ?reaction .
  ?descendantReaction rh:equation ?descendantEquation .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?descendantEquation"):::projected 
  v3("?descendantReaction"):::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