A set of SPARQL examples that are used in LOTUS
Referenced compound-taxon pairs on Wikidata.
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Referenced compound-taxon pairs on Wikidata.
SELECT DISTINCT ?compound ?compound_inchikey ?taxon ?taxon_name ?reference WHERE {
    ?compound wdt:P235 ?compound_inchikey;         # get the inchikey
    p:P703[                                        # statement found in taxon
      ps:P703 ?taxon;                              # get the taxon
              prov:wasDerivedFrom [
                pr:P248 ?reference ]               # get the reference
    ].
    ?taxon wdt:P225 ?taxon_name.                   # get the taxon scientific name
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?compound"):::projected 
  v2("?compound_inchikey"):::projected 
  v4("?reference"):::projected 
  v3("?taxon"):::projected 
  v5("?taxon_name"):::projected 
  a1((" "))
  a2((" "))
  v1 --"p:direct/P235"-->  v2
  a1 --"p:statement/P703"-->  v3
  a2 --"p:reference/P248"-->  v4
  a1 --"prov:wasDerivedFrom"-->  a2
  v1 --"p:P703"-->  a1
  v3 --"p:direct/P225"-->  v5