@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:81_rhea_reactions_annotated_as_experimental_and_only_small_molecules a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Find all Rhea (only small molecule) that are used in UniProtKB where the annotation has a paper and is tagged having experimental evidence."^^rdf:HTML ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX ECO: <http://purl.obolibrary.org/obo/ECO_>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX up: <http://purl.uniprot.org/core/>

SELECT
  ?rhea 
  ?catalyzedReaction 
  ?source
WHERE {
  {  
    SELECT 
      DISTINCT 
        ?rhea
      WHERE {
        GRAPh<https://sparql.rhea-db.org/rhea> {
          ?rhea rdfs:subClassOf rh:Reaction .
          ?rhea rh:side/rh:contains/rh:compound ?compound2 . 
          ?uc rdfs:subClassOf rh:Compound .
        }
        ?compound2 rdfs:subClassOf ?uc . 
    	BIND(IF(?uc = rh:SmallMolecule, 0, 1) AS ?c)  
     } GROUP BY ?rhea  HAVING (SUM(?c) = 0)
  }
  ?catalyzedReaction up:catalyzedReaction ?rhea .
  ?reif rdf:object ?catalyzedReaction ;
        up:attribution ?attr .
  ?attr up:evidence ECO:0000269 ;
        up:source ?source .
  ?source a up:Citation .
}""" ;
    schema:keywords "small molecule" , "Rhea" , "evidence tag"  ;
    schema:target <https://sparql.uniprot.org/sparql/> .

