Hi Christian,
the problem also exists with DBNode, isn't it? DBNode internally stores the pre of the node at time of instantiation of the object. After an update of DB the internally stored pre points to a wrong node. Of course one could use the ID of DBNode and use db:open-id(id) to get a new DBNode with correct pre. But this approach doesn't work with DOM API. My question is, is there a possible solution that allows me to use DOM interface (We need DOM, because we want to use BaseX to replace an old DOM based parser class without reimplementing everything) and updating expressions?
Best regards, Ingo
Hi Ingo,
as you correctly observed, we are using 'pre' values to organize nodes in our database, which will change after updates (see [1] for further details on pre and id values and the id/pre mapping). It is generally possible to use our DOM interface, but I’m inclined to recommend you the database functions db:open-pre() and db:node-pre(). If you perform updates, db:open-id() and db:node-id() and the UPDINDEX option will help you [2]. You could also work with the DBNode instances, which are returned by the query processor, as this will be much faster than using the DOM wrapper, but it may take more time to get acquainted with the internal node interface.
Regards, Christian
[1] http://docs.basex.org/wiki/Node_Storage#PRE_Value [2] http://docs.basex.org/wiki/Database_Module#db:open-pre%5Bhttp://docs.basex.o...]
Hi Ingo,
the problem also exists with DBNode, isn't it?
A DBNode contains a reference to the Data instance, which can be used to retrieve the id value of a node ( DBNode.id(pre) ).
My question is, is there a possible solution that allows me to use DOM interface (We need DOM, because we want to use BaseX to replace an old DOM based parser class without reimplementing everything) and updating expressions?
This sounds like an audacious venture, because our DOM wrapper was never built to be applied as a serious replacement for the internal node representation… Which is why I would personally avoid pursuing such an approach. A classical DOM implementation is based on a main-memory structure without transaction semantics, whereas BaseX database nodes refer to disk structures, which require an open database, may be modified by other concurrent processes, etc. However, I agree that the existing DOM implementation of BaseX may have the potential to be successfully applied to specific use cases. I just doubt it can be made water-proof for all kinds of scenarios (which is the reason why we already thought about completely removing it from the core package, and instead build new DOM nodes from serialized BaseX results).
I hope this helps, Christian
Best regards, Ingo
Hi Ingo,
as you correctly observed, we are using 'pre' values to organize nodes in our database, which will change after updates (see [1] for further details on pre and id values and the id/pre mapping). It is generally possible to use our DOM interface, but I’m inclined to recommend you the database functions db:open-pre() and db:node-pre(). If you perform updates, db:open-id() and db:node-id() and the UPDINDEX option will help you [2]. You could also work with the DBNode instances, which are returned by the query processor, as this will be much faster than using the DOM wrapper, but it may take more time to get acquainted with the internal node interface.
Regards, Christian
[1] http://docs.basex.org/wiki/Node_Storage#PRE_Value [2] http://docs.basex.org/wiki/Database_Module#db:open-pre%5Bhttp://docs.basex.o...]
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de