sparql-examples

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

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

16

Select all Rhea reactions that have a pair of ChEBI IDs as reaction participant and in opposite side

Use at

PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX up: <http://purl.uniprot.org/core/>

# Query 16
# Select all Rhea reactions that have a pair of ChEBI IDs as reaction participant and in opposite side
# Return Rhea reactions that have CHEBI:29985 (L-glutamate) as reaction participant in one side
# and CHEBI:58359 (L-glutamine) in the other side
#
# This query cannot be expressed in the Rhea website
SELECT ?chebi1 ?name1 ?chebi2 ?name2 ?rhea ?equation
WHERE {
  VALUES (?chebi1) { (CHEBI:29985) }
  ?chebi1 up:name ?name1 .
  ?rhea rh:side ?reactionSide1 .
  ?reactionSide1  rh:contains / rh:compound / rh:chebi ?chebi1 .

  VALUES (?chebi2) { (CHEBI:58359) }
  ?chebi2 up:name ?name2 .

  ?rhea rh:side ?reactionSide2 .
  ?reactionSide2  rh:contains / rh:compound / rh:chebi ?chebi2 .
  
  ?reactionSide1 rh:transformableTo ?reactionSide2 .
  
  ?rhea rh:equation ?equation .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?chebi1"):::projected 
  v5("?chebi2"):::projected 
  v8("?equation"):::projected 
  v2("?name1"):::projected 
  v6("?name2"):::projected 
  v4("?reactionSide1")
  v7("?reactionSide2")
  v3("?rhea"):::projected 
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  bind0[/VALUES ?chebi1/]
  bind0-->v1
  bind00(["CHEBI:29985"])
  bind00 --> bind0
  v1 --"up:name"-->  v2
  v3 --"rh:side"-->  v4
  v4 --"rh:contains"-->  a1
  a1 --"rh:compound"-->  a2
  a2 --"rh:chebi"-->  v1
  bind1[/VALUES ?chebi2/]
  bind1-->v5
  bind10(["CHEBI:58359"])
  bind10 --> bind1
  v5 --"up:name"-->  v6
  v3 --"rh:side"-->  v7
  v7 --"rh:contains"-->  a3
  a3 --"rh:compound"-->  a4
  a4 --"rh:chebi"-->  v5
  v4 --"rh:transformableTo"-->  v7
  v3 --"rh:equation"-->  v8