Re: unique id generation

From: Dom Lachowicz (domlachowicz@yahoo.com)
Date: Tue May 20 2003 - 12:33:12 EDT

  • Next message: F J Franklin: "XAbiWord-1.0.6 on SourceForge"

    I think that this discussion ignores the fact that
    there are different types of ids, with different uses,
    different localities, and different sources.

    We have at least:

    1) Lists - auto-generated list ids. Any unique
    numbering scheme with regard to the set of list ids
    will work here.
    2) Objects - auto-generated ids. Any unique numbering
    scheme with regard to the set of object ids will work
    here.
    3) Headers/Footers - ...
    4) Footnotes/Endnotes - ...
    5) Bookmarks - the only interesting case I see. Here,
    the ids have user significance (as opposed to
    significance only within our piece table). It's not
    clear how to handle conflicting names. All of the
    following seem to have some merits and flaws to me:

    a) Removing old bookmark, using new one
    b) Ignoring new bookmark, use old one
    c) Sequential numbering scheme within bookmarks
    d) Not caring, because, honestly, how often does this
    happen
    e) Other

    Let's not confuse cases 1-4 with 5 here. 1-4 can be
    implemented with a simple global counter, or a set of
    them (using 1 per case). Importers only need to call
    getNextUID(), *regardless* of what the UID (if any)
    might be in the originating file. I'd put the onus on
    each importer to do all (if any) mapping between some
    "original" ID and the UID the document is going to
    use.

    Also, let's not just assume that 5.c is what we want
    either. 5a-d are all fairly straightforward to
    implement, and in my mind, any or all of them could be
    the correct solution.

    Caio,
    Roberto

    --- F J Franklin <F.J.Franklin@sheffield.ac.uk> wrote:
    > On Tue, 20 May 2003, F J Franklin wrote:
    > > The real problem is not the generation of unique
    > IDs, which is simple
    > > enough to do, but rather the merging of document
    > fragments each of which
    > > has its own set of IDs and ID references. When
    > merging documents, the
    > > safest method (though probably very difficult as
    > long as we use linear
    > > import) is to replace all IDs with new
    > document-unique IDs and to map all
    > > ID references to the appropriate new IDs.
    >
    > Thinking about it, what importers need to do is:
    >
    > every time an ID or ID reference is encountered, the
    > ID is looked up in a
    > map to see whether the ID was encountered previously
    > and if so replace the
    > ID with the appropriate mapping; if this is the
    > first time the ID has been
    > encountered then generate a new ID, add to the map,
    > and replace.
    >
    > where it gets slightly interesting is where we have
    > user-named IDs (i.e.,
    > bookmarks) because how should these be renamed?
    > should they be renamed at
    > all? if you are copy&pasting then what?
    >
    > complicato.
    >
    > Ciao, Frank
    >
    > Francis James Franklin
    > F.J.Franklin@shef.ac.uk
    >
    > After we were introduced I noticed that both of them
    > were carrying
    > three-foot-long machetes. I hate hiking with
    > convicts carrying machetes.
    >
    > - Susan
    > Orlean, The Orchid Thief
    >

    __________________________________
    Do you Yahoo!?
    The New Yahoo! Search - Faster. Easier. Bingo.
    http://search.yahoo.com



    This archive was generated by hypermail 2.1.4 : Tue May 20 2003 - 12:47:24 EDT