query-d23c0aba2f97bd38dafb817ae2dfda38

rq turtle/ttl

Items with sitelink only to hewiki, "item1" is an item with a sitelink to hewiki and "item2" has no sitelinks to hewiki. however I want to define that "item1" not only has a sitelink to hewiki, it is also the only sitelink, by that I mean that item1 must only have a sitelink to hewiki. My query: (P373)Commons category Hey. I wrote a query the produces a list of items that have the same

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
SELECT ?item1 ?item2 WHERE {
  ?item1 wdt:P373 ?val.
  ?item2 wdt:P373 ?val.
  FILTER EXISTS { ?whe schema:about ?item1 . ?whe schema:inLanguage "he" }
  FILTER NOT EXISTS { ?wother schema:about ?item2 . ?wother schema:inLanguage "he" }
  FILTER NOT EXISTS {?item2 wdt:P31 wd:Q4167836}
  FILTER NOT EXISTS {?item1 wdt:P31 wd:Q4167836}
  } LIMIT 100

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item1"):::projected v2("?item2"):::projected v5("?val") v4("?whe") v3("?wother") c2(["wd:Q4167836"]):::iri c5(["he"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P31"--> e0c2 e0v1("?item1"):::projected e0c2(["wd:Q4167836"]):::iri end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> c2 v1 --"wdt:P31"--> c2 f1[["not "]] subgraph f1e1["Exists Clause"] e1v1 --"wdt:P31"--> e1c2 e1v1("?item2"):::projected e1c2(["wd:Q4167836"]):::iri end f1--EXISTS--> f1e1 f1 --> v2 f1 --> c1 f1 --> c2 v2 --"wdt:P31"--> c2 f2[["not "]] subgraph f2e2["Exists Clause"] e2v1 --"schema:about"--> e2v2 e2v1 --"schema:inLanguage"--> e2c3 e2v2("?item2"):::projected e2v1("?wother"):::projected e2c3(["he"]):::literal end f2--EXISTS--> f2e2 f2 --> v3 f2 --> c3 f2 --> v2 f2 --> c4 f2 --> c5 v3 --"schema:about"--> v2 v3 --"schema:inLanguage"--> c5 f3[[" "]] subgraph f3e3["Exists Clause"] e3v1 --"schema:about"--> e3v2 e3v1 --"schema:inLanguage"--> e3c3 e3v2("?item1"):::projected e3v1("?whe"):::projected e3c3(["he"]):::literal end f3--EXISTS--> f3e3 f3 --> v4 f3 --> c3 f3 --> v1 f3 --> c4 f3 --> c5 v4 --"schema:about"--> v1 v4 --"schema:inLanguage"--> c5 v1 --"wdt:P373"--> v5 v2 --"wdt:P373"--> v5