lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

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

wd_maintenance_nps

rq turtle/ttl

Referenced compound-taxon pairs on Wikidata (with P1582 and not P703).

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 wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Referenced compound-taxon pairs on Wikidata (with P1582 and not P703).
SELECT DISTINCT (REPLACE(STR(?item), ".*Q", "Q") AS ?qid) (REPLACE(STR(?taxon), ".*Q", "Q") AS ?P703) (REPLACE(STR(?art), ".*Q", "Q") AS ?S248) WHERE {
    VALUES ?classes {
        wd:Q113145171
        wd:Q59199015
    }
    ?item wdt:P31 ?classes.
    {
        ?item p:P1582 ?stmt.
        ?stmt ps:P1582 ?taxon;
        prov:wasDerivedFrom/pr:P248 ?art.
    }
}
LIMIT 1000

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?P703")
  v8("?S248")
  v5("?art"):::projected 
  v1("?classes")
  v2("?item"):::projected 
  v6("?qid")
  v3("?stmt")
  v4("?taxon"):::projected 
  a1((" "))
  bind0[/VALUES ?classes/]
  bind0-->v1
  bind00(["wd:Q113145171"])
  bind00 --> bind0
  bind01(["wd:Q59199015"])
  bind01 --> bind0
  v2 --"p:direct/P31"-->  v1
  v2 --"p:P1582"-->  v3
  v3 --"p:statement/P1582"-->  v4
  v3 --"prov:wasDerivedFrom"-->  a1
  a1 --"p:reference/P248"-->  v5
  bind1[/"replace(str(?item),'.*Q','Q')"/]
  v2 --o bind1
  bind1 --as--o v6
  bind2[/"replace(str(?taxon),'.*Q','Q')"/]
  v4 --o bind2
  bind2 --as--o v7
  bind3[/"replace(str(?art),'.*Q','Q')"/]
  v5 --o bind3
  bind3 --as--o v8