Skip to content

territories: ae-sh and ae-fu use the city QID as primary, so the emirate items don't resolve #268

Description

@pudo

ae-sh and ae-fu carry the city item as their primary qid, so the two emirate items resolve to nothing:

>>> from rigour.territories import get_territory_by_qid as g
>>> g("Q188810")   # Emirate of Sharjah
None
>>> g("Q4091")     # Emirate of Fujairah
None

The other five emirates resolve from both the emirate and the city item, because they follow the convention of qid = subdivision, other_qids = the city that shares its name:

code qid other_qids emirate resolves?
ae-az Q187712 Emirate of Abu Dhabi Q1519 Abu Dhabi yes
ae-du Q613 Emirate of Dubai Q612 Dubai yes
ae-rk Q170024 Ras Al Khaimah Q2126436 (city) yes
ae-uq Q175021 Umm Al Quwain Q2788830 (city) yes
ae-aj Q159477 Emirate of Ajman yes
ae-sh Q289693 Sharjah (city) no — emirate is Q188810
ae-fu Q4045 Fujairah (city) no — emirate is Q4091

Which item is which

The emirates are the seven values of Q878 wdt:P150 (contains administrative territorial entity), and each is typed Q19833031 emirate of the United Arab Emirates:

  • Q188810 "Emirate of Sharjah" — P31 = Q19833031, in P150
  • Q289693 "Sharjah" — P31 = city, big city; not in P150
  • Q4091 "Emirate of Fujairah" — P31 = Q19833031, in P150
  • Q4045 "Fujairah" — P31 = city; not in P150

Why it matters

Wikidata uses the emirate item for P1001 (applies to jurisdiction) on subnational offices, so a lookup keyed on what Wikidata actually stores fails for two of the seven. For example Q123117007 "Deputy Ruler of Sharjah" carries P1001 = Q188810, and Q110964697 "Ruler of Sharjah" likewise.

That path matters downstream: zavod's Wikidata position crawler resolves P1001 through get_territory_by_qid and, when the territory is not itself a country, applies it as the position's subnationalArea. With these two unresolvable, a Sharjah or Fujairah office silently loses its subnational area while the other five keep theirs.

Suggested fix

Swap the two entries to match the other five — emirate as qid, city in other_qids:

# resources/territories/ae_sh.yml
qid: Q188810
other_qids:
  - Q289693
# resources/territories/ae_fu.yml
qid: Q4091
other_qids:
  - Q4045

Two smaller things noticed in passing, both optional:

  • ae-aj has no other_qids, so Ajman city (Q530171) does not resolve either — harmless but inconsistent with ae-az/ae-du/ae-rk/ae-uq.
  • ae_fu.yml is unusually sparse: its only names_weak entry is FUJAIRAH MEDIA FREE ZONE, with no Arabic name (الفجيرة) and no Emirate of Fujairah, where the other six carry both.

Found while mapping UAE emirate-level offices onto Wikidata position items.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions