#
# example SPARQL query 121
#

@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_121 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Count of cell lines originated from lymph nodes in different body parts"""@en ; 
    schema:keywords "site" , "anatomy" , "organ" , "tissue" , "body part" , "stats" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX db: <https://purl.expasy.org/cellosaurus/rdf/db/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select ?xref_label ?xref_notation (count(distinct ?cl) as ?cl_count)
where {
  ?cl cello:derivedFromSite ?site .
  ?site cello:isIdentifiedByXref ?xref .
  ?xref skos:prefLabel ?xref_label ; skos:notation ?xref_notation .
  ?xref cello:more_specific_than* ?generic_concept .
  # examples:
  # UBERON_0002107 liver
  # UBERON_0002371 bone marrow
  # UBERON_0000029 lymph node
  ?generic_concept skos:notation "UBERON_0000029" .
  ?generic_concept skos:inScheme db:UBERON .
}
group by ?xref_label ?xref_notation
order by desc(count(distinct ?cl))
    """
    .

