Bot to remove empty relations?

It seems that some editors make it too easy to create empty relations. Would it be possible to remove them automatically with a bot?
The criteria would be this:
No members and version<=2 and either no tags or just a type=* tag
Maybe an additional filter regarding last modified timestamp being older than 10 days.

I have no idea how to code or execute a bot but I read that they exist.

thanks,
Gerd

Why do you want to use those additional criteria instead of a “remove all empty relations”? In my opinion, a relation without members is useless.
By the way, is it possible to make an empty relation by removing all members from an existing relation, e.g. in Josm? Then moving members manually from one relation into an other relation could lead to such empty relations, with quite version numbers too.

Some empty relations were normal relations with maybe hundreth of members before the last edit. Mappers cannot only create empty relations by mistake, they can also remove all members of new or old relations.
I don’t care which editor was used to do this, probably each editor allows to do it.

There are a number of good reasons why empty relations shouldn’t be deleted automatically, see the last dozen or so discussions on the matter.

Not to mention that they do not actually have any negative impact outside of irritating people with an overly high tidiness itch (some would argue that is a good thing).

Could not find any discussion about this. Do you have a link for me?

I’m just going to give you the gist:

  • it might just be a temporary situation (as empty relations have no impact, there is no reason not to have a temporarily empty a relation for example while you are redoing a route or whatever).

  • if the members were deleted in error it is contra-productive to delete the relation.

Well, you list those cases which my suggested filters should catch. I agree that we don’t want to remove relations which where accidentially emptied.

Empty relations have in fact at least two impacts:

  • they change numbers in Taginfo
  • they appear in global overpass searches like “all type=waterway relations” unless you filter them

I did such an overpass query to find a parent/child dependency loop and just wondered why the useless data is not removed by a bot.
In the end I found out that I can suppress them with a clause like (if:count_members() > 0)

And given basically 0 impact even people with high tidiness itch, capable of making and running bots (for example me) prefer to spends time on reviewing other kinds of data, where edit will have some impact.

And, as mentioned, here in basically all cases manual review will be necessary anyway - so you can just do this in JOSM.

PS: if you have the suspicion that there is a large number created by a specific editor, then we should be fixing the issue at the source.

I see at least one special pattern regarding JOSM. I found ~18.000 empty relations with version 1.
The vast majority are multipolygons (> 15.000), so I checked a few. I found only JOSM, so I created a new ticket: https://josm.openstreetmap.de/ticket/19316

QS-Tools wie z.B. KeepRight finden z.B. Relationen ohne Typ.
Oft Multipolygone, z.B. für einfache Häuserumrandungen.
München scheint ein Schwerpunkt.

Andere Baustelle, aber auch davon gibt es immerhin mehr 17.600 laut overpass.

By the way, is it possible to make an empty relation by removing all members from an existing relation, e.g. in Josm? Then moving members manually from one relation into an other relation could lead to such empty relations, with quite version numbers too.