A set of SPARQL examples that are used in different SIB resources
Select the number of approved reactions using L-glutamine (CHEBI:29985) AND L-glutamate (CHEBI:58359) in different reaction sides
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
?reaction
?reactionEquation
WHERE {
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status rh:Approved .
?reaction rh:equation ?reactionEquation .
?reaction rh:side ?reactionSide .
?reactionSide rh:contains ?participant .
?participant rh:compound ?compound .
?compound rh:chebi CHEBI:29985
}
# There are several way to indicate that the reaction sides must be different:
# - ?reactionSide1 rh:transformableTo ?reactionSide2
# FILTER (?reactionSide1 != ?reactionSide2)
#It is better to use rh:transformableTo predicate.
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?compound")
v4("?participant")
v1("?reaction"):::projected
v2("?reactionEquation"):::projected
v3("?reactionSide")
c4(["rh:Approved"]):::iri
c10(["CHEBI:29985"]):::iri
c2(["rh:Reaction"]):::iri
v1 --"rdfs:subClassOf"--> c2
v1 --"rh:status"--> c4
v1 --"rh:equation"--> v2
v1 --"rh:side"--> v3
v3 --"rh:contains"--> v4
v4 --"rh:compound"--> v5
v5 --"rh:chebi"--> c10