A set of SPARQL examples that are used in different SIB resources
Select all approved reactions with CHEBI:17815 (a 1,2-diacyl-sn-glycerol) or one of its descendant. Display links to UniProtKB/Swiss-Prot entries via EC numbers if the link rhea-ec exists.
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_>
PREFIX up:<http://purl.uniprot.org/core/>
SELECT
distinct
?reaction
?enzyme
(count(distinct ?protein) as ?proteinCount)
WHERE {
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status rh:Approved .
?reaction rh:side ?reactionSide .
OPTIONAL {?reaction rh:ec ?enzyme .
SERVICE <https://sparql.uniprot.org/sparql> {
?protein up:reviewed true .
?protein up:enzyme ?enzyme.
}
} .
?reactionSide rh:contains ?participant .
?participant rh:compound ?compound .
?compound rh:chebi ?chebi .
?chebi rdfs:subClassOf* CHEBI:17815 .
}
GROUP BY ?reaction ?enzyme
ORDER BY ?reaction
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?chebi")
v6("?compound")
v3("?enzyme"):::projected
v5("?participant")
v4("?protein"):::projected
v8("?proteinCount")
v1("?reaction"):::projected
v2("?reactionSide")
c4(["rh:Approved"]):::iri
c14(["CHEBI:17815"]):::iri
c9(["true^^xsd:boolean"]):::literal
c2(["rh:Reaction"]):::iri
v1 --"rdfs:subClassOf"--> c2
v1 --"rh:status"--> c4
v1 --"rh:side"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."rh:ec".-> v3
subgraph s1["https://sparql.uniprot.org/sparql"]
style s1 stroke-width:4px;
v4 --"up:reviewed"--> c9
v4 --"up:enzyme"--> v3
end
end
v2 --"rh:contains"--> v5
v5 --"rh:compound"--> v6
v6 --"rh:chebi"--> v7
v7 --"rdfs:subClassOf"--> c14
bind1[/"count(?protein)"/]
v4 --o bind1
bind1 --as--o v8