@prefix ex: <https://sparql.uniprot.org/.well-known/sparql-examples/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema: <https://schema.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .

ex:87_taxonomy_with_at_least_one_swissprot a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Find taxon records for which one reviewed UniProtKB/Swiss-Prot entry exists. We might expect species, strains, subspecies and isolates in the taxon list."^^rdf:HTML ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>


SELECT
    DISTINCT
         ?taxid
         ?scientificName
         ?domain
         ?domainName
WHERE {
  ?uniprot a up:Protein .
  # reviewed entries
  ?uniprot up:reviewed true .
  ?uniprot up:organism ?taxid . 
  ?taxid up:scientificName ?scientificName .
    
  VALUES ?domain { taxon:2 # bacteria
                   taxon:2157 # archaea
                   taxon:2759 # eukaryota
                   taxon:10239 #viruses
                 } .
  ?taxid rdfs:subClassOf ?domain .
}""" ;
    schema:keywords "taxonomy" , "entry status" , "list" ;
    schema:target <https://sparql.uniprot.org/sparql/> .

