A set of SPARQL examples that are used in different SIB resources
Select all approved reactions involving lipids (subclass of CHEBI:18059) that have at least one parent reaction
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
distinct
?reaction
?reactionParent
WHERE {
?reactionParent rdfs:subClassOf rh:Reaction .
?reactionParent rh:status rh:Approved .
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status rh:Approved .
?reaction rdfs:subClassOf ?reactionParent .
?reaction rh:side ?reactionSide .
?reactionSide rh:contains ?participant .
?participant rh:compound ?compound .
?compound rh:chebi ?chebi .
?chebi rdfs:subClassOf+ CHEBI:18059 .
}
ORDER BY ?reaction
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?chebi")
v5("?compound")
v4("?participant")
v1("?reaction"):::projected
v2("?reactionParent"):::projected
v3("?reactionSide")
c4(["rh:Approved"]):::iri
c2(["rh:Reaction"]):::iri
c9(["CHEBI:18059"]):::iri
v2 --"rdfs:subClassOf"--> c2
v2 --"rh:status"--> c4
v1 --"rdfs:subClassOf"--> c2
v1 --"rh:status"--> c4
v1 --"rdfs:subClassOf"--> v2
v1 --"rh:side"--> v3
v3 --"rh:contains"--> v4
v4 --"rh:compound"--> v5
v5 --"rh:chebi"--> v6
v6 --"rdfs:subClassOf"--> c9