A set of SPARQL examples that are used in LOTUS
Compounds found in Fungi (Q764), with an NCBI ID.
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX wdsubgraph: <https://query.wikidata.org/subgraph/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Compounds found in Fungi (Q764), with an NCBI ID.
SELECT ?taxon ?taxon_name ?taxon_ncbi ?compound ?compound_inchikey ?compound_smiles_canonical ?compound_smiles_isomeric ?reference ?reference_doi WHERE {
?taxon (wdt:P171*) wd:Q764;
wdt:P685 ?taxon_ncbi;
wdt:P225 ?taxon_name.
?compound wdt:P235 ?compound_inchikey;
wdt:P233 ?compound_smiles_canonical;
p:P703 ?statement.
OPTIONAL { ?compound wdt:P2017 ?compound_smiles_isomeric. }
?statement ps:P703 ?taxon;
prov:wasDerivedFrom/pr:P248 ?reference.
SERVICE wdsubgraph:scholarly_articles {
?reference wdt:P356 ?reference_doi.
}
}
LIMIT 300000
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?compound"):::projected
v5("?compound_inchikey"):::projected
v6("?compound_smiles_canonical"):::projected
v8("?compound_smiles_isomeric"):::projected
v9("?reference"):::projected
v10("?reference_doi"):::projected
v7("?statement")
v1("?taxon"):::projected
v3("?taxon_name"):::projected
v2("?taxon_ncbi"):::projected
a1((" "))
c2(["wd:Q764"]):::iri
v1 --"p:direct/P171"--> c2
v1 --"p:direct/P685"--> v2
v1 --"p:direct/P225"--> v3
v4 --"p:direct/P235"--> v5
v4 --"p:direct/P233"--> v6
v4 --"p:P703"--> v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:direct/P2017".-> v8
end
v7 --"p:statement/P703"--> v1
v7 --"prov:wasDerivedFrom"--> a1
a1 --"p:reference/P248"--> v9
subgraph s1["https://query.wikidata.org/subgraph/scholarly_articles"]
style s1 stroke-width:4px;
v9 --"p:direct/P356"--> v10
end