query-3e150fb2714f4ebaf0a123925faf8453

rq turtle/ttl

Updating Kmetstvo1. Reconcile ek_kmet.xlsx using values in ekatte column

Use at

PREFIX wds: <http://www.wikidata.org/entity/statement/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
select ?s ?sid {
  ?x p:P3990 ?st .
  ?st pq:P518 wd:Q4224624 ; ps:P3990 ?ekatte .
  filter not exists { 
    ?st prov:wasDerivedFrom ?ref_ekatte .
    ?ref_ekatte pr:P813 ?date 
  }  
  bind(strafter(str(?x),str(wd:)) as ?qid)
  bind(replace(strafter(str(?st),str(wds:)),concat(?qid,"-"),concat(?qid,"\\$")) as ?sid)
  bind(concat("-STATEMENT") as ?s)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?date") v5("?ekatte") v6("?qid") v2("?ref_ekatte") v8("?s"):::projected v7("?sid"):::projected v1("?st") v4("?x") c5(["wd:Q4224624"]):::iri f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"prov:wasDerivedFrom"--> e0v2 e0v2 --"p:reference/P813"--> e0v3 e0v3("?date"):::projected e0v2("?ref_ekatte"):::projected e0v1("?st"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 f0 --> c2 f0 --> v3 v1 --"prov:wasDerivedFrom"--> v2 v2 --"p:reference/P813"--> v3 v4 --"p:P3990"--> v1 v1 --"p:qualifier/P518"--> c5 v1 --"p:statement/P3990"--> v5 bind1[/"substring-after(str(?x),str('wd:'))"/] v4 --o bind1 bind1 --as--o v6 bind2[/"replace(substring-after(str(?st),str('wd:statement/')),concat(?qid,'-'),concat(?qid,'\$'))"/] v1 --o bind2 v6 --o bind2 bind2 --as--o v7 bind3[/"concat('-STATEMENT')"/] bind3 --as--o v8