sparql-examples

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

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

89_Give_me_all_CHEBI_identifier_and_label_for_the_descendants_of_CHEBI_17815

rq turtle/ttl

Give me all CHEBI identifier and label for the descendants of CHEBI:17815 (a 1,2-diacyl-sn-glycerol)

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX CHEBI:<http://purl.obolibrary.org/obo/CHEBI_>
SELECT
  ?chebiDescendant
  (str(?label) as ?chebiLabel)
WHERE {
  ?chebiDescendant rdfs:subClassOf+ CHEBI:17815 .
  ?chebiDescendant rdfs:label ?label .
}
ORDER BY ?chebiDescendantCarbohydrate
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?chebiDescendant"):::projected 
  v1("?chebiDescendantCarbohydrate")
  v4("?chebiLabel")
  v3("?label"):::projected 
  c2(["CHEBI:17815"]):::iri 
  v2 --"rdfs:subClassOf"-->  c2
  v2 --"rdfs:label"-->  v3
  bind0[/"str(?label)"/]
  v3 --o bind0
  bind0 --as--o v4