@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#> .

ex:10 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Select all human UniProtKB entries with a sequence variant that leads to a tyrosine to phenylalanine substitution"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX faldo: <http://biohackathon.org/resource/faldo#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT ?protein ?annotation ?begin ?text
WHERE
{
        ?protein a up:Protein ;
            up:organism taxon:9606 ; 
            up:annotation ?annotation .
        ?annotation a up:Natural_Variant_Annotation ;
            rdfs:comment ?text ;
            up:substitution ?substitution ;
            up:range/faldo:begin
                [ faldo:position ?begin ;
                  faldo:reference ?sequence ] .
        ?sequence rdf:value ?value .
        BIND (substr(?value, ?begin, 1) as ?original) .
        FILTER(?original = 'Y' && ?substitution = 'F') .
}""" ;
    schema:keywords "variant annotation" , "search within sequence" ;
    schema:target <https://sparql.uniprot.org/sparql/> .

