sparql-examples

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

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

Query_121

rq turtle/ttl

Count of cell lines originated from lymph nodes in different body parts

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX db: <https://purl.expasy.org/cellosaurus/rdf/db/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select ?xref_label ?xref_notation (count(distinct ?cl) as ?cl_count)
where {
  ?cl cello:derivedFromSite ?site .
  ?site cello:isIdentifiedByXref ?xref .
  ?xref skos:prefLabel ?xref_label ; skos:notation ?xref_notation .
  ?xref cello:more_specific_than* ?generic_concept .
  # examples:
  # UBERON_0002107 liver
  # UBERON_0002371 bone marrow
  # UBERON_0000029 lymph node
  ?generic_concept skos:notation "UBERON_0000029" .
  ?generic_concept skos:inScheme db:UBERON .
}
group by ?xref_label ?xref_notation
order by desc(count(distinct ?cl))
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?_anon_39b94405334d4c98a94d4349b2e25270215")
  v1("?cl"):::projected 
  v8("?cl_count")
  v6("?generic_concept")
  v2("?site")
  v3("?xref")
  v4("?xref_label"):::projected 
  v5("?xref_notation"):::projected 
  a1((" "))
  c6(["UBERON_0000029"]):::literal 
  c8([https://purl.expasy.org/cellosaurus/rdf/db/UBERON]):::iri 
  v1 --"cello:derivedFromSite"-->  v2
  v2 --"cello:isIdentifiedByXref"-->  v3
  v3 --"skos:prefLabel"-->  v4
  v3 --"skos:notation"-->  v5
  v3 --"cello:more_specific_than"-->  v6
  v6 --"skos:notation"-->  c6
  v6 --"skos:inScheme"-->  c8
  bind2[/"count(?cl)"/]
  v1 --o bind2
  bind2 --as--o v7
  bind3[/"count(?cl)"/]
  v1 --o bind3
  bind3 --as--o v8