sparql-examples

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

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

38

Returns the list of isomeric subspecies that contain the same fatty acid component(s) at the same position(s) as a user-defined lipid, but limits the output to published lipids linked to a PMID. Output should include the corresponding SwissLipids ID(s) and name(s) and the PMID(s) for each. Extends ex:36 Output should include the corresponding SwissLipids ID(s) and name(s).

Use at

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

# Example 38
SELECT ?startId ?startName ?tail1 ?tailName1 ?tail2 ?tailName2 ?id ?name ?pubmed
WHERE {
  VALUES ?startId { SWISSLIPID:000121946 }
  ?startId rdfs:label ?startName .
  # tail components
  ?startId SWISSLIPID:haspart ?tail1 .
  ?startId SWISSLIPID:haspart ?tail2 .
  FILTER(!sameTerm(?tail1, ?tail2))
  ?tail1 rdfs:label ?tailName1 .
  ?tail2 rdfs:label ?tailName2 .

  # Retrieve lipids with similar tails
  ?id SWISSLIPID:haspart ?tail1 , 
                  ?tail2 .
  
  # Restrict to isomeric subspecies with PubMed citation(s)
  ?id SWISSLIPID:rank SWISSLIPID:Isomeric_Subspecies .
  ?id SWISSLIPID:citation ?pubmed .

  # Retrieve name
  ?id rdfs:label ?name .
}
ORDER BY ?id ?tail1 ?tail2
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?id"):::projected 
  v9("?name"):::projected 
  v8("?pubmed"):::projected 
  v4("?startId"):::projected 
  v5("?startName"):::projected 
  v2("?tail1"):::projected 
  v3("?tail2"):::projected 
  v6("?tailName1"):::projected 
  v7("?tailName2"):::projected 
  c4(["SWISSLIPID:Isomeric_Subspecies"]):::iri 
  f0[["not sameterm(?tail1,?tail2)"]]
  f0 --> v2
  f0 --> v3
  bind1[/VALUES ?startId/]
  bind1-->v4
  bind10(["SWISSLIPID:000121946"])
  bind10 --> bind1
  v4 --"rdfs:label"-->  v5
  v4 --"SWISSLIPID:haspart"-->  v2
  v4 --"SWISSLIPID:haspart"-->  v3
  v2 --"rdfs:label"-->  v6
  v3 --"rdfs:label"-->  v7
  v1 --"SWISSLIPID:haspart"-->  v2
  v1 --"SWISSLIPID:haspart"-->  v3
  v1 --"SWISSLIPID:rank"-->  c4
  v1 --"SWISSLIPID:citation"-->  v8
  v1 --"rdfs:label"-->  v9