A set of SPARQL examples that are used in different SIB resources
Find all Rhea (only small molecule) that are used in UniProtKB where the annotation has a paper and is tagged having experimental evidence.
PREFIX ECO: <http://purl.obolibrary.org/obo/ECO_>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT
?rhea
?catalyzedReaction
?source
WHERE {
{
SELECT
DISTINCT
?rhea
WHERE {
GRAPh<https://sparql.rhea-db.org/rhea> {
?rhea rdfs:subClassOf rh:Reaction .
?rhea rh:side/rh:contains/rh:compound ?compound2 .
?uc rdfs:subClassOf rh:Compound .
}
?compound2 rdfs:subClassOf ?uc .
BIND(IF(?uc = rh:SmallMolecule, 0, 1) AS ?c)
} GROUP BY ?rhea HAVING (SUM(?c) = 0)
}
?catalyzedReaction up:catalyzedReaction ?rhea .
?reif rdf:object ?catalyzedReaction ;
up:attribution ?attr .
?attr up:evidence ECO:0000269 ;
up:source ?source .
?source a up:Citation .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?_anon_524857e97b124dceaa8a4ecc8d1a18276265")
v8("?attr")
v4("?c")
v6("?catalyzedReaction"):::projected
v2("?compound2")
v7("?reif")
v1("?rhea"):::projected
v9("?source"):::projected
v3("?uc")
a2((" "))
a3((" "))
a1((" "))
c13(["ECO:0000269"]):::iri
c3(["rh:Reaction"]):::iri
c8(["rh:Compound"]):::iri
c16(["up:Citation"]):::iri
f0[[" = '0^^xsd:integer'"]]
f0 --> a1
v1 --"rdfs:subClassOf"--> c3
v1 --"rh:side"--> a2
a2 --"rh:contains"--> a3
a3 --"rh:compound"--> v2
v3 --"rdfs:subClassOf"--> c8
v2 --"rdfs:subClassOf"--> v3
bind1[/"if(?uc = 'rh:SmallMolecule','0^^xsd:integer','1^^xsd:integer')"/]
v3 --o bind1
bind1 --as--o v4
bind3[/"sum(?c)"/]
v4 --o bind3
bind3 --as--o v5
v6 --"up:catalyzedReaction"--> v1
v7 --"rdf:object"--> v6
v7 --"up:attribution"--> v8
v8 --"up:evidence"--> c13
v8 --"up:source"--> v9
v9 --"a"--> c16