query-12ed3dba5e0b2e6719a362e315453b95
Border checkhas to be checked from both sides of the border to find items outside the foreign border - wrong country, or duplicates outside the own border - wrong country, or duplicates inside the border (save to ignore) on the border but not assigned to both countries ganz Österreich
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":"?rgb"}
#title: Border check (with distinct types, less timeout)
SELECT ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer WHERE {
{
SELECT DISTINCT ?item (COUNT(DISTINCT ?country) as ?anz) WHERE {
?item wdt:P17 wd:Q215 . #16
#?item wdt:P131*/wdt:P279* wd:Q980 . # in case of timelimit restrict to sub unit
?item wdt:P31 ?isA .
VALUES ?isA {wd:Q8502 wd:Q16887036 wd:Q2231510 wd:Q10862618 wd:Q35666 wd:Q23397 wd:Q133056} # distinct border related types
?item wdt:P625 [] .
?item wdt:P17 ?country .
}
GROUP BY ?item
}.
?item wdt:P31 [] .
?item p:P625 ?coordStatement .
?coordStatement ps:P625 ?coord .
BIND(IF(?anz = 1, '60ff60', 'ff0000') AS ?rgb) .
BIND(IF(?anz = 1, 'inside (single P17)', 'border (multiple P17)') AS ?layer) .
SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer # ORDER BY ASC(?item)
Query found at
- https://www.wikidata.org/wiki/User:Herzi_Pinki/Sparql
- https://www.wikidata.org/wiki/User:Herzi_Pinki/Sparql/Coordinate_Me
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?anz"):::projected
v6("?coord"):::projected
v5("?coordStatement")
v3("?country")
v3("?isA")
v1("?item"):::projected
v8("?layer"):::projected
v7("?rgb"):::projected
a1((" "))
a2((" "))
c2(["wd:Q215"]):::iri
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE,de,en#93;"]):::literal
v1 --"p:direct/P17"--> c2
v1 --"p:direct/P31"--> v3
bind0[/VALUES ?isA/]
bind0-->v3
bind00(["wd:Q8502"])
bind00 --> bind0
bind01(["wd:Q16887036"])
bind01 --> bind0
bind02(["wd:Q2231510"])
bind02 --> bind0
bind03(["wd:Q10862618"])
bind03 --> bind0
bind04(["wd:Q35666"])
bind04 --> bind0
bind05(["wd:Q23397"])
bind05 --> bind0
bind06(["wd:Q133056"])
bind06 --> bind0
v1 --"p:direct/P625"--> a1
v1 --"p:direct/P17"--> v3
bind2[/"count(?country)"/]
v3 --o bind2
bind2 --as--o v4
v1 --"p:direct/P31"--> a2
v1 --"p:P625"--> v5
v5 --"p:statement/P625"--> v6
bind3[/"if(?anz = '1^^xsd:integer','60ff60','ff0000')"/]
v4 --o bind3
bind3 --as--o v7
bind4[/"if(?anz = '1^^xsd:integer','inside (single P17)','border (multiple P17)')"/]
v4 --o bind4
bind4 --as--o v8
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end