@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:131_Where_are_the_human_genes_encoding_enzymes_metabolizing_cholesterol_expressed
  a sh:SPARQLExecutable, sh:SPARQLSelectExecutable;
  rdfs:comment "Where are the human genes encoding enzymes metabolizing cholesterol expressed?"@en;
  sh:select """
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX CHEBI:<http://purl.obolibrary.org/obo/CHEBI_>
PREFIX up:<http://purl.uniprot.org/core/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
PREFIX genex: <http://purl.org/genex#>
PREFIX lscr: <http://purl.org/lscr#>

SELECT
  distinct
    ?protein
    ?ensemblGene
    ?reaction
    ?anatomicEntityLabel
    ?anatomicEntity
WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
      ?reaction rh:status rh:Approved .
      ?reaction rh:equation ?reactionEquation .
      ?reaction rh:side ?reactionSide .
      ?reactionSide rh:contains ?participant .
      ?participant rh:compound ?compound .
      # compound constraint (CHEBI:16113 == cholesterol)
      ?compound rh:chebi CHEBI:16113 .
  SERVICE <https://sparql.uniprot.org/sparql> {
    # taxonomy constraint (taxon:9606 == Homo sapiens)
    ?protein up:organism taxon:9606 .
    ?protein up:annotation ?a .
    ?a a up:Catalytic_Activity_Annotation .
    ?a up:catalyticActivity ?ca .
    ?ca up:catalyzedReaction ?reaction .
    ?protein rdfs:seeAlso / up:transcribedFrom ?ensemblGene .
  }
  # federated query to Bgee (expression data)
  SERVICE <https://www.bgee.org/sparql/> {
    ?gene genex:isExpressedIn ?anatomicEntity .
    ?gene lscr:xrefEnsemblGene ?ensemblGene .
    ?anatomicEntity rdfs:label ?anatomicEntityLabel .
  }
}""";
  <https://purl.expasy.org/sparql-examples/ontology#federatesWith>
    <https://www.bgee.org/sparql/> ,
    <https://sparql.uniprot.org/sparql> ;
  schema:target <https://sparql.rhea-db.org/sparql> .
