sparql-examples

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

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

7

Show the reaction equation for the tartrate/succinate antiporter (rhea:34763). NB: there are two generic compartments here.)

Use at

PREFIX mnx: <https://rdf.metanetx.org/schema/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>

# Show the reaction equation for the tartrate/succinate
# antiporter (*rh:34763*). NB: there are two generic
# compartments here.

SELECT ?chem ?chem_name ?comp ?comp_name ?coef
FROM <https://rdf.metanetx.org/> WHERE{
    ?reac mnx:reacXref rh:34763 .
    ?reac ?side ?part .
    ?part mnx:chem ?chem ;
          mnx:comp ?comp ;
          mnx:coef ?c    .
    ?chem rdfs:comment ?chem_name .
    ?comp rdfs:comment ?comp_name .
    FILTER( ?side IN ( mnx:left , mnx:right ))
    BIND( IF( ?side = mnx:left, - ?c, ?c ) AS ?coef )
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?c")
  v4("?chem"):::projected 
  v7("?chem_name"):::projected 
  v9("?coef"):::projected 
  v5("?comp"):::projected 
  v8("?comp_name"):::projected 
  v3("?part")
  v2("?reac")
  v1("?side")
  c4(["rh:34763"]):::iri 
  list0c2(["mnx:right"]):::iri 
  list0c1(["mnx:left"]):::iri 
  list0c1 --o f0
  list0c2 --o f0
  f0[[" in "]]
  f0 --> v1
  v2 --"mnx:reacXref"-->  c4
  v2 -->v1--> v3
  v3 --"mnx:chem"-->  v4
  v3 --"mnx:comp"-->  v5
  v3 --"mnx:coef"-->  v6
  v4 --"rdfs:comment"-->  v7
  v5 --"rdfs:comment"-->  v8
  bind1[/"if(?side = 'mnx:left','-1^^xsd:integer' * ?c,?c)"/]
  v1 --o bind1
  v6 --o bind1
  bind1 --as--o v9