Im currently using a query that searches through cities/municipalities that have a population over 2000 people that looks something like this:
SELECT DISTINCT ?city ?native ?cityLabel ?country ?countryLabel ?population
WHERE {
?city wdt:P31/wdt:P279* ?settlement
FILTER(?settlement = wd:Q515 || ?settlement = wd:Q15284)
?city wdt:P1082 ?population .
?city wdt:P17 ?country . FILTER (?country=wd:Q32)
OPTIONAL{?city wdt:P1705 ?native }.
FILTER(?population > 2000)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
The problem is that the population class is really inconsistent and Im filtering out stuff I actually want because its using the population from the 19th century for example. (Like here)
Is there a way to only filter the most recent population value?