#
# example SPARQL query 124
#

@prefix schema: <https://schema.org/> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix sh: <http://www.w3.org/ns/shacl#> . 
@prefix cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/> .


cello:Query_124 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Count of cross-references by database"""@en ; 
    schema:keywords "database" , "stats" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
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(*))
    """
    .

