#
# example SPARQL query 116
#

@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_116 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Count of cell lines by cell line category"""@en ; 
    schema:keywords "ca" , "category" , "stats" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?class ?class_name (count(?cl) as ?instance_count) where {
  ?class rdfs:subClassOf* cello:CellLine . # cell line generic class
  ?class rdfs:label ?class_name .
  optional {?cl rdf:type ?class. }
}
group by ?class ?class_name
order by ?class desc(count(*))
    """
    .

