sparql-examples

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

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

Query_147

rq turtle/ttl

Some hybrid cell lines with the species from which they originate

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select
  ?cl_class ?cl ?cl_name
  (count(?species_name) as ?species_cnt)
  (group_concat(?species_name ; separator = ', ') as ?species_list)
  where {
    select ?cl_class ?cl ?cl_name ?species_name
      where {
      ?cl a ?cl_class .
      ?cl cello:recommendedName ?cl_name .
      ?cl cello:derivedFromIndividualBelongingToSpecies / rdfs:label ?species_name .
    }
}
group by ?cl_class ?cl ?cl_name having (count(?species_name) > 1)
order by desc(count(?species_name))
limit 100
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?_anon_39b94405334d4c98a94d4349b2e25270100")
  v5("?_anon_39b94405334d4c98a94d4349b2e2527099")
  v1("?cl"):::projected 
  v2("?cl_class"):::projected 
  v3("?cl_name"):::projected 
  v7("?species_cnt")
  v8("?species_list")
  v4("?species_name"):::projected 
  a1((" "))
  a3((" "))
  a2((" "))
  f0[[" > '1^^xsd:integer'"]]
  f0 --> a2
  v1 --"a"-->  v2
  v1 --"cello:recommendedName"-->  v3
  v1 --"cello:derivedFromIndividualBelongingToSpecies"-->  a3
  a3 --"rdfs:label"-->  v4
  bind5[/"count(?species_name)"/]
  v4 --o bind5
  bind5 --as--o v5
  bind6[/"count(?species_name)"/]
  v4 --o bind6
  bind6 --as--o v6
  bind7[/"count(?species_name)"/]
  v4 --o bind7
  bind7 --as--o v7
  bind8[/"?species_name"/]
  v4 --o bind8
  bind8 --as--o v8