#
# example SPARQL query 113
#

@prefix schema: <https://schema.org/> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix sh: <http://www.w3.org/ns/shacl#> . 
@prefix cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/> .


cello:Query_113 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Virology annotations (comment) of some cell lines"""@en ; 
    schema:keywords "vir" , "virology" ; 
    schema:target <https://sparql.cellosaurus.org/sparql> ; 
    sh:select """
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
    """
    .

