sparql-examples

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

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

5

rq turtle/ttl

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.

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/>

# 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
https://sparql.rhea-db.org/sparql
rdfs:label
rdfs:subClassOf
rdfs:label
owl:equivalentClass
rh:equation
rh:side
rh:contains
rh:compound
rh:chebi
?rheaEquation
?rhea
?chebi
?id
?name
?startName
VALUES ?startId
SWISSLIPID:000399814