@prefix dcterms: <http://purl.org/dc/terms/> .
@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:51_Select_all_reactions_that_have_parents_and_children_reactions a sh:SPARQLExecutable,
    sh:SPARQLSelectExecutable;
  rdfs:comment "Select all reactions that have parents and children reactions"@en ;
  sh:select """PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>

SELECT
  (count(distinct ?reaction) as ?reactionCount)
WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .

  ?childReaction rdfs:subClassOf rh:Reaction .
  ?childReaction rh:status rh:Approved .

  ?parentReaction rdfs:subClassOf rh:Reaction .
  ?parentReaction rh:status rh:Approved .

  ?reaction rdfs:subClassOf ?parentReaction .
  ?reaction ^rdfs:subClassOf ?childReaction .
}
""";
  schema:target <https://sparql.rhea-db.org/sparql> .
