sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

Query_124

rq turtle/ttl

Count of cross-references by database

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?db_class ?db (count(*) as ?xref_count) where {
  ?xref a cello:Xref .
  ?xref cello:database ?db .
  ?db a ?db_class .
  ?db_class rdfs:subClassOf cello:Database .
}
group by ?db_class ?db
order by desc(count(*))
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?_anon_39b94405334d4c98a94d4349b2e25270207")
  v2("?db"):::projected 
  v3("?db_class"):::projected 
  v1("?xref")
  v5("?xref_count")
  a1((" "))
  c2(["cello:Xref"]):::iri 
  c5(["cello:Database"]):::iri 
  v1 --"a"-->  c2
  v1 --"cello:database"-->  v2
  v2 --"a"-->  v3
  v3 --"rdfs:subClassOf"-->  c5
  bind2[/"count(*)"/]
  bind2 --as--o v4
  bind3[/"count(*)"/]
  bind3 --as--o v5