sparql-examples

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

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

88_How_many_descendants_of_CHEBI_17815

rq turtle/ttl

How many descendants of CHEBI:17815 (a 1,2-diacyl-sn-glycerol) in the ChEBI ontology?

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(?chebiDescendant) as ?countChild) WHERE {
  ?chebiDescendant rdfs:subClassOf+ CHEBI:17815 .
  ?chebiDescendant rdfs:label ?label .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?chebiDescendant"):::projected 
  v3("?countChild")
  v2("?label")
  c2(["CHEBI:17815"]):::iri 
  v1 --"rdfs:subClassOf"-->  c2
  v1 --"rdfs:label"-->  v2
  bind1[/"count(?chebiDescendant)"/]
  v1 --o bind1
  bind1 --as--o v3