Prefetch DOM root node (no lazy loading) using QueryProcessor command
Friday, 18 October 2013 · 4 messages · last reply 19 Oct 2013
EK
Erdal Karaca18 Oct 2013 15:14 #
Hi all,
When querying a DOM Node (from DB on file system, i.e. no in memory DB) using QueryProcessor command: will the whole Node be fetched from the database or will parts of the Node's children still access the file system if not loaded yet?
Thanks!
CG
Christian Grün19 Oct 2013 02:08 #
Quoted text · Erdal Karaca · 4 lines
> When querying a DOM Node (from DB on file system, i.e. no in memory DB) > using QueryProcessor command: will the whole Node be fetched from the > database or will parts of the Node's children still access the file system > if not loaded yet?
I’m not sure what you refer to with DOM: if you use the
QueryProcessor, BaseX will use its internal node representation, in which all nodes are basically a reference to the database and a pre value [1]. The full sub tree of a node (which you probably call DOM here) will only be retrieved if you serialize a node, or if you explicitly convert it to a Java DOM instance.
[1] http://docs.basex.org/wiki/Node_Storage
EK
Erdal Karaca19 Oct 2013 10:11 #
Hi Christian,
The intention is, when querying a node from BaseX, its subtree should be fetched as part of the same "fetch operation", i.e. there shouldn't be any file system access later for any of its sub nodes.
How would you convert the BXNode to a Java Node without
serializing/de-serializing it?
Is there a utility method in the BaseX APIs?
Thanks!
2013/10/19 Christian Grün <christian.gruen at gmail.com>
Quoted text · Christian Grün · 15 lines
> > When querying a DOM Node (from DB on file system, i.e. no in memory DB) > > using QueryProcessor command: will the whole Node be fetched from the > > database or will parts of the Node's children still access the file > system > > if not loaded yet? > > I’m not sure what you refer to with DOM: if you use the > QueryProcessor, BaseX will use its internal node representation, in > which all nodes are basically a reference to the database and a pre > value [1]. The full sub tree of a node (which you probably call DOM > here) will only be retrieved if you serialize a node, or if you > explicitly convert it to a Java DOM instance. > > [1] http://docs.basex.org/wiki/Node_Storage >
CG
Christian Grün19 Oct 2013 20:36 #
Quoted text · Erdal Karaca · 4 lines
> Hi Christian, > The intention is, when querying a node from BaseX, its subtree should be > fetched as part of the same "fetch operation", i.e. there shouldn't be any > file system access later for any of its sub nodes.
If you use ANode.toJava() to create BXNode instances, you will get complete copies of the original nodes in main memory, so this might be what you need.
Quoted text · Erdal Karaca · 18 lines
> 2013/10/19 Christian Grün <christian.gruen at gmail.com> >> >> > When querying a DOM Node (from DB on file system, i.e. no in memory DB) >> > using QueryProcessor command: will the whole Node be fetched from the >> > database or will parts of the Node's children still access the file >> > system >> > if not loaded yet? >> >> I’m not sure what you refer to with DOM: if you use the >> QueryProcessor, BaseX will use its internal node representation, in >> which all nodes are basically a reference to the database and a pre >> value [1]. The full sub tree of a node (which you probably call DOM >> here) will only be retrieved if you serialize a node, or if you >> explicitly convert it to a Java DOM instance. >> >> [1] http://docs.basex.org/wiki/Node_Storage > >
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery