A set of SPARQL examples that are used in LOTUS
Taxa containing indolic scaffolds. Count occurences by parent taxon.
PREFIX hint: <http://www.bigdata.com/queryHints#>
PREFIX idsm: <https://idsm.elixir-czech.cz/sparql/endpoint/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#title: Taxa containing indolic scaffolds. Count occurences by parent taxon.
SELECT ?parent_taxon ?parent_taxon_name (COUNT(DISTINCT ?compound) AS ?count) WHERE {
SERVICE idsm:wikidata {
VALUES ?SUBSTRUCTURE {
"C12=C(C=CC=C2)C=CN1" # indolic scaffold
}
?compound sachem:substructureSearch [
sachem:query ?SUBSTRUCTURE
].
} hint:Prior hint:runFirst true.
?compound p:P703 ?statement.
?statement ps:P703/wdt:P171 ?parent_taxon.
?parent_taxon wdt:P225 ?parent_taxon_name.
}
GROUP BY ?parent_taxon ?parent_taxon_name
HAVING (?count > 100)
ORDER BY DESC (?count)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?SUBSTRUCTURE")
v3("?compound"):::projected
v7("?count")
v5("?parent_taxon"):::projected
v6("?parent_taxon_name"):::projected
v4("?statement")
a1((" "))
a2((" "))
c5([http://www.bigdata.com/queryHints#Prior]):::iri
c7(["true^^xsd:boolean"]):::literal
f0[["?count > '100^^xsd:integer'"]]
f0 --> v7
subgraph s1["https://idsm.elixir-czech.cz/sparql/endpoint/wikidata"]
style s1 stroke-width:4px;
bind1[/VALUES ?SUBSTRUCTURE/]
bind1-->v2
bind10(["C12=C(C=CC=C2)C=CN1"])
bind10 --> bind1
a1 --"sachem:query"--> v2
v3 --"sachem:substructureSearch"--> a1
end
c5 --http://www.bigdata.com/queryHints#runFirst--> c7
v3 --"p:P703"--> v4
v4 --"p:statement/P703"--> a2
a2 --"p:direct/P171"--> v5
v5 --"p:direct/P225"--> v6
bind3[/"count(?compound)"/]
v3 --o bind3
bind3 --as--o v7