@prefix ex:<https://purl.expasy.org/sparql-examples/neXtProt/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ex:NXQ_00248 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Variants with phenotype annotation that map to a 3D structure"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX : <http://nextprot.org/rdf/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?entry (str(?pfname) as ?phenovar) (concat(str(sample(?pdbac)),"...") as ?pdbsample) WHERE {
 ?entry :gene / :name / rdfs:label ?gen .
 ?entry :isoform ?iso.
 ?iso :proteoform ?pf .
 ?pf rdfs:label ?pfname .
 ?pf :phenotypicVariation ?pv1 .
 ?pf :difference ?pfmod .
 ?pfmod a :Variant .
 ?pfmod :start ?vstart; :end ?vend .
 ?iso :pdbMapping ?pdbmap.
 ?pdbmap rdfs:comment ?pdbac.
 ?pdbmap :start ?pdbstart ; :end ?pdbend.
 filter(?pdbstart <= ?vstart && ?pdbend >= ?vend )
} group by ?entry ?pfname""" ;
    schema:keywords "3D structure",
        "phenotype",
        "tutorial",
        "variant" ;
    schema:target <https://sparql.nextprot.org/sparql> .

