@prefix ex: <https://sparql.rhea-db.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#> .
@prefix spex: <https://purl.expasy.org/sparql-examples/ontology#> .

ex:27_Select_the_number_of_reactions_that_have_Xrefs a sh:SPARQLExecutable,
        sh:SPARQLSelectExecutable ;
    rdfs:comment "Select the number of reactions that have cross-references"@en ;
    sh:prefixes _:sparql_examples_prefixes ;
    sh:select """PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT (count(distinct ?reaction) as ?distinctReactionCount) WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:directionalReaction ?directionalReaction .
  ?reaction rh:bidirectionalReaction ?bidirectionalReaction .
  OPTIONAL { ?directionalReaction rdfs:seeAlso ?xref . }
  OPTIONAL { ?bidirectionalReaction rdfs:seeAlso ?xref . }
  FILTER (BOUND(?xref))
}
""" ;
    schema:target <https://sparql.rhea-db.org/sparql/> .
