Page MenuHomePhabricator

Administrative location chain should only include contemporary units
Open, Needs TriagePublic

Description

See https://tools.wmflabs.org/monumental-glam/#/institution/3107846

It's currently showing

Gothenburg Municipality · Västra Götaland County · Gothenburg and Bohus County · Sweden · Union between Sweden and Norway

It should be

Gothenburg Municipality · Västra Götaland County · Sweden

Both Gothenburg and Bohus County and Union between Sweden and Norway do not exist anymore. The chain should only use currently existing administrative units.

Event Timeline

Restricted Application added subscribers: jeblad, Danmichaelo, jhsoby. · View Herald TranscriptMay 14 2019, 7:06 AM
Yarl added a comment.May 14 2019, 11:13 AM

Looks like this will work. It needs to be sorted on front-end though.

SELECT ?parent ?parentLabel ?grandParent WHERE {
  wd:Q52502 wdt:P131* ?parent .
  MINUS { ?parent wdt:P576|wdt:P582|wdt:P1366 []. } # remove outdated admin
  OPTIONAL {
    ?parent wdt:P131 ?grandParent.
    MINUS { ?grandParent wdt:P576|wdt:P582|wdt:P1366 []. }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}