sparql-examples

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

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

Query_141

rq turtle/ttl

Cell lines with a misspelling record

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 ?misspelling_name ?appears_in ?note
where {
  ?cl cello:hasMisspellingRecord ?rec.
  ?cl cello:recommendedName ?cl_name .
  ?rec cello:misspellingName ?misspelling_name .
  optional {?rec rdfs:comment ?note. }
  optional {
    ?rec cello:appearsIn ?s .
  	optional { ?s  a ?st }.
   	optional { ?s cello:internalId ?id }   	# src origin is a xref or a publi
    optional { ?s skos:prefLabel ?org }     # src origin is an organization
    optional { ?s rdfs:label ?lb }          # src origin not specified
  }
  bind (coalesce(?id, ?org, ?lb, '-') as ?appears_in)
  bind (coalesce(?st, '-') as ?source_type)
  # filter (bound(?s)) # uncomment to get misspelling not linked to a particular source
  # filter (bound(?note)) # uncomment to get misspelling with an additional note
}
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v11("?appears_in"):::projected 
  v1("?cl"):::projected 
  v3("?cl_name"):::projected 
  v8("?id")
  v10("?lb")
  v4("?misspelling_name"):::projected 
  v5("?note"):::projected 
  v9("?org")
  v2("?rec")
  v6("?s")
  v12("?source_type")
  v7("?st")
  v1 --"cello:hasMisspellingRecord"-->  v2
  v1 --"cello:recommendedName"-->  v3
  v2 --"cello:misspellingName"-->  v4
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."rdfs:comment".->  v5
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."cello:appearsIn".->  v6
    subgraph optional2["(optional)"]
    style optional2 fill:#bbf,stroke-dasharray: 5 5;
      v6 -."a".->  v7
    end
    subgraph optional3["(optional)"]
    style optional3 fill:#bbf,stroke-dasharray: 5 5;
      v6 -."cello:internalId".->  v8
    end
    subgraph optional4["(optional)"]
    style optional4 fill:#bbf,stroke-dasharray: 5 5;
      v6 -."skos:prefLabel".->  v9
    end
    subgraph optional5["(optional)"]
    style optional5 fill:#bbf,stroke-dasharray: 5 5;
      v6 -."rdfs:label".->  v10
    end
  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