A set of SPARQL examples that are used in different SIB resources
Find the co-occurence count of topological domain comment text in UniProtKB entries
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX up: <http://purl.uniprot.org/core/>
SELECT
?comment1
?comment2
(COUNT(?comment1) AS ?count1)
WHERE
{
?protein a up:Protein ;
up:annotation ?annotation1 ,
?annotation2 .
?annotation1 rdf:type up:Topological_Domain_Annotation ;
rdfs:comment ?rawComment1 .
?annotation2 rdf:type up:Topological_Domain_Annotation ;
rdfs:comment ?rawComment2 .
BIND(IF(contains(?rawComment1, ';'),
STRBEFORE(?rawComment1,';'),
?rawComment1) AS ?comment1)
BIND(IF(contains(?rawComment2, ';'),
STRBEFORE(?rawComment2,';'),
?rawComment2) AS ?comment2)
FILTER(?annotation1 != ?annotation2)
}
GROUP BY ?comment1 ?comment2
ORDER BY DESC(COUNT(?comment1))
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?_anon_aaf95e3c346c4c97af230d5bcfeba8ab6633")
v1("?annotation1")
v2("?annotation2")
v6("?comment1"):::projected
v7("?comment2"):::projected
v9("?count1")
v3("?protein")
v4("?rawComment1")
v5("?rawComment2")
a1((" "))
c4(["up:Topological_Domain_Annotation"]):::iri
c2(["up:Protein"]):::iri
f0[["?annotation1 != ?annotation2"]]
f0 --> v1
f0 --> v2
v3 --"a"--> c2
v3 --"up:annotation"--> v1
v3 --"up:annotation"--> v2
v1 --"a"--> c4
v1 --"rdfs:comment"--> v4
v2 --"a"--> c4
v2 --"rdfs:comment"--> v5
bind1[/"if(contains(?rawComment1,';'),substring-before(?rawComment1,';'),?rawComment1)"/]
v4 --o bind1
bind1 --as--o v6
bind2[/"if(contains(?rawComment2,';'),substring-before(?rawComment2,';'),?rawComment2)"/]
v5 --o bind2
bind2 --as--o v7
bind5[/"count(?comment1)"/]
v6 --o bind5
bind5 --as--o v8
bind6[/"count(?comment1)"/]
v6 --o bind6
bind6 --as--o v9