sparql-examples

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

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

71_Select_count_of_descendants_of_carbohydrate_in_the_ChEBI_ontology_used_in_Rhea_reaction_or_not

rq turtle/ttl

Select count of descendants of carbohydrate (CHEBI:16646) in the ChEBI ontology, used in Rhea reaction or not

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