A set of SPARQL examples that are used in different SIB resources
Count of sequence variation annotations by sequence variation type and other characteristics
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?sv_name ?with_none_reported ?with_hgvs ?with_comment ?gene_cnt (count(*) as ?cases_cnt) {
select ?sv ?sv_name ?nr ?with_none_reported ?hgvs ?with_hgvs ?comment ?with_comment (count(?gene) as ?gene_cnt) where {
?sv_type rdfs:subClassOf* cello:SequenceVariation .
?sv_type rdfs:label ?sv_name .
?sv a ?sv_type .
?sv cello:ofGene ?gene .
optional { ?sv cello:hgvs ?hgvs . }
optional { ?sv cello:noneReported ?nr . }
optional { ?sv rdfs:comment ?comment . }
bind (if(bound(?hgvs), "Yes", "No") as ?with_hgvs)
bind (if(?nr = 1, "Yes", "No") as ?with_none_reported)
bind (if(bound(?comment), "Yes", "No") as ?with_comment)
}
group by ?sv ?sv_name ?nr ?with_none_reported ?hgvs ?with_hgvs ?comment ?with_comment
}
group by ?sv_name ?with_none_reported ?with_hgvs ?with_comment ?gene_cnt
order by ?sv_name ?with_none_reported
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?cases_cnt")
v8("?comment")
v5("?gene")
v11("?gene_cnt"):::projected
v6("?hgvs")
v7("?nr")
v4("?sv")
v1("?sv_name"):::projected
v3("?sv_type")
v10("?with_comment"):::projected
v9("?with_hgvs"):::projected
v10("?with_none_reported"):::projected
c2(["cello:SequenceVariation"]):::iri
v3 --"rdfs:subClassOf"--> c2
v3 --"rdfs:label"--> v1
v4 --"a"--> v3
v4 --"cello:ofGene"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."cello:hgvs".-> v6
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."cello:noneReported".-> v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."rdfs:comment".-> v8
end
bind0[/"if(bound(?hgvs),'Yes','No')"/]
v6 --o bind0
bind0 --as--o v9
bind1[/"if(?nr = '1^^xsd:integer','Yes','No')"/]
v7 --o bind1
bind1 --as--o v10
bind2[/"if(bound(?comment),'Yes','No')"/]
v8 --o bind2
bind2 --as--o v10
bind4[/"count(?gene)"/]
v5 --o bind4
bind4 --as--o v11
bind6[/"count(*)"/]
bind6 --as--o v12