On Mon, Jul 14, 2014 at 8:14 AM, Kent Tenney <[email protected]> wrote:
> I'm afraid this level of detail is beyond me.
It's hard to understand without digging into the code. But read on...
> I don't understand Leo looking for nodes, I would expect the @auto parsing
> component to be asking if a node had been seen previously
The parser is not involved in any way. The new @auto code uses what
the parser gives it.
The crucial comments are in the docstring for the
PersistenceDataController class:
QQQ
All required data are held in nodes having the following structure::
- @persistence
- @data <headline of foreign node>
- @gnxs
body text: pairs of lines: gnx:<gnx><newline>unl:<unl>
- @uas
@ua <gnx>
body text: the pickled uA
QQQ
Looking closely, you will see that Leo attempts to associate gnx's
with unl's, very much like bookmarks.
> So Leo is persisting the tree of the @auto file?
Kinda. It persists the unl's, which depend on the outline structure.
As discussed previously, we don't need to require an *exact* match
between unl's and nodes, but that code isn't in place yet.
> Doesn't that set the stage for conflicts between the @auto parsing machinery
> and the persisted tree?
Yes. This scheme *must* fail if imported headlines change, that is, if
you change the *name* of the thing being imported **outside of Leo**.
Absent true AI, there is **no way** around such breakages.
But how often do you, in fact, change outline structure outside of
Leo? And how often do you change the *names* of imported things
outside of Leo? Not all that often, I'm guessing.
> I've been thinking along simpler lines, only persisting key/value pairs like
{hash_contents:[uA, gnx], hash_contents:[uA, gnx] ...}
or
{hash_uri:[uA, gnx], hash_uri:[uA, gnx] ... }
This is really the same scheme that the new code uses! Look again at
this part of the docstring:
QQQ
- @uas
- @ua <gnx>
body text: the pickled uA
QQQ
> if the parser comes across a node which matches one seen before, fine,
> if it's new create a new gnx and empty uA, leaving all the tree management
> work to the @auto parser.
To repeat, the parser has *nothing* to do with this scheme. The new
@auto code takes what the parser gives it, and goes from there.
> Evidently I don't appreciate the complexities involved.
The new code is *much* simpler than the old, so you can study it in
detail if you like. However, I suggest looking at the data in the
@persistence tree. It is straightforward.
As long as outline structure doesn't change (and it rarely does) that
data suffices to recreate clone links and uA's. If the outline
structure *does* change, we will need more clever code to associate
unl's with gnx's. If a node's headline changes, we will lose uA's and
clone links to that node. That's a given, imo.
Thanks for your questions. Feel free to ask more.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.