@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_09651 a sh:SPARQLExecutable, sh:SPARQLSelectExecutable ;
  sh:prefixes _:sparql_examples_prefixes ;
  rdfs:comment '''Check there are no entries with non-compliant glycosylation sites from UniProt'''@en ;
  schema:keywords "QC", "glycosylation", "PTM" ;
  schema:target <https://sparql.nextprot.org/sparql> ;
  sh:select '''PREFIX : <http://nextprot.org/rdf/>
PREFIX cv: <http://nextprot.org/rdf/terminology/>
PREFIX source: <http://nextprot.org/rdf/source/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

select distinct ?entry where { # Add  ?glypos ?qual to idenfiy glycosylation site and quality
?entry :isoform ?iso.
?iso :swissprotDisplayed true ; :glycosylationSite ?glycosite.
?glycosite :start ?glypos; rdfs:comment ?desc; :quality ?qual .
filter(contains(?desc,"N-linked"))
?glycosite :evidence / :assignedBy source:Uniprot.
{
values ?forbiddom
{ cv:DO-00843 cv:DO-00082 cv:DO-00096 cv:DO-00098 cv:DO-00099 cv:DO-00100 cv:DO-00127 cv:DO-00135 cv:DO-00162 cv:DO-00212 cv:DO-00218 cv:DO-00224 cv:DO-00234 cv:DO-00847 cv:DO-00280 cv:DO-00282 cv:DO-00302 cv:DO-00310 cv:DO-00341 cv:DO-00343 cv:DO-00349 cv:DO-00350 cv:DO-00354 cv:DO-00376 cv:DO-00378 cv:DO-00404 cv:DO-00416 cv:DO-00418 cv:DO-00421 cv:DO-00415 cv:DO-00430 cv:DO-00462 cv:DO-00466 cv:DO-00467 cv:DO-00469 cv:DO-00477 cv:DO-00869 cv:DO-00555 cv:DO-00592 cv:DO-00602 cv:DO-00604 cv:DO-00779 cv:DO-00918 cv:DO-00943 cv:DO-00632 cv:DO-00636 cv:DO-00671 cv:DO-00691 cv:DO-00695 cv:DO-00700 cv:DO-00832 cv:DO-00741 cv:DO-00078 cv:DO-00057 cv:DO-00104 cv:DO-00144 cv:DO-00244 cv:DO-00273 cv:DO-00284 cv:DO-00387 cv:DO-00451 cv:DO-00561 cv:DO-00650 cv:DO-00658 cv:DO-00692 cv:DO-00697 cv:DO-00707 }


?iso :domain ?dom .
?dom :term ?forbiddom; :start ?forbidstart; :end ?forbidend .
}
union
{
values ?forbidtopodom
{ cv:CVTO_0001 cv:CVTO_0004 cv:CVTO_0013 cv:CVTO_0015 cv:CVTO_0022 }

?iso :topology ?top .
?top :term ?forbidtopodom; :start ?forbidstart; :end ?forbidend .
}
union
{ ?iso :signalPeptide ?sigpep . ?sigpep :start ?forbidstart; :end ?forbidend . }

union
{ ?iso :mitochondrialTransitPeptide ?trpep . ?trpep :start ?forbidstart; :end ?forbidend . }

filter((?glypos >= ?forbidstart) && (?glypos <= ?forbidend))
}''' .
