lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

View the Project on GitHub lotusnprod/lotus-sparql-examples

wd_nps_source_scholarly_subgraph

rq turtle/ttl

Referenced compound-taxon pairs on Wikidata (limited to 1000 results).

Use at


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 wdsubgraph: <https://query.wikidata.org/subgraph/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Referenced compound-taxon pairs on Wikidata (limited to 1000 results).
SELECT DISTINCT ?compound ?compound_inchikey ?taxon ?taxon_name ?reference ?reference_doi 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
    SERVICE wdsubgraph:scholarly_articles {
      ?reference wdt:P356 ?reference_doi.          # get the reference DOI
    }
}
LIMIT 1000

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?compound"):::projected 
  v2("?compound_inchikey"):::projected 
  v4("?reference"):::projected 
  v6("?reference_doi"):::projected 
  v3("?taxon"):::projected 
  v5("?taxon_name"):::projected 
  a1((" "))
  a2((" "))
  v1 --"p:direct/P235"-->  v2
  a1 --"p:statement/P703"-->  v3
  a1 --"prov:wasDerivedFrom"-->  a2
  a2 --"p:reference/P248"-->  v4
  v1 --"p:P703"-->  a1
  v3 --"p:direct/P225"-->  v5
  subgraph s1["https://query.wikidata.org/subgraph/scholarly_articles"]
    style s1 stroke-width:4px;
    v4 --"p:direct/P356"-->  v6
  end