A set of SPARQL examples that are used in different SIB resources
Retrieve parent reactions (and their catalyzing enzymes) for a metabolite that is not directly involved in a reaction (ex: CHEBI:83137).
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/>
PREFIX ec:<http://purl.uniprot.org/enzyme/>
PREFIX up:<http://purl.uniprot.org/core/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
PREFIX keywords:<http://purl.uniprot.org/keywords/>
SELECT
?chebi
?ecNumber
(count(?protein) as ?proteinCount)
?reaction
?equation
WHERE {
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status rh:Approved .
?reaction rh:equation ?equation .
?reaction rh:ec ?ecNumber .
?reaction rh:side ?reactionSide .
?reactionSide rh:contains ?participant .
?participant rh:compound ?compound .
?compound rh:chebi ?chebi .
CHEBI:83137 rdfs:subClassOf+ ?chebi.
SERVICE <https://sparql.uniprot.org/sparql> {
?protein a up:Protein .
?protein up:reviewed true .
{?protein up:enzyme ?ecNumber}
UNION
{?protein up:domain/up:enzyme ?ecNumber}
UNION
{?protein up:component/up:enzyme ?ecNumber} .
}
}
GROUP BY ?chebi ?ecNumber ?reaction ?equation
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?chebi"):::projected
v6("?compound")
v3("?ecNumber"):::projected
v2("?equation"):::projected
v5("?participant")
v8("?protein"):::projected
v9("?proteinCount")
v1("?reaction"):::projected
v4("?reactionSide")
a1((" "))
a2((" "))
c4(["rh:Approved"]):::iri
c11(["CHEBI:83137"]):::iri
c16(["true^^xsd:boolean"]):::literal
c2(["rh:Reaction"]):::iri
c14(["up:Protein"]):::iri
v1 --"rdfs:subClassOf"--> c2
v1 --"rh:status"--> c4
v1 --"rh:equation"--> v2
v1 --"rh:ec"--> v3
v1 --"rh:side"--> v4
v4 --"rh:contains"--> v5
v5 --"rh:compound"--> v6
v6 --"rh:chebi"--> v7
c11 --"rdfs:subClassOf"--> v7
subgraph s1["https://sparql.uniprot.org/sparql"]
style s1 stroke-width:4px;
v8 --"a"--> c14
v8 --"up:reviewed"--> c16
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v8 --"up:component"--> a2
a2 --"up:enzyme"--> v3
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v8 --"up:domain"--> a1
a1 --"up:enzyme"--> v3
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v8 --"up:enzyme"--> v3
end
union0r <== or ==> union0l
end
end
bind1[/"count(?protein)"/]
v8 --o bind1
bind1 --as--o v9