sparql-examples

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

View the Project on GitHub ytirlet/sparql-examples

M37_module

rq turtle/ttl

ChEBI restriction

Use at

PREFIX up: <http://purl.uniprot.org/core/>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?compound ?chebi ?superchebi ?chebiRestriction ?chebi2
WHERE {
        ?compound rh:chebi ?chebi.
        ?chebiRestriction owl:someValuesFrom ?chebi.
        ?chebiRestriction rdf:type owl:Restriction.
        ?chebi2 rdfs:subClassOf ?chebiRestriction.
        ?chebi2 (rdfs:subClassOf)+ ?superchebi.
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?chebi"):::projected 
  v4("?chebi2"):::projected 
  v3("?chebiRestriction"):::projected 
  v1("?compound"):::projected 
  v5("?superchebi"):::projected 
  c4(["owl:Restriction"]):::iri 
  v1 --"rh:chebi"-->  v2
  v3 --"owl:someValuesFrom"-->  v2
  v3 --"a"-->  c4
  v4 --"rdfs:subClassOf"-->  v3
  v4 --"rdfs:subClassOf"-->  v5