@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_00112 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Proteins located in nucleus and nowhere else"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX : <http://nextprot.org/rdf/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select ?entry WHERE {
 {
 select ?entry (count(?loc) as ?anyLoc) (sum(?inNucleus) as ?nucleusLoc)
 WHERE {
 ?entry :isoform / :cellularComponent ?loc .
 ?loc :evidence / :negative false .
 ?loc :term ?locterm.
 bind( exists {
 ?locterm :childOf / rdfs:label ?label.
 filter (regex(?label, '^[Nn]ucleus$'))
 } as ?inNucleus)
 }
 group by ?entry
 }
 filter ( ?anyLoc = ?nucleusLoc)
}""" ;
    schema:keywords "subcellular location",
        "tutorial" ;
    schema:target <https://sparql.nextprot.org/sparql> .

