@prefix ex: <https://sparql.uniprot.org/.well-known/sparql-examples/> .
@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#> .

ex:38 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "For the human entry P05067 (Amyloid-beta precursor protein) find the gene start ends in WikiData"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>


SELECT 
	?protein 
	?begin
	?end
	?chromosome
	?assembly
WHERE {
    {
        BIND(uniprotkb:P05067 AS ?proteinIRI)
        BIND (SUBSTR(STR(?proteinIRI), STRLEN(STR(uniprotkb:))+1) AS ?protein)
    }
    SERVICE <https://query.wikidata.org/sparql> {
        ?wp wdt:P352 ?protein ;
            wdt:P702 ?wg . 
        ?wg p:P644   ?wgss .
        ?wgss ps:P644        ?begin ;
          pq:P1057/wdt:P1813 ?chromosome ;
          pq:P659/rdfs:label ?assembly .
        ?wg p:P645 ?wgse .
        ?wgse ps:P645        ?end ;
          pq:P1057/wdt:P1813 ?chromosome ;
          pq:P659/rdfs:label ?assembly .
        FILTER(lang(?assembly) = "en")
  } 
}""" ;
    schema:keywords "chromosome location" , "gene" , "Wikidata" , "federated query" ;
    schema:target <https://sparql.uniprot.org/sparql/> ;
    spex:federatesWith <https://query.wikidata.org/sparql> .

