[Rebuild] Extending Richard's "v0 for relations" suggestion
antofosm at gmail.com
Fri Feb 17 16:04:48 GMT 2012
On 07.02.2012 16:46, Ed Loach wrote:
> I've been trying to get my head around how we could perhaps have a
> v0 for any given object, be it node, way or relation. Each object
> type has tags and members (for nodes the members are lat/lon, for
> ways the members are nodes, and for relations the members - whether
> they be ways, nodes or other relations).
> So in each case we could think of a v0 item with no tags and no
> members for a given object type and id (except for when ways are
> split when the v0 object for the new id would be the pre-split
> parent way; merging ways effectively deletes a way so doesn't need
> special consideration).
In my opinion this is a very good idea.
On a side note:
* Splits may occur more than once on a single way, so the pre-split way
might itself be the result of a split, so we'd effectively need versions
0, -1, -2, ...
* In a merge, if tags were copied from a merged (deleted) way, it is
worth considering whether the tags were clean. However, the v0 approach
doesn't help with that.
> What I can't see obviously is how at any stage you can tell for a
> given way version (for example) which node versions were members -
> so were they for example clean at the time of splitting a way, or
> dirtied afterwards. And I'm trying to work out if it matters. I'm
> guessing it will for history calls, perhaps.
It doesn't matter if we go as you propose in the following paragraphs.
> For current tables...
> If we start by checking all the nodes:
> * find the last clean lat and the last clean lon for that node; if
> either of these are the v0 empty object then delete the node.
> * work out which tags are clean like the deep diff tool does and
> only keep them (if empty)
> * remove any nodes with no tags that are not part of a way or
> relation (e.g. a POI tagged by a non-accepter, but positioned by an
> Then for each way:
> * keep only clean nodes from the above step - if any way has 1 or
> fewer nodes remaining then delete it
> * work out which tags are clean as the deep diff tool does and only
> keep those tags - except perhaps also handle splits by considering
> pre-split way as the v0 version; this means knowing which tags were
> clean at the time of the split, and identifying. This appears to be
> non-trivial. Some thoughts on that below.
> * if no tags remain, perhaps add FIXME=untagged way, or just leave
> it untagged.
> Then for each relation:
> * keep any node members that still exist if added by an accepter
> * keep any way members that still exist if added by an accepter
> * recurse same checks through any sub-relations if added by an
> accepter, else remove from parent relation.
> * treat tags on relations in the same way as Richard suggested
> starting with v0 empty set.
> * delete any relations that have no remaining members
I consider this a top candidate for a "untainting" algorithm so far
(just add "harmless" logic for edits on tags).
As for the splits, see my other emails.
More information about the Rebuild