Changing Wikidata field should update Wikipedia tag #5543
Labels
field
An issue with a field in the user interface
validation
An issue with the validation or Q/A code
Milestone
Following up on #5500, I think changing the Wikidata field should update the
wikipedia
tag to the Wikipedia article title that corresponds to the newly inserted QID. That would avoid any discrepancy between thewikipedia
andwikidata
tags (which would be unfortunate because some data consumers could potentially interpret the feature differently depending on which tag they use).The concern in #5500 (comment) was that, since the Wikidata field kicks off an API request in the user’s language, the
wikipedia
tag would end up with an article title for an inappropriate Wikipedia language edition. But I think the need to keep the tags in sync would outweigh the awkwardness of awikipedia
tag for a foreign language.At the moment, setting the Wikidata field kicks off a MediaWiki API request that excludes sitelinks:
iD/modules/services/wikidata.js
Lines 59 to 60 in 8456b38
We could kick off a request that includes sitelinks (but only in this case, not when viewing the feature normally). Then we could set the
wikipedia
tag’s value while preserving thewikipedia
tag’s current language. If that language doesn’t have a sitelink, then we could fall back to the user’s language, and finally to the first sitelink.Actually, we could even take advantage of MediaWiki’s language fallbacks: in this request for “New York City Hall” in Cajun French,
entities.Q1065206.labels.frc.language
andentities.Q1065206.descriptions.frc.language
are set tofr
, meaning MediaWiki fell back to French. We could choose a fallback language for thewikipedia
tag based on that property.I think the user would find this behavior intuitive and unsurprising. After all, the language and article title would appear right above the Wikidata field that the user has just edited. If the user disagrees, they can select a different language. As long as the Wikipedia article is linked to the same Wikidata item, the Wikidata field will remain unchanged.
If there aren’t any matching sitelinks (or if there are no sitelinks at all), then we should delete the
wikipedia
tag, because whatever the user just selected is unlikely to be related to any Wikipedia article. If the user disagrees, they can hit Undo.(If we don’t keep the tags in sync, then it may become necessary to write a QA tool that periodically checks OSM for mismatched
wikipedia
/wikidata
combinations. I think resolving millions of QIDs to their sitelinks would require a dump of Wikidata; there probably isn’t an online service along those lines.)The text was updated successfully, but these errors were encountered: