A set of SPARQL examples that are used in LOTUS
Compounds structurally similar to eugenol and eugenyl acetate, grouped by parent taxon.
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: Compounds structurally similar to eugenol and eugenyl acetate, grouped by parent taxon.
SELECT ?parent_taxon ?parent_taxon_name (COUNT(DISTINCT ?compound) AS ?count) WHERE {
SERVICE idsm:wikidata {
VALUES ?CUTOFF {
"0.85"^^xsd:double
}
SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
VALUES ?derivatives {
wd:Q423357
wd:Q27116129
}
?derivatives wdt:P233 ?smiles.
}
?compound sachem:similarCompoundSearch [
sachem:query ?smiles;
sachem:cutoff ?CUTOFF
].
} hint:Prior hint:runFirst true.
?compound wdt:P703/wdt:P171 ?parent_taxon.
?parent_taxon wdt:P225 ?parent_taxon_name.
}
GROUP BY ?parent_taxon ?parent_taxon_name
ORDER BY DESC (?count)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?CUTOFF")
v5("?compound"):::projected
v8("?count")
v3("?derivatives")
v6("?parent_taxon"):::projected
v7("?parent_taxon_name"):::projected
v4("?smiles")
a1((" "))
a2((" "))
c7([http://www.bigdata.com/queryHints#Prior]):::iri
c9(["true^^xsd:boolean"]):::literal
subgraph s1["https://idsm.elixir-czech.cz/sparql/endpoint/wikidata"]
style s1 stroke-width:4px;
bind0[/VALUES ?CUTOFF/]
bind0-->v2
bind00(["0.85^^xsd:double"])
bind00 --> bind0
subgraph s2["https://query.wikidata.org/bigdata/namespace/wdq/sparql"]
style s2 stroke-width:4px;
bind1[/VALUES ?derivatives/]
bind1-->v3
bind10(["wd:Q423357"])
bind10 --> bind1
bind11(["wd:Q27116129"])
bind11 --> bind1
v3 --"wdt:P233"--> v4
end
a1 --"sachem:query"--> v4
a1 --"sachem:cutoff"--> v2
v5 --"sachem:similarCompoundSearch"--> a1
end
c7 --http://www.bigdata.com/queryHints#runFirst--> c9
v5 --"wdt:P703"--> a2
a2 --"wdt:P171"--> v6
v6 --"wdt:P225"--> v7
bind3[/"count(?compound)"/]
v5 --o bind3
bind3 --as--o v8