sparql-examples

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

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

91_How_many_reactions_involve_CHEBI_17815

rq turtle/ttl

How many reactions involve CHEBI:17815 (a 1,2-diacyl-sn-glycerol) or one of its descendant?

Use at

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

SELECT
  (count(distinct ?reaction) as ?countReaction)
WHERE {
  ?reaction rdfs:subClassOf rh:Reaction ;
  rh:status rh:Approved ;
    rh:side ?reactionSide .

  ?reactionSide rh:contains ?participant .
  ?participant rh:compound ?compound .
  ?compound rh:chebi ?chebi .
  ?chebi rdfs:subClassOf* CHEBI:17815 .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?chebi")
  v4("?compound")
  v6("?countReaction")
  v3("?participant")
  v1("?reaction"):::projected 
  v2("?reactionSide")
  c9(["CHEBI:17815"]):::iri 
  c4(["rh:Approved"]):::iri 
  c2(["rh:Reaction"]):::iri 
  v1 --"rdfs:subClassOf"-->  c2
  v1 --"rh:status"-->  c4
  v1 --"rh:side"-->  v2
  v2 --"rh:contains"-->  v3
  v3 --"rh:compound"-->  v4
  v4 --"rh:chebi"-->  v5
  v5 --"rdfs:subClassOf"-->  c9
  bind1[/"count(?reaction)"/]
  v1 --o bind1
  bind1 --as--o v6