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

ex:65_distinct_extinct_organisms_in_uniprotkb a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "How many distinct extinct organisms are represented in UniProtKB"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX keywords: <http://purl.uniprot.org/keywords/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT 
  ?taxon
  (SAMPLE(?name) AS ?anName)
  (COUNT(DISTINCT ?protein) AS ?entriesPerExtinctTaxon)
WHERE
{
  GRAPH<http://sparql.uniprot.org/taxonomy>{
    ?taxon a up:Taxon ;
           up:scientificName ?name .
  }
  ?protein up:organism ?taxon ;
           up:classifiedWith keywords:952 .
} GROUP BY ?taxon ORDER BY ?taxon""" ;
    schema:keywords "taxonomy" , "keyword" , "count" ;
    schema:target <https://sparql.uniprot.org/sparql/> .

