sparql-examples

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

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

Query_114

rq turtle/ttl

Some antibody producing cell lines with their antibody target

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 ?target_class (substr(?target_name,0,30) as ?target_name_truncated) ?target_ac  ?comment where {
   ?cl cello:hasMoAbTarget ?annot.
   ?cl cello:recommendedName ?cl_name .
   ?annot a ?target_class .
   ?annot rdfs:label ?target_name .
   optional {?annot rdfs:comment ?comment }
   optional {
    ?annot cello:isIdentifiedByXref ?xref .
    ?xref cello:accession ?target_ac .
  	}
    filter (bound(?comment)) # comment this filter to also retrieve those without comment
    filter (bound(?xref))    # comment this filter to also retrieve targets not identified by a cross-reference
}
limit 100
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?annot")
  v3("?cl"):::projected 
  v5("?cl_name"):::projected 
  v2("?comment"):::projected 
  v8("?target_ac"):::projected 
  v6("?target_class"):::projected 
  v7("?target_name"):::projected 
  v9("?target_name_truncated")
  v1("?xref")
  f0[["bound(?xref)"]]
  f0 --> v1
  f1[["bound(?comment)"]]
  f1 --> v2
  v3 --"cello:hasMoAbTarget"-->  v4
  v3 --"cello:recommendedName"-->  v5
  v4 --"a"-->  v6
  v4 --"rdfs:label"-->  v7
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."rdfs:comment".->  v2
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v4 -."cello:isIdentifiedByXref".->  v1
    v1 --"cello:accession"-->  v8
  end
  bind2[/"substring(?target_name,'0^^xsd:integer','30^^xsd:integer')"/]
  v7 --o bind2
  bind2 --as--o v9