lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

View the Project on GitHub lotusnprod/lotus-sparql-examples

wd_nps_match_masses

rq turtle/ttl

Compounds corresponding to mass ± 10ppm found in taxa.

Use at


PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#title: Compounds corresponding to mass ± 10ppm found in taxa.
SELECT DISTINCT ?compound ?mf ?inchi (GROUP_CONCAT(?taxon_name; SEPARATOR = ", ") AS ?taxon) WHERE {
    VALUES ?query {
        "524.1765"^^xsd:decimal
    }
    VALUES ?ppm {
        "10"^^xsd:decimal
    }
    ?compound wdt:P2067 ?mass.
    FILTER((?mass > (?query - ((?ppm * "0.000001"^^xsd:decimal) * ?query))) && (?mass < (?query + ((?ppm * "0.000001"^^xsd:decimal) * ?query))))
    ?compound (wdt:P703/wdt:P225) ?taxon_name;
    wdt:P234 ?inchi;
    wdt:P274 ?mf.
}
GROUP BY ?compound ?mf ?inchi
LIMIT 10000

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?compound"):::projected 
  v6("?inchi"):::projected 
  v1("?mass")
  v7("?mf"):::projected 
  v4("?ppm")
  v4("?query")
  v8("?taxon")
  v5("?taxon_name"):::projected 
  a1((" "))
  f0[["?mass > ?query - ?ppm * '0.000001^^xsd:decimal' * ?query?mass < ?query + ?ppm * '0.000001^^xsd:decimal' * ?query"]]
  f0 --> v1
  f0 --> v4
  f0 --> v4
  bind1[/VALUES ?query/]
  bind1-->v4
  bind10(["524.1765^^xsd:decimal"])
  bind10 --> bind1
  bind2[/VALUES ?ppm/]
  bind2-->v4
  bind20(["10^^xsd:decimal"])
  bind20 --> bind2
  v4 --"wdt:P2067"-->  v1
  v4 --"wdt:P703"-->  a1
  a1 --"wdt:P225"-->  v5
  v4 --"wdt:P234"-->  v6
  v4 --"wdt:P274"-->  v7
  bind4[/"?taxon_name"/]
  v5 --o bind4
  bind4 --as--o v8