sparql-examples

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

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

Query_116

rq turtle/ttl

Count of cell lines by cell line category

Use at


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(*))
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?_anon_39b94405334d4c98a94d4349b2e25270444")
  v3("?cl"):::projected 
  v1("?class"):::projected 
  v2("?class_name"):::projected 
  v5("?instance_count")
  a1((" "))
  c2(["cello:CellLine"]):::iri 
  v1 --"rdfs:subClassOf"-->  c2
  v1 --"rdfs:label"-->  v2
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."a".->  v1
  end
  bind2[/"count(*)"/]
  bind2 --as--o v4
  bind3[/"count(?cl)"/]
  v3 --o bind3
  bind3 --as--o v5