A set of SPARQL examples that are used in different SIB resources
Some senescence comments about cell lines with their source
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 ?source_type ?source ?shortened_comment
where {
?cl cello:hasSenescenceComment ?annot.
?cl cello:recommendedName ?cl_name .
?annot rdfs:comment ?comment .
optional {
?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)
bind(
if(
strlen(?comment) > 140,
concat( substr(?comment, 0, 140), "..."),
?comment)
as ?shortened_comment)
}
order by ?cl ?source
limit 100
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?annot")
v1("?cl"):::projected
v4("?cl_name"):::projected
v5("?comment")
v8("?id")
v10("?lb")
v9("?org")
v6("?s")
v12("?shortened_comment"):::projected
v11("?source"):::projected
v11("?source_type"):::projected
v7("?st")
a1((" "))
a2((" "))
a3((" "))
v1 --"cello:hasSenescenceComment"--> v3
v1 --"cello:recommendedName"--> v4
v3 --"rdfs:comment"--> v5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."cello:hasSource".-> v6
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -."cello:originatesFrom".-> a1
a1 --"a"--> v7
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v6 -."cello:originatesFrom".-> a2
a2 --"cello:internalId"--> v8
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v6 -."cello:originatesFrom".-> a3
a3 --"skos:prefLabel"--> v9
end
subgraph optional4["(optional)"]
style optional4 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 v11
bind2[/"if(string-length(?comment) > '140^^xsd:integer',concat(substring(?comment,'0^^xsd:integer','140^^xsd:integer'),'...'),?comment)"/]
v5 --o bind2
bind2 --as--o v12