A set of SPARQL examples that are used in different SIB resources
Proteins located in nucleus and nowhere else
PREFIX : <http://nextprot.org/rdf/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?entry WHERE {
{
select ?entry (count(?loc) as ?anyLoc) (sum(?inNucleus) as ?nucleusLoc)
WHERE {
?entry :isoform / :cellularComponent ?loc .
?loc :evidence / :negative false .
?loc :term ?locterm.
bind( exists {
?locterm :childOf / rdfs:label ?label.
filter (regex(?label, '^[Nn]ucleus$'))
} as ?inNucleus)
}
group by ?entry
}
filter ( ?anyLoc = ?nucleusLoc)
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?anyLoc")
v3("?entry"):::projected
v6("?inNucleus")
v4("?loc")
v5("?locterm")
v7("?nucleusLoc")
a1((" "))
a2((" "))
c5(["false^^xsd:boolean"]):::literal
f0[["?anyLoc = ?nucleusLoc"]]
f0 --> v7
f0 --> v7
v3 --":isoform"--> a1
a1 --":cellularComponent"--> v4
v4 --":evidence"--> a2
a2 --":negative"--> c5
v4 --":term"--> v5
f1[["regex(?label,'^#91;Nn#93;ucleus$')"]]
f1 --> null
v5 --":childOf"--> null
null --"rdfs:label"--> null
bind2[/" "/]
subgraph bind2e0["Exists Clause"]
e0f0[["regex(?label,'^#91;Nn#93;ucleus$')"]]
e0f0 --> e0v1
e0v2 --":childOf"--> e0a1
e0a1 --"rdfs:label"--> e0v1
e0v1("?label"):::projected
e0v2("?locterm"):::projected
e0a1((" ")):::projected
end
bind2--EXISTS--> bind2e0
null --o bind2
v5 --o bind2
null --o bind2
null --o bind2
null --o bind2
bind2 --as--o v6
bind5[/"count(?loc)"/]
v4 --o bind5
bind5 --as--o v7
bind6[/"sum(?inNucleus)"/]
v6 --o bind6
bind6 --as--o v7