@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_DEREF_003 a sh:SPARQLExecutable, sh:SPARQLSelectExecutable ;
  sh:prefixes _:sparql_examples_prefixes ;
  rdfs:comment '''Query for an Entry Instance e.g entry:NX_Q8WZ42'''@en ;
  schema:keywords "deref_instance_entry" ;
  schema:target <https://sparql.nextprot.org/sparql> ;
  sh:select '''PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX entry: <http://nextprot.org/rdf/entry/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

CONSTRUCT {
    ?INSTANCE rdf:type ?type.
    ?INSTANCE :gene ?gene.
    ?INSTANCE :existence ?existence.
    ?INSTANCE :swissprotPage ?swissprotPage.
    ?INSTANCE skos:exactMatch ?skos.
    ?INSTANCE :isoformCount ?isoformCount.
    ?INSTANCE :isoform ?isoform.
    ?INSTANCE :classifiedWith ?classifiedWith.
    ?INSTANCE :recommendedName [rdfs:label ?recommendedName ;].
}
WHERE {
        ?INSTANCE rdf:type ?type.
        ?INSTANCE :gene ?gene.
        ?INSTANCE :existence ?existence.
        ?INSTANCE :swissprotPage ?swissprotPage.
        ?INSTANCE skos:exactMatch ?skos.
        ?INSTANCE :isoformCount ?isoformCount.
        {
           ?INSTANCE :isoform ?isoform.
            ?isoform :canonicalIsoform "true"^^xsd:boolean.
        } union {
            ?INSTANCE :classifiedWith ?classifiedWith.
        } union {
            ?INSTANCE :recommendedName / rdfs:label ?recommendedName.
        }
}''' .
