@prefix ex: <https://sparql.rhea-db.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:5 a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Select all Rhea reactions mapped to KEGG reactions"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>

# Query 5 
# Select all Rhea reactions mapped to KEGG reactions
# KEGG reactions are mapped to Rhea bidirectional reactions
# Rhea web query: https://www.rhea-db.org/rhea?query=kegg:*
#
SELECT ?rhea ?kegg ?rheaDir 
WHERE {
  ?rhea rdfs:subClassOf rh:Reaction .
  ?rhea rh:bidirectionalReaction ?rheaDir .
  ?rheaDir rdfs:seeAlso ?kegg .
  FILTER (regex(str(?kegg),'kegg'))
}""" ;
    schema:target <https://sparql.rhea-db.org/sparql> .

