@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:55 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Number of proteins with binding sites for metals or metal sulfur clusters (and experimental evidence for the binding)"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT
  ?ligand
  ?ligandName 
  (COUNT(DISTINCT ?protein) as ?entries)
WHERE {
   ?protein up:annotation ?annotation .
   
   VALUES ?evs { obo:ECO_0000269 obo:ECO_0007744 } .
   VALUES ?chebids { CHEBI:25213 CHEBI:25214 } .
   ?st rdf:subject ?protein ; 
       rdf:predicate up:annotation ; 
       rdf:object ?annotation ;
       up:attribution/up:evidence ?evs .

   ?annotation up:ligand/rdfs:subClassOf ?ligand .
   ?ligand rdfs:subClassOf+ ?chebids ;
     rdfs:label ?ligandName .
}
GROUP BY ?ligand ?ligandName
ORDER BY DESC(?entries)""" ;
    schema:keywords "binding site" , "evidence tag" , "count" ;
    schema:target <https://sparql.uniprot.org/sparql/> .

