sparql-examples

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

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

Query_112

rq turtle/ttl

Microsatellite instability (MSI) annotations 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#>
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
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?annot")
  v1("?cl"):::projected 
  v5("?cl_name"):::projected 
  v3("?comment"):::projected 
  v8("?id")
  v10("?lb")
  v9("?org")
  v6("?s")
  v11("?source"):::projected 
  v12("?source_type"):::projected 
  v7("?st")
  v2("?value"):::projected 
  a1((" "))
  a2((" "))
  a3((" "))
  v1 --"cello:hasMicrosatelliteInstability"-->  v4
  v1 --"cello:recommendedName"-->  v5
  v4 --"cello:hasMicrosatelliteInstabilityStatus"-->  v2
  v4 --"cello:hasSource"-->  v6
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v6 -."cello:originatesFrom".->  a1
    a1 --"a"-->  v7
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v6 -."cello:originatesFrom".->  a2
    a2 --"cello:internalId"-->  v8
  end
  subgraph optional2["(optional)"]
  style optional2 fill:#bbf,stroke-dasharray: 5 5;
    v6 -."cello:originatesFrom".->  a3
    a3 --"skos:prefLabel"-->  v9
  end
  subgraph optional3["(optional)"]
  style optional3 fill:#bbf,stroke-dasharray: 5 5;
    v6 -."rdfs:label".->  v10
  end
  bind0[/"?id?org?lb'-'"/]
  v8 --o bind0
  v9 --o bind0
  v10 --o bind0
  bind0 --as--o v11
  bind1[/"?st'-'"/]
  v7 --o bind1
  bind1 --as--o v12
  subgraph optional4["(optional)"]
  style optional4 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."rdfs:comment".->  v3
  end