sparql-examples

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

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

3

For a given (list of) lipid Species identifiers (e.g. SWISSLIPID:000056493, Phosphatidylcholine (32:0)), return a list of the corresponding Molecular subspecies (if any), Structural subspecies (if any), and Isomeric subspecies (if any) which are associated with at least one citation (PMID: PubMed id). The query should return the lipid identifiers (?id), recommended names (?name), and PMIDs (?citation). Future versions of this query should be generic enough to work from any start point (Species, Molecular subspecies, Structural subspecies).

Use at

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

# Example 3
SELECT ?startId ?startLabel ?rank ?id ?name ?citation
WHERE
{
  # Queried lipid species
  VALUES ?startId { SWISSLIPID:000056493 }
  ?startId rdfs:label ?startLabel .
 
  ?id rdfs:subClassOf+ ?startId .  
  VALUES ?rank { SWISSLIPID:Isomeric_Subspecies SWISSLIPID:Molecular_Subspecies SWISSLIPID:Structural_Subspecies}
  ?id SWISSLIPID:rank ?rank ;
	  rdfs:label ?name ;
      SWISSLIPID:citation ?citation .
      
} 
ORDER BY ?startId ?id DESC(?rank)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?citation"):::projected 
  v2("?id"):::projected 
  v5("?name"):::projected 
  v5("?rank"):::projected 
  v4("?startId"):::projected 
  v4("?startLabel"):::projected 
  bind0[/VALUES ?startId/]
  bind0-->v4
  bind00(["SWISSLIPID:000056493"])
  bind00 --> bind0
  v4 --"rdfs:label"-->  v4
  v2 --"rdfs:subClassOf"-->  v4
  bind1[/VALUES ?rank/]
  bind1-->v5
  bind10(["SWISSLIPID:Isomeric_Subspecies"])
  bind10 --> bind1
  bind11(["SWISSLIPID:Molecular_Subspecies"])
  bind11 --> bind1
  bind12(["SWISSLIPID:Structural_Subspecies"])
  bind12 --> bind1
  v2 --"SWISSLIPID:rank"-->  v5
  v2 --"rdfs:label"-->  v5
  v2 --"SWISSLIPID:citation"-->  v6