Wikidata talk:WikiProject Country subdivision/Items
Jump to navigation
Jump to search
Try it!
Ideally, a lot of this page could be replaced by a query along the lines of:
SELECT ?country ?countryLabel ?item ?itemLabel ?level ?expected ?found ?samenumber
WITH {
SELECT ?item ?expected ?country ?level (COUNT(DISTINCT ?place) AS ?found) {
?item wdt:P279* ?acs ; wdt:P17 ?country.
FILTER NOT EXISTS { ?country wdt:P576 [] }
?acs p:P279 [ ps:P279 wd:Q1799794 ; pq:P1545 ?level ] .
OPTIONAL { ?item wdt:P1114 ?expected }
OPTIONAL {
?place p:P31 ?placeStatement .
?placeStatement ps:P31 ?item.
FILTER NOT EXISTS { ?placeStatement wdt:P582 [] }
}
}
GROUP BY ?item ?expected ?country ?level
} AS %subdivisions
WHERE {
include %subdivisions.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
BIND(IF(?expected = ?found, "✓", "✘") AS ?samenumber).
}
ORDER BY ?countryLabel ?level DESC(?expected) ?itemLabel
(via User:Nikki) --Oravrattas (talk) 14:12, 3 September 2021 (UTC)