A set of SPARQL examples that are used in different SIB resources
Pairs of reaction participants that belong to the same reaction but on distinct sides and number of reactions in which they occur
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
SELECT
?chebi1
?compound1Name
?chebi2
?compound2Name
(count(distinct ?reaction) as ?reactionCount)
WHERE {
?reaction rdfs:subClassOf rh:Reaction .
?reaction rh:status rh:Approved .
?reaction rh:side ?reactionSide1 .
?reactionSide1 rh:contains ?participant1 .
?participant1 rh:compound ?compound1 .
?compound1 rh:name ?compound1Name .
?compound1 rh:chebi ?chebi1 .
?reaction rh:side ?reactionSide2 .
?reactionSide2 rh:contains ?participant2 .
?participant2 rh:compound ?compound2 .
?compound2 rh:name ?compound2Name .
?compound2 rh:chebi ?chebi2 .
?reactionSide1 rh:transformableTo ?reactionSide2
FILTER(?chebi1<?chebi2)
}
GROUP BY ?chebi1 ?chebi2 ?compound1Name ?compound2Name
ORDER BY DESC (?reactionCount)
LIMIT 100
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?chebi1"):::projected
v3("?chebi2"):::projected
v7("?compound1")
v8("?compound1Name"):::projected
v11("?compound2")
v12("?compound2Name"):::projected
v6("?participant1")
v10("?participant2")
v4("?reaction"):::projected
v13("?reactionCount")
v5("?reactionSide1")
v9("?reactionSide2")
c4(["rh:Approved"]):::iri
c2(["rh:Reaction"]):::iri
f0[["?chebi1 < ?chebi2"]]
f0 --> v2
f0 --> v3
v4 --"rdfs:subClassOf"--> c2
v4 --"rh:status"--> c4
v4 --"rh:side"--> v5
v5 --"rh:contains"--> v6
v6 --"rh:compound"--> v7
v7 --"rh:name"--> v8
v7 --"rh:chebi"--> v2
v4 --"rh:side"--> v9
v9 --"rh:contains"--> v10
v10 --"rh:compound"--> v11
v11 --"rh:name"--> v12
v11 --"rh:chebi"--> v3
v5 --"rh:transformableTo"--> v9
bind2[/"count(?reaction)"/]
v4 --o bind2
bind2 --as--o v13