A set of SPARQL examples that are used in different SIB resources
Select all Rhea reactions mapped to Reactome reactions
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
# Query 7
# Select all Rhea reactions mapped to Reactome reactions
# MetaCyc reactions are mapped to either undirected, left-to-right or right-to-left reactions
# Rhea web query: https://www.rhea-db.org/rhea?query=reactome:*
#
SELECT distinct ?rhea ?rheaDir ?reactome
WHERE {
?rhea rdfs:subClassOf rh:Reaction .
{
?rhea rdfs:seeAlso ?reactome .
FILTER CONTAINS(str(?reactome), "reactome")
BIND(?rhea as ?rheaDir)
}
UNION
{
?rhea rh:directionalReaction ?directionalReaction .
?directionalReaction rdfs:seeAlso ?reactome .
FILTER CONTAINS(str(?reactome), "reactome")
BIND(?directionalReaction as ?rheaDir )
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?directionalReaction")
v2("?reactome"):::projected
v1("?rhea"):::projected
v5("?rheaDir"):::projected
c2(["rh:Reaction"]):::iri
v1 --"rdfs:subClassOf"--> c2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[["contains(str(?reactome),'reactome')"]]
f0 --> v2
v1 --"rh:directionalReaction"--> v4
v4 --"rdfs:seeAlso"--> v2
bind1[/"?directionalReaction"/]
v4 --o bind1
bind1 --as--o v5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f2[["contains(str(?reactome),'reactome')"]]
f2 --> v2
v1 --"rdfs:seeAlso"--> v2
bind3[/"?rhea"/]
v1 --o bind3
bind3 --as--o v5
end
union0r <== or ==> union0l
end