sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

Query_143

rq turtle/ttl

Count of cell lines for each insect taxon

Use at


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
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?_anon_39b94405334d4c98a94d4349b2e25270384")
  v7("?cell_line_count")
  v1("?cl"):::projected 
  v2("?taxon")
  v5("?taxon_ac"):::projected 
  v3("?taxon_name"):::projected 
  v4("?taxon_scheme"):::projected 
  a2((" "))
  a3((" "))
  a1((" "))
  c7(["Insecta"]):::literal 
  v1 --"cello:derivedFromIndividualBelongingToSpecies"-->  a2
  a2 --"cello:isIdentifiedByXref"-->  v2
  v2 --"skos:prefLabel"-->  v3
  v2 --"skos:inScheme"-->  v4
  v2 --"skos:notation"-->  v5
  v2 --"cello:more_specific_than"-->  a3
  a3 --"skos:prefLabel"-->  c7
  bind2[/"count(?cl)"/]
  v1 --o bind2
  bind2 --as--o v6
  bind3[/"count(?cl)"/]
  v1 --o bind3
  bind3 --as--o v7