@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_09465 a sh:SPARQLExecutable, sh:SPARQLSelectExecutable ;
  sh:prefixes _:sparql_examples_prefixes ;
  rdfs:comment '''Check there are no entries with a ptm info annotation referring to phosphorylation that do not have the keyword Phosphoprotein (KW-0597)'''@en ;
  schema:keywords "QC", "keyword" ;
  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#>
PREFIX entry: <http://nextprot.org/rdf/entry/>

select distinct ?entry where {  # Include ?text if result is not 0 to identify problem site
  ?entry :isoform ?iso.
  ?iso :ptmInfo /rdfs:comment ?text.
  filter(contains(?text,"phosphorylat")). # Finds phosphorylated and phosphorylation
  filter not exists {?iso :ptmInfo /:negativeEvidence ?negev} # No negative annotations from neXtProt
  filter not exists {?entry :isoform /:keyword /:term cv:KW-0597.}
  filter (?entry not in (entry:NX_Q8WWR8, entry:NX_P0C0S5)) # Exceptions to rule (not phosphorylated)
}''' .
