Bulk edit announcement - avoiding Wikidata redirects

Wikidata has a mechanism for eliminating duplicates. When a duplicate entry is found, it is deleted. From that point on, references to the deleted Wikidata entry are redirected to the surviving entry.

As a result, OSM has wikidata tag values that do not relate to actual Wikidata entries. This is usually not a problem. However, attempts to align OSM and Wikidata elements are more complex because of the hidden redirects.

For example, it is not possible to find if a given Wikidata QID is not included in OSM by a direct search in OSM wikidata tags, using a simple Overpass query. It may be the case that some OSM element holds a wikidata value that redirects to the desired QID. Similarly, for finding groups of Wikidata entries.

I propose to run a script that will find such redirects and will create an .osm file to be used in JOSM for updating the wikidata tags with the post-redirection value.

The script also provides some statistics. The Israel and Palestine area has

  • 11628 OSM elements with wikidata tags
  • 7630 unique QIDs
  • 119 redirects
  • 250 OSM elements to be modified

I have reviewed the code and had validated several modifications, at random.

The script is available at fix_wikidata_redirects.py

2 Likes

Related to Dulicate search results caused by Wikidata redirect · Issue #42 · IsraelHikingMap/planet-search · GitHub

Feels right thing to do.

Might be worthwhile bringing it up in a global forum as well. If the code is ready and works, it could be used worldwide.

The DWG would need to be in the loop first. (For Israel I think community consensus is enough).

Just to be clear: I’m only proposing that I’ll perform this for Israel and Palestine.
I’m OK with someone else using the script elsewhere.

1 Like

Done!

1 Like