sparql-examples

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

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

Query_122

rq turtle/ttl

Top 100 most represented cell types in Cellosaurus

Use at


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
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?_anon_39b94405334d4c98a94d4349b2e25270464")
  v6("?cell_line_count")
  v4("?cell_type_ac"):::projected 
  v3("?cell_type_name"):::projected 
  v1("?cl"):::projected 
  v2("?ct")
  a2((" "))
  a1((" "))
  v1 --"cello:derivedFromCellType"-->  v2
  v2 --"cello:name"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."cello:isIdentifiedByXref".->  a2
    a2 --"cello:accession"-->  v4
  end
  bind2[/"count(?cl)"/]
  v1 --o bind2
  bind2 --as--o v5
  bind3[/"count(?cl)"/]
  v1 --o bind3
  bind3 --as--o v6