sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

131_Where_are_the_human_genes_encoding_enzymes_metabolizing_cholesterol_expressed

rq turtle/ttl

Where are the human genes encoding enzymes metabolizing cholesterol expressed?

Use at


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 .
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?a")
  v11("?anatomicEntity"):::projected 
  v12("?anatomicEntityLabel"):::projected 
  v8("?ca")
  v5("?compound")
  v9("?ensemblGene"):::projected 
  v10("?gene")
  v4("?participant")
  v6("?protein"):::projected 
  v1("?reaction"):::projected 
  v2("?reactionEquation")
  v3("?reactionSide")
  a1((" "))
  c4(["rh:Approved"]):::iri 
  c13(["taxon:9606"]):::iri 
  c10(["CHEBI:16113"]):::iri 
  c2(["rh:Reaction"]):::iri 
  c16(["up:Catalytic_Activity_Annotation"]):::iri 
  v1 --"rdfs:subClassOf"-->  c2
  v1 --"rh:status"-->  c4
  v1 --"rh:equation"-->  v2
  v1 --"rh:side"-->  v3
  v3 --"rh:contains"-->  v4
  v4 --"rh:compound"-->  v5
  v5 --"rh:chebi"-->  c10
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v6 --"up:organism"-->  c13
    v6 --"up:annotation"-->  v7
    v7 --"a"-->  c16
    v7 --"up:catalyticActivity"-->  v8
    v8 --"up:catalyzedReaction"-->  v1
    v6 --"rdfs:seeAlso"-->  a1
    a1 --"up:transcribedFrom"-->  v9
  end
  subgraph s2["https://www.bgee.org/sparql"]
    style s2 stroke-width:4px;
    v10 --"genex:isExpressedIn"-->  v11
    v10 --"lscr:xrefEnsemblGene"-->  v9
    v11 --"rdfs:label"-->  v12
  end