@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_00268 a sh:SPARQLExecutable, sh:SPARQLSelectExecutable ;
  sh:prefixes _:sparql_examples_prefixes ;
  rdfs:comment '''Large regions of PE1 proteins that have no associated peptide, and their positional annotations'''@en ;
  schema:keywords "protein existence", "proteomics", "region", "snorql-only" ;
  schema:target <https://sparql.nextprot.org/sparql> ;
  sh:select '''PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select distinct ?entry (str(?gen) AS ?gene) ?spos ?annot_type (str(?txt) AS ?txt1) where {
?entry :isoform ?iso .
  ?entry :gene / :name / rdfs:label ?gen .
  ?iso :swissprotDisplayed true .
  ?iso :positionalAnnotation ?statement .
  ?statement a ?annot_type .
  filter not exists {?statement a :Variant }
  filter not exists {?statement a :SrmPeptideMapping }
  filter not exists {?statement a :SequenceConflict }
  optional {?statement rdfs:comment ?txt .}
  ?statement :start ?spos; :end ?epos .
  filter(?spos > ?len/2) # or filter(?spos < ?len/2) no nter
  ?iso :peptideMapping ?pm .
  ?pm :proteotypic true .
  ?pm  :peptideName ?pep.
 ?iso :sequence / :length ?len.
  filter(?len > 250)
 filter not exists {?iso :peptideMapping ?pm2.
                    ?pm2 :start ?pos21 .
                     filter(?pos21 > ?len/2) # no cter pep, or filter(?pos21 < ?len/2) no nter
                    }
  } group by ?entry ?gen ?spos ?annot_type ?txt having(count(distinct ?pep) > 6)
order by ?entry ?spos''' .
