A set of SPARQL examples that are used in LOTUS
Taxa containing at least n of the following compounds.
PREFIX hint: <http://www.bigdata.com/queryHints#>
PREFIX idsm: <https://idsm.elixir-czech.cz/sparql/endpoint/>
PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#title: Taxa containing at least n of the following compounds.
SELECT DISTINCT ?taxon ?taxon_name WHERE {
VALUES ?n {4}
{
SELECT ?taxon ?taxon_name (COUNT(DISTINCT ?compound) AS ?compoundCount) WHERE {
{
SELECT DISTINCT ?taxon ?taxon_name ?compound WHERE {
{
SELECT DISTINCT ?compound ?smiles WHERE {
SERVICE idsm:wikidata {
VALUES ?smiles {
"C=C[C@H]1[C@@H](OC=C2C1=CCOC2=O)O[C@H]3[C@@H]([C@H]([C@@H]([C@H](O3)CO)O)O)O"
"C=C[C@H]1[C@@H](OC=C2[C@]1(CCOC2=O)O)O[C@H]3[C@@H]([C@H]([C@@H]([C@H](O3)CO)O)O)O"
"C=C[C@@H]1[C@@H]2CCOC(=O)C2=CO[C@H]1O[C@H]3[C@@H]([C@H]([C@@H]([C@H](O3)CO)O)O)OC(=O)C4=C(C=C(C=C4O)O)O"
"COC1=CC(=C2C(=C1)OC3=C(C=CC(=C3C2=O)O[C@H]4[C@@H]([C@H]([C@@H]([C@H](O4)CO)O)O)O)O)O"
}
?compound sachem:similarCompoundSearch [
sachem:query ?smiles;
sachem:cutoff "1.0"^^xsd:double
].
}
}
} hint:Prior hint:runFirst "true".
?compound wdt:P703 ?child.
?child (wdt:P171*) ?taxon.
?taxon wdt:P225 ?taxon_name.
}
}
}
GROUP BY ?taxon ?taxon_name
}
FILTER((xsd:integer(?compoundCount)) >= ?n)
}
LIMIT 10000
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v5("?child")
v4("?compound")
v8("?compoundCount")
v3("?n")
v3("?smiles")
v6("?taxon"):::projected
v7("?taxon_name"):::projected
a1((" "))
c6([http://www.bigdata.com/queryHints#Prior]):::iri
c4(["1.0^^xsd:double"]):::literal
c8(["true"]):::literal
f0[["http://www.w3.org/2001/XMLSchema#integer(?compoundCount) >= ?n"]]
f0 --> v8
f0 --> v3
bind1[/VALUES ?n/]
bind1-->v3
bind10(["4^^xsd:integer"])
bind10 --> bind1
subgraph s1["https://idsm.elixir-czech.cz/sparql/endpoint/wikidata"]
style s1 stroke-width:4px;
bind2[/VALUES ?smiles/]
bind2-->v3
bind20(["C=C#91;C@H#93;1#91;C@@H#93;(OC=C2C1=CCOC2=O)O#91;C@H#93;3#91;C@@H#93;(#91;C@H#93;(#91;C@@H#93;(#91;C@H#93;(O3)CO)O)O)O"])
bind20 --> bind2
bind21(["C=C#91;C@H#93;1#91;C@@H#93;(OC=C2#91;C@#93;1(CCOC2=O)O)O#91;C@H#93;3#91;C@@H#93;(#91;C@H#93;(#91;C@@H#93;(#91;C@H#93;(O3)CO)O)O)O"])
bind21 --> bind2
bind22(["C=C#91;C@@H#93;1#91;C@@H#93;2CCOC(=O)C2=CO#91;C@H#93;1O#91;C@H#93;3#91;C@@H#93;(#91;C@H#93;(#91;C@@H#93;(#91;C@H#93;(O3)CO)O)O)OC(=O)C4=C(C=C(C=C4O)O)O"])
bind22 --> bind2
bind23(["COC1=CC(=C2C(=C1)OC3=C(C=CC(=C3C2=O)O#91;C@H#93;4#91;C@@H#93;(#91;C@H#93;(#91;C@@H#93;(#91;C@H#93;(O4)CO)O)O)O)O)O"])
bind23 --> bind2
a1 --"sachem:query"--> v3
a1 --"sachem:cutoff"--> c4
v4 --"sachem:similarCompoundSearch"--> a1
end
c6 --http://www.bigdata.com/queryHints#runFirst--> c8
v4 --"wdt:P703"--> v5
v5 --"wdt:P171"--> v6
v6 --"wdt:P225"--> v7
bind4[/"count(?compound)"/]
v4 --o bind4
bind4 --as--o v8