#
# example SPARQL query 118
#

@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_118 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Top 100 most represented species in Cellosaurus"""@en ; 
    schema:keywords "ox" , "species" , "stats" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
select ?species_ac ?species_name (count(distinct(?cl)) as ?cl_count) where {
  ?cl cello:derivedFromIndividualBelongingToSpecies ?species .
  ?species cello:isIdentifiedByXref / cello:accession ?species_ac .
  ?species cello:name ?species_name .
}
group by ?species_ac ?species_name
order by desc(count(distinct(?cl)))
limit 100
    """
    .

