A set of SPARQL examples that are used in different SIB resources
For a given lipid (SWISSLIPID:000399814, Ceramide), return a list of all corresponding reactions (Rhea IDs and equation). This query does consider the hierarchy: it looks for reactions involving the specified lipid and/or its more specific forms.
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/>
# Example 5
SELECT ?startId ?startName ?id ?name ?chebi ?rhea ?rheaEquation
WHERE
{
# SwissLipids query (list of) identifier(s)
VALUES ?startId { SWISSLIPID:000399814 }
# name
?startId rdfs:label ?startName .
# Retrieve children lipids
?id rdfs:subClassOf* ?startId .
?id rdfs:label ?name .
# ChEBI x-ref
?id 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 .
}
}
ORDER BY ?startId ?id
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?chebi"):::projected
v2("?id"):::projected
v4("?name"):::projected
v6("?rhea"):::projected
v7("?rheaEquation"):::projected
v3("?startId"):::projected
v3("?startName"):::projected
a1((" "))
a2((" "))
a3((" "))
bind0[/VALUES ?startId/]
bind0-->v3
bind00(["SWISSLIPID:000399814"])
bind00 --> bind0
v3 --"rdfs:label"--> v3
v2 --"rdfs:subClassOf"--> v3
v2 --"rdfs:label"--> v4
v2 --"owl:equivalentClass"--> v5
subgraph s1["https://sparql.rhea-db.org/sparql"]
style s1 stroke-width:4px;
v6 --"rh:equation"--> v7
v6 --"rh:side"--> a1
a1 --"rh:contains"--> a2
a2 --"rh:compound"--> a3
a3 --"rh:chebi"--> v5
end