@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix ex: <https://sparql.uniprot.org/.well-known/sparql-examples/> .
@prefix idr: <https://idr.openmicroscopy.org/> .
@prefix kv: <http://www.openmicroscopy.org/ns/default/> .
@prefix obda: <https://w3id.org/obda/vocabulary#> .
@prefix omecore: <https://ld.openmicroscopy.org/core/> .
@prefix omekg: <https://ld.openmicroscopy.org/omekg#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix spex: <https://purl.expasy.org/sparql-examples/ontology#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .


ex:002 a sh:SPARQLExecutable, sh:SPARQLSelectExecutable ;
    rdfs:comment "Federated query connecting to Uniprot proteins via Gene Identifier key-value annotation."^^rdf:HTML ;
    sh:prefixes _:sparql_example_prefixes ;
    schema:keywords "key-value annotations, uniprot, federated query, proteins" ;
    schema:target <http://idr-sparql.uni-muenster.de/qlever/sparql> ;
    spex:federatesWith <https://qlever.dev/api/uniprot> ;
    sh:select """
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    PREFIX dcterms: <http://purl.org/dc/terms/>
    PREFIX dc: <http://purl.org/dc/elements/1.1/>
    PREFIX omecore: <https://ld.openmicroscopy.org/core/>
    PREFIX omekg: <https://ld.openmicroscopy.org/omekg#>
    PREFIX obda: <https://w3id.org/obda/vocabulary#>
    PREFIX xml: <http://www.w3.org/XML/1998/namespace/>
    PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
    PREFIX kv: <http://www.openmicroscopy.org/ns/default/>
    PREFIX idr: <https://idr.openmicroscopy.org/>
    PREFIX up: <http://purl.uniprot.org/core/>
    PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
    prefix bgee: <http://purl.uniprot.org/bgee/>

    select distinct ?img ?bgee ?up_protein where {
      <https://idr.openmicroscopy.org/Project/52>
      dcterms:hasPart/dcterms:hasPart ?img .
      ?img a omecore:Image ;
           omecore:hasAnnotation/omecore:mapEntry [omecore:key ?key; omecore:value ?value] .
      filter(?key = "Gene Identifier")
      bind(iri(concat(str(bgee:),?value)) as ?bgee) .

      SERVICE <https://qlever.dev/api/uniprot> {
        ?up_protein a up:Protein ;
                    up:reviewed true ;
                    rdfs:seeAlso ?bgee .
        }
    }
""" .
