sparql-examples

A set of SPARQL examples for tutorials at SWAT4HCLS

View the Project on GitHub dnanad/sparql-examples

13

rq turtle/ttl

For a given list of ChEBI identifiers return the list of corresponding SwissLipids identifiers. Output should include SwissLipids identifier and name plus the HMDB identifier. This query considers only the cross references in the SwissLipids entry – it does not attempt to query other levels to find links between parents or children. Recapitulates one ID mapping function on the website.

Use at

PREFIX CHEBI: <http://purl.obolibrary.org/obo/CHEBI_>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

# Example 13
SELECT ?chebi ?slm ?slmName 
WHERE {
  VALUES ?chebi {CHEBI:70846 CHEBI:70771 CHEBI:70829}
  ?slm rdfs:label ?slmName . 
  # Corresponding SwissLipids entries
  ?slm owl:equivalentClass ?chebi .
}
ORDER BY ?chebi
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?chebi"):::projected 
  v2("?slm"):::projected 
  v3("?slmName"):::projected 
  bind0[/VALUES ?chebi/]
  bind0-->v2
  bind00(["CHEBI:70846"])
  bind00 --> bind0
  bind01(["CHEBI:70771"])
  bind01 --> bind0
  bind02(["CHEBI:70829"])
  bind02 --> bind0
  v2 --"rdfs:label"-->  v3
  v2 --"owl:equivalentClass"-->  v2