sparql-examples

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

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

4

For a given (list of) lipid classes (e.g. SWISSLIPID:000399814 (Ceramide) SWISSLIPID:000000007 (Sphingomyelin (iso-d17:1(4E))), return a list of the corresponding Isomeric subspecies. The query should return the lipid recommended names (?name) as well as identifiers (?id). Recapitulates the “browse lipid classes” function of the website (in batch).

Use at

PREFIX SWISSLIPID: <https://swisslipids.org/rdf/SLM_>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

# Example 4
SELECT ?startId ?startName ?id ?name
WHERE
{
  VALUES ?startId { SWISSLIPID:000399814 SWISSLIPID:000000567}
  ?startId SWISSLIPID:rank SWISSLIPID:Class .
  ?startId rdfs:label ?startName .
  ?id rdfs:subClassOf+ ?startId .
  ?id SWISSLIPID:rank SWISSLIPID:Isomeric_Subspecies ;
	  rdfs:label ?name .    
} 
ORDER BY ?startId
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?id"):::projected 
  v4("?name"):::projected 
  v2("?startId"):::projected 
  v2("?startName"):::projected 
  c2(["SWISSLIPID:Class"]):::iri 
  c5(["SWISSLIPID:Isomeric_Subspecies"]):::iri 
  bind0[/VALUES ?startId/]
  bind0-->v2
  bind00(["SWISSLIPID:000399814"])
  bind00 --> bind0
  bind01(["SWISSLIPID:000000567"])
  bind01 --> bind0
  v2 --"SWISSLIPID:rank"-->  c2
  v2 --"rdfs:label"-->  v2
  v3 --"rdfs:subClassOf"-->  v2
  v3 --"SWISSLIPID:rank"-->  c5
  v3 --"rdfs:label"-->  v4