sparql-examples

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

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

6

For a given lipid (SWISSLIPID:000399814, Ceramide), return a list of all corresponding reactions (Rhea IDs and equation), as well as their enzymes as annotated in UniProtKB/Swiss-Prot) enzymes themselves (ID and protein name). This query does not consider the hierarchy: it looks for reactions and enzymes only for the specified lipid.

Use at

PREFIX SWISSLIPID: <https://swisslipids.org/rdf/SLM_>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX up: <http://purl.uniprot.org/core/>

# Example 6
SELECT ?startId ?startName ?chebi ?rhea ?rheaEquation ?uniprot ?uniprotName
WHERE
{
  # SwissLipids query (list of) identifier(s)
  VALUES ?startId { SWISSLIPID:000399814 }
  # name
  ?startId rdfs:label ?startName .
  # ChEBI x-ref
  ?startId owl:equivalentClass ?chebi .
  # federated query to Rhea
  SERVICE <https://sparql.rhea-db.org/sparql> {
  	?rhea rh:equation ?rheaEquation .
  	?rhea rh:side/rh:contains/rh:compound/rh:chebi ?chebi .
  }    
  # federated query to UniProt
  SERVICE <https://sparql.uniprot.org/sparql> {
    ?uniprot up:reviewed true .
    ?uniprot up:recommendedName/up:fullName ?uniprotName .
    ?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea .
  }
} 
ORDER BY ?startId
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?chebi"):::projected 
  v4("?rhea"):::projected 
  v5("?rheaEquation"):::projected 
  v2("?startId"):::projected 
  v2("?startName"):::projected 
  v6("?uniprot"):::projected 
  v7("?uniprotName"):::projected 
  a1((" "))
  a2((" "))
  a3((" "))
  a4((" "))
  a5((" "))
  a6((" "))
  c11(["true^^xsd:boolean"]):::literal 
  bind0[/VALUES ?startId/]
  bind0-->v2
  bind00(["SWISSLIPID:000399814"])
  bind00 --> bind0
  v2 --"rdfs:label"-->  v2
  v2 --"owl:equivalentClass"-->  v3
  subgraph s1["https://sparql.rhea-db.org/sparql"]
    style s1 stroke-width:4px;
    v4 --"rh:equation"-->  v5
    v4 --"rh:side"-->  a1
    a1 --"rh:contains"-->  a2
    a2 --"rh:compound"-->  a3
    a3 --"rh:chebi"-->  v3
  end
  subgraph s2["https://sparql.uniprot.org/sparql"]
    style s2 stroke-width:4px;
    v6 --"up:reviewed"-->  c11
    v6 --"up:recommendedName"-->  a4
    a4 --"up:fullName"-->  v7
    v6 --"up:annotation"-->  a5
    a5 --"up:catalyticActivity"-->  a6
    a6 --"up:catalyzedReaction"-->  v4
  end