sparql-examples

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

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

Query_117

rq turtle/ttl

Count of cell lines by sex of the individual from which the cell line originates

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?sex (count(?cl) as ?cl_count) where {
  ?cl a / rdfs:subClassOf cello:CellLine.
  optional { ?cl cello:derivedFromIndividualWithSex ?sex. }
}
group by ?sex
order by ?sex
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?cl"):::projected 
  v3("?cl_count")
  v1("?sex"):::projected 
  a1((" "))
  c3(["cello:CellLine"]):::iri 
  v2 --"a"-->  a1
  a1 --"rdfs:subClassOf"-->  c3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."cello:derivedFromIndividualWithSex".->  v1
  end
  bind1[/"count(?cl)"/]
  v2 --o bind1
  bind1 --as--o v3