#
# example SPARQL query 112
#

@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_112 a sh:SPARQLExecutable ;
    sh:prefixes _:sparql_examples_prefixes ;
    rdfs:comment """Microsatellite instability (MSI) annotations of some cell lines"""@en ; 
    schema:keywords "MSI" , "source" ; 
    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#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select ?cl ?cl_name ?value ?source_type ?source  ?comment where {
    ?cl cello:hasMicrosatelliteInstability ?annot .
  	?cl cello:recommendedName ?cl_name .
    ?annot cello:hasMicrosatelliteInstabilityStatus ?value .
    ?annot cello:hasSource ?s .
          optional { ?s cello:originatesFrom / a ?st }.
   	optional { ?s cello:originatesFrom / cello:internalId ?id }   	# src origin is a xref or a publi
    optional { ?s cello:originatesFrom / skos:prefLabel ?org }      # src origin is an organization
    optional { ?s rdfs:label ?lb }                                  # src origin not specified
          bind (coalesce(?id, ?org, ?lb, '-') as ?source)
  	bind (coalesce(?st, '-') as ?source_type)
    optional {?annot rdfs:comment ?comment }
}
order by ?cl ?value ?comment
limit 1000
    """
    .

