#
# example SPARQL query 143
#

@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_143 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Count of cell lines for each insect taxon"""@en ; 
    schema:keywords "ox" , "taxon" , "species" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select ?taxon_scheme ?taxon_ac ?taxon_name (count(?cl) as ?cell_line_count) where {
?cl cello:derivedFromIndividualBelongingToSpecies  / cello:isIdentifiedByXref ?taxon.
?taxon skos:prefLabel ?taxon_name.
?taxon skos:inScheme ?taxon_scheme .
?taxon skos:notation ?taxon_ac .
?taxon cello:more_specific_than* / skos:prefLabel "Insecta"
}
group by ?taxon_scheme ?taxon_ac ?taxon_name
order by desc(count(?cl))
limit 300
    """
    .

