You might try db:node-id and db:open-id [1] or the "pre" versions depending on your use case. Regards /Andy
[1] http://docs.basex.org/wiki/Db_Module#db:node-id
On Sat, Apr 6, 2013 at 3:35 AM, C. M. Sperberg-McQueen < cmsmcq@blackmesatech.com> wrote:
I'm experimenting with the construction of secondary documents which contain information about my primary documents. I won't go into details, but it would not be too far off to think of them as user-created indices -- my goal is to pre-calculate some information I expect to want often in queries, to see if using such secondary documents produces faster responses than running the original queries on the original documents. It would be handy to be able to point from my secondary documents to specific nodes (in my case, always elements, at least at the moment) of the primary documents.
The same desire arises when I try to build text search interfaces that return hits with a small amount of context; I want to be able to provide links that point to an appropriate ancestor element, so the user can see more context if desired.
One way to handle this desire would be to take the base URI of the node, and the path from the root to the element and point to elements using XPointer element() expressions of the form
collection/docname.xml#element(1/2/4/1/1)
(A function for fast resolution of XPointer element() expressions would be a nice thing to have, by the way.)
In some XQuery implementations, I believe there are functions which return some sort of internal identifier for element nodes, and other functions which take that identifier as an argument and quickly return that node. (Or perhaps I am just remembering a facility from the first SGML database I used intensively.) Such functions, if they exist, seem likely to be faster than resolution of element() expressions.
Is there anything like that in BaseX?
Thanks!
--
- C. M. Sperberg-McQueen, Black Mesa Technologies LLC
- http://www.blackmesatech.com
- http://cmsmcq.com/mib
- http://balisage.net
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk