query-38abb897aa97f0c477799424eb469847
Forts that don't have a valid current country
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?country ?countryLabel WHERE {
?item wdt:P31 wd:Q1785071 .
OPTIONAL {?item wdt:P17 ?country.}
MINUS {VALUES ?countries {wd:Q35 wd:Q55 wd:Q1183 wd:Q21203 wd:Q25279 wd:Q31354462 wd:Q25305 wd:Q25230 wd:Q785 wd:Q26273
wd:Q26180 wd:Q25228 wd:Q9676 wd:Q4628 wd:Q42620 wd:Q1246 wd:Q244165 wd:Q23635}. ?item wdt:P17 ?countries}
MINUS {?item wdt:P17 ?new_country . ?new_country wdt:P31 wd:Q3624078 . FILTER NOT EXISTS {?new_country wdt:P31 wd:Q3024240} }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en-gb,en,mul". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?countries")
v2("?country"):::projected
v1("?item"):::projected
v4("?new_country")
c4(["wd:Q3024240"]):::iri
c9(["en-gb,en,mul"]):::literal
c2(["wd:Q1785071"]):::iri
c5(["wd:Q3624078"]):::iri
c7(["bd:serviceParam"]):::iri
v1 --"wdt:P31"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P17".-> v2
end
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
bind1[/VALUES ?countries/]
bind1-->v3
bind10(["wd:Q35"])
bind10 --> bind1
bind11(["wd:Q55"])
bind11 --> bind1
bind12(["wd:Q1183"])
bind12 --> bind1
bind13(["wd:Q21203"])
bind13 --> bind1
bind14(["wd:Q25279"])
bind14 --> bind1
bind15(["wd:Q31354462"])
bind15 --> bind1
bind16(["wd:Q25305"])
bind16 --> bind1
bind17(["wd:Q25230"])
bind17 --> bind1
bind18(["wd:Q785"])
bind18 --> bind1
bind19(["wd:Q26273"])
bind19 --> bind1
bind110(["wd:Q26180"])
bind110 --> bind1
bind111(["wd:Q25228"])
bind111 --> bind1
bind112(["wd:Q9676"])
bind112 --> bind1
bind113(["wd:Q4628"])
bind113 --> bind1
bind114(["wd:Q42620"])
bind114 --> bind1
bind115(["wd:Q1246"])
bind115 --> bind1
bind116(["wd:Q244165"])
bind116 --> bind1
bind117(["wd:Q23635"])
bind117 --> bind1
v1 --"wdt:P17"--> v3
end
subgraph minus2["MINUS"]
style minus2 stroke-width:6px,fill:pink,stroke:red;
f3[["not "]]
subgraph f3e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0c2
e0v1("?new_country"):::projected
e0c2(["wd:Q3024240"]):::iri
end
f3--EXISTS--> f3e0
f3 --> v4
f3 --> c1
f3 --> c4
v4 --"wdt:P31"--> c4
v1 --"wdt:P17"--> v4
v4 --"wdt:P31"--> c5
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end