sparql-examples

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

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

Query_101

rq turtle/ttl

Identifiers and names of cell lines

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?cl ?ac ?recommended_name
(group_concat(str(?old_ac); separator= ' ') as ?old_acs) (group_concat(str(?alt_name); separator= ' ') as ?alternative_names)
where {
  ?cl a / rdfs:subClassOf cello:CellLine .
  ?cl cello:primaryAccession ?ac .                       # cell line accession (ac)
  ?cl cello:recommendedName ?recommended_name .          # cell line preferred name (id)
  optional { ?cl cello:secondaryAccession ?old_ac . }    # cell line obsoleted accession(s)
  optional { ?cl cello:alternativeName ?alt_name . }     # cell line alternative name(s) (sy)
  #filter (bound(?old_ac))
}
group by ?cl ?ac ?recommended_name
limit 100
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?ac"):::projected 
  v5("?alt_name"):::projected 
  v7("?alternative_names")
  v1("?cl"):::projected 
  v4("?old_ac"):::projected 
  v6("?old_acs")
  v3("?recommended_name"):::projected 
  a1((" "))
  c3(["cello:CellLine"]):::iri 
  v1 --"a"-->  a1
  a1 --"rdfs:subClassOf"-->  c3
  v1 --"cello:primaryAccession"-->  v2
  v1 --"cello:recommendedName"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."cello:secondaryAccession".->  v4
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."cello:alternativeName".->  v5
  end
  bind2[/"str(?old_ac)"/]
  v4 --o bind2
  bind2 --as--o v6
  bind3[/"str(?alt_name)"/]
  v5 --o bind3
  bind3 --as--o v7