A set of SPARQL examples that are used in different SIB resources
Select all cross-references for a given reaction
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
# Query 4
# Select all cross-references mapped to RHEA:21016
#
# This query mimics the Cross-references section of
# https://www.rhea-db.org/rhea/21016
#
SELECT distinct ?rhea ?rheaDir ?xref
WHERE {
?rhea rdfs:subClassOf rh:Reaction .
VALUES (?rhea) {(rh:21016)}
{
?rhea rdfs:seeAlso ?xref .
BIND(?rhea as ?rheaDir)
}
UNION
{
?rhea rh:directionalReaction ?directionalReaction .
?directionalReaction rdfs:seeAlso ?xref .
BIND(?directionalReaction as ?rheaDir )
}
UNION
{
?rhea rh:bidirectionalReaction ?bidirectionalReaction .
?bidirectionalReaction rdfs:seeAlso ?xref .
BIND(?bidirectionalReaction as ?rheaDir )
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?bidirectionalReaction")
v4("?directionalReaction")
v2("?rhea"):::projected
v6("?rheaDir"):::projected
v2("?xref"):::projected
c2(["rh:Reaction"]):::iri
v2 --"rdfs:subClassOf"--> c2
bind0[/VALUES ?rhea/]
bind0-->v2
bind00(["rh:21016"])
bind00 --> bind0
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;
v2 --"rh:bidirectionalReaction"--> v5
v5 --"rdfs:seeAlso"--> v2
bind1[/"?bidirectionalReaction"/]
v5 --o bind1
bind1 --as--o v6
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v2 --"rh:directionalReaction"--> v4
v4 --"rdfs:seeAlso"--> v2
bind2[/"?directionalReaction"/]
v4 --o bind2
bind2 --as--o v6
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v2 --"rdfs:seeAlso"--> v2
bind3[/"?rhea"/]
v2 --o bind3
bind3 --as--o v6
end
union0r <== or ==> union0l
end