A set of SPARQL examples that are used in different SIB resources
Retrieve the set of metabolites involved in reactions catalyzed by human genes (HUMAN reference proteome)
PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
PREFIX ec:<http://purl.uniprot.org/enzyme/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX up:<http://purl.uniprot.org/core/>
PREFIX keywords:<http://purl.uniprot.org/keywords/>
SELECT
?chebi
?reaction
?ecNumber
?protein
?ensemblTranscript
?ensemblGene
WHERE {
SERVICE <https://sparql.uniprot.org/sparql> {
?protein a up:Protein .
?protein up:reviewed true .
?protein up:organism taxon:9606 .
?protein up:classifiedWith keywords:1185 .
?protein rdfs:seeAlso ?ensemblTranscript .
?ensemblTranscript a up:Transcript_Resource .
?ensemblTranscript up:database <http://purl.uniprot.org/database/Ensembl> .
?ensemblTranscript up:transcribedFrom ?ensemblGene .
{?protein up:enzyme ?ecNumber .}
UNION
{?protein up:domain/up:enzyme ?ecNumber .}
UNION
{?protein up:component/up:enzyme ?ecNumber .}
}
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status rh:Approved .
?reaction rh:ec ?ecNumber .
?reaction rh:side ?reactionSide .
?reactionSide rh:contains ?participant .
?participant rh:compound ?compound .
?compound rh:chebi ?chebi . # only considering small molecules participants
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?chebi"):::projected
v8("?compound")
v4("?ecNumber"):::projected
v3("?ensemblGene"):::projected
v2("?ensemblTranscript"):::projected
v7("?participant")
v1("?protein"):::projected
v5("?reaction"):::projected
v6("?reactionSide")
a1((" "))
a2((" "))
c21(["rh:Approved"]):::iri
c9(["keywords:1185"]):::iri
c19(["rh:Reaction"]):::iri
c7(["taxon:9606"]):::iri
c13([http://purl.uniprot.org/database/Ensembl]):::iri
c11(["up:Transcript_Resource"]):::iri
c5(["true^^xsd:boolean"]):::literal
c3(["up:Protein"]):::iri
subgraph s1["https://sparql.uniprot.org/sparql"]
style s1 stroke-width:4px;
v1 --"a"--> c3
v1 --"up:reviewed"--> c5
v1 --"up:organism"--> c7
v1 --"up:classifiedWith"--> c9
v1 --"rdfs:seeAlso"--> v2
v2 --"a"--> c11
v2 --"up:database"--> c13
v2 --"up:transcribedFrom"--> v3
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;
v1 --"up:component"--> a2
a2 --"up:enzyme"--> v4
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v1 --"up:domain"--> a1
a1 --"up:enzyme"--> v4
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v1 --"up:enzyme"--> v4
end
union0r <== or ==> union0l
end
end
v5 --"rdfs:subClassOf"--> c19
v5 --"rh:status"--> c21
v5 --"rh:ec"--> v4
v5 --"rh:side"--> v6
v6 --"rh:contains"--> v7
v7 --"rh:compound"--> v8
v8 --"rh:chebi"--> v9