sparql-examples

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

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

Query_113

rq turtle/ttl

Virology annotations (comment) of some 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 ?cl_name ?has_a_source
  (if( strlen(?cm) > 60, concat(substr(?cm,0,90), '...'), ?cm) as ?virology_comment)
where {
  ?cl a / rdfs:subClassOf cello:CellLine .
  ?cl cello:recommendedName ?cl_name .
  ?cl cello:hasVirologyComment ?annot .
  ?annot a ?annot_class .
  ?annot rdfs:comment ?cm .
  optional { ?annot  cello:hasSource ?src }
  bind( if (bound(?src), 'yes', 'no') as ?has_a_source)
  #filter (bound(?src))  # uncomment so get only sourced virology comment
}
limit 100
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?annot")
  v4("?annot_class")
  v1("?cl"):::projected 
  v2("?cl_name"):::projected 
  v5("?cm"):::projected 
  v7("?has_a_source"):::projected 
  v6("?src")
  v8("?virology_comment")
  a1((" "))
  c3(["cello:CellLine"]):::iri 
  v1 --"a"-->  a1
  a1 --"rdfs:subClassOf"-->  c3
  v1 --"cello:recommendedName"-->  v2
  v1 --"cello:hasVirologyComment"-->  v3
  v3 --"a"-->  v4
  v3 --"rdfs:comment"-->  v5
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."cello:hasSource".->  v6
  end
  bind0[/"if(bound(?src),'yes','no')"/]
  v6 --o bind0
  bind0 --as--o v7
  bind1[/"if(string-length(?cm) > '60^^xsd:integer',concat(substring(?cm,'0^^xsd:integer','90^^xsd:integer'),'...'),?cm)"/]
  v5 --o bind1
  bind1 --as--o v8