sparql-examples

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

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

Query_118

rq turtle/ttl

Top 100 most represented species in Cellosaurus

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
select ?species_ac ?species_name (count(distinct(?cl)) as ?cl_count) where {
  ?cl cello:derivedFromIndividualBelongingToSpecies ?species .
  ?species cello:isIdentifiedByXref / cello:accession ?species_ac .
  ?species cello:name ?species_name .
}
group by ?species_ac ?species_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_39b94405334d4c98a94d4349b2e2527022")
  v1("?cl"):::projected 
  v6("?cl_count")
  v2("?species")
  v3("?species_ac"):::projected 
  v4("?species_name"):::projected 
  a2((" "))
  a1((" "))
  v1 --"cello:derivedFromIndividualBelongingToSpecies"-->  v2
  v2 --"cello:isIdentifiedByXref"-->  a2
  a2 --"cello:accession"-->  v3
  v2 --"cello:name"-->  v4
  bind2[/"count(?cl)"/]
  v1 --o bind2
  bind2 --as--o v5
  bind3[/"count(?cl)"/]
  v1 --o bind3
  bind3 --as--o v6