Koetai SPARQL examples

Community-curated SPARQL example queries for multiple life-science endpoints.

View the Project on GitHub Koetai/sparql-examples

bgee_gene_idr_microscopy_images

rq turtle/ttl

Bgee-driven federation: for given UniProt-identified genes, fetch renderable IDR image URLs via SERVICE to the IDR endpoint.

Use at

PREFIX orth:  <http://purl.org/net/orth#>
PREFIX lscr:  <http://purl.org/lscr#>
PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ome:   <https://ld.openmicroscopy.org/core/>
PREFIX omekg: <https://ld.openmicroscopy.org/omekg#>
SELECT ?geneName ?acc ?thumbnail ?page WHERE {
  VALUES ?protein {
    <http://purl.uniprot.org/uniprot/P02545>   # LMNA
    <http://purl.uniprot.org/uniprot/P27797>   # CALR
  }
  ?gene a orth:Gene ; lscr:xrefUniprot ?protein ; rdfs:label ?geneName .
  BIND(STRAFTER(STR(?protein), "http://purl.uniprot.org/uniprot/") AS ?acc)
  SERVICE <http://idr-sparql.uni-muenster.de/qlever/sparql/> {
    ?e ome:key "UniProt ID" ; ome:value ?acc .
    ?ann ome:mapEntry ?e .
    ?img ome:hasAnnotation ?ann ; omekg:ome_details ?page .
  }
  BIND(IRI(CONCAT("https://idr.openmicroscopy.org/webgateway/render_thumbnail/",
                  STRAFTER(STR(?img), "/Image/"), "/")) AS ?thumbnail)
}
LIMIT 25
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?acc"):::projected 
  v6("?ann")
  v5("?e")
  v2("?gene")
  v3("?geneName"):::projected 
  v7("?img")
  v8("?page"):::projected 
  v1("?protein")
  v9("?thumbnail"):::projected 
  c7(["UniProt ID"]):::literal 
  c2(["orth:Gene"]):::iri 
  bind0[/VALUES ?protein/]
  bind0-->v1
  bind00([http://purl.uniprot.org/uniprot/P02545])
  bind00 --> bind0
  bind01([http://purl.uniprot.org/uniprot/P27797])
  bind01 --> bind0
  v2 --"a"-->  c2
  v2 --"lscr:xrefUniprot"-->  v1
  v2 --"rdfs:label"-->  v3
  bind1[/"substring-after(str(?protein),'http://purl.uniprot.org/uniprot/')"/]
  v1 --o bind1
  bind1 --as--o v4
  subgraph s1["http://idr-sparql.uni-muenster.de/qlever/sparql/"]
    style s1 stroke-width:4px;
    v5 --https://ld.openmicroscopy.org/core/key-->  c7
    v5 --https://ld.openmicroscopy.org/core/value-->  v4
    v6 --https://ld.openmicroscopy.org/core/mapEntry-->  v5
    v7 --https://ld.openmicroscopy.org/core/hasAnnotation-->  v6
    v7 --https://ld.openmicroscopy.org/omekg#ome_details-->  v8
  end
  bind2[/"concat('https://idr.openmicroscopy.org/webgateway/render_thumbnail/',substring-after(str(?img),'/Image/'),'/')"/]
  v7 --o bind2
  bind2 --as--o v9