#
# example SPARQL query 122
#

@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_122 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Top 100 most represented cell types in Cellosaurus"""@en ; 
    schema:keywords "cell-type" , "cell" , "stats" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
select ?cell_type_ac ?cell_type_name (count(distinct ?cl) as ?cell_line_count) where {
    ?cl cello:derivedFromCellType ?ct.
    ?ct cello:name ?cell_type_name .
    optional {
    	?ct cello:isIdentifiedByXref / cello:accession ?cell_type_ac .
    }
  }
group by ?cell_type_ac ?cell_type_name
order by desc(count(distinct(?cl)))
limit 100
    """
    .

