Community-curated SPARQL example queries for multiple life-science endpoints.
A federated query running on IDR (with SERVICE to RDF Portal/GlyCosmos) that finds IDR-imaged proteins which GlyCosmos records as glycoproteins, and for each returns the full-resolution IDR viewer URL (iviewer) of an image plus the URL of its containing IDR Screen, derived by walking the Image <- WellSample<- Well<- Plate<- Screen containment chain.
PREFIX ome: <https://ld.openmicroscopy.org/core/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX glycan: <http://purl.jp/bio/12/glyco/glycan#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?acc ?gpLabel ?fullImage ?aggregateUrl WHERE {
{ # RDF Portal (GlyCosmos): IDR proteins that are glycoproteins
SELECT DISTINCT ?acc ?gpLabel WHERE {
{ SELECT DISTINCT ?acc WHERE { ?e0 ome:key "UniProt ID" ; ome:value ?acc } }
BIND(IRI(CONCAT("http://glycosmos.org/glycoprotein/", ?acc)) AS ?gp)
SERVICE <https://rdfportal.org/primary/sparql> {
?gp a glycan:Glycoprotein ; rdfs:label ?gpLabel .
}
}
}
?e ome:key "UniProt ID" ; ome:value ?acc .
?ann ome:mapEntry ?e .
?image ome:hasAnnotation ?ann ; a ome:Image .
?ws dcterms:relation ?image . # Image ← WellSample
?well dcterms:hasPart ?ws . # WellSample ← Well
?plate dcterms:hasPart ?well . # Well ← Plate
?screen dcterms:relation ?plate ; a ome:Screen . # Plate ← Screen (the aggregate)
BIND(IRI(CONCAT("https://idr.openmicroscopy.org/iviewer/?images=",
STRAFTER(STR(?image), "/Image/"))) AS ?fullImage)
BIND(IRI(CONCAT("https://idr.openmicroscopy.org/webclient/?show=screen-",
STRAFTER(STR(?screen), "/Screen/"))) AS ?aggregateUrl)
}
LIMIT 25
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?acc"):::projected
v13("?aggregateUrl"):::projected
v6("?ann")
v5("?e")
v1("?e0")
v12("?fullImage"):::projected
v3("?gp")
v4("?gpLabel"):::projected
v7("?image")
v10("?plate")
v11("?screen")
v9("?well")
v8("?ws")
c10([https://ld.openmicroscopy.org/core/Image]):::iri
c6(["glycan:Glycoprotein"]):::iri
c2(["UniProt ID"]):::literal
c13([https://ld.openmicroscopy.org/core/Screen]):::iri
v1 --https://ld.openmicroscopy.org/core/key--> c2
v1 --https://ld.openmicroscopy.org/core/value--> v2
bind0[/"concat('http://glycosmos.org/glycoprotein/',?acc)"/]
v2 --o bind0
bind0 --as--o v3
subgraph s1["https://rdfportal.org/primary/sparql"]
style s1 stroke-width:4px;
v3 --"a"--> c6
v3 --"rdfs:label"--> v4
end
v5 --https://ld.openmicroscopy.org/core/key--> c2
v5 --https://ld.openmicroscopy.org/core/value--> v2
v6 --https://ld.openmicroscopy.org/core/mapEntry--> v5
v7 --https://ld.openmicroscopy.org/core/hasAnnotation--> v6
v7 --"a"--> c10
v8 --"dcterms:relation"--> v7
v9 --"dcterms:hasPart"--> v8
v10 --"dcterms:hasPart"--> v9
v11 --"dcterms:relation"--> v10
v11 --"a"--> c13
bind1[/"concat('https://idr.openmicroscopy.org/iviewer/?images=',substring-after(str(?image),'/Image/'))"/]
v7 --o bind1
bind1 --as--o v12
bind2[/"concat('https://idr.openmicroscopy.org/webclient/?show=screen-',substring-after(str(?screen),'/Screen/'))"/]
v11 --o bind2
bind2 --as--o v13