Dear List,
I wonder if there's a method in BaseX for getting a unique identifier for a node. If I had a document in memory & was using, say, Saxon, I'd call a method on the node to return its location as an XPath string, but using XQuery in BaseX, is there a "somefn" such that
for $d in $doc//date return <result path="{somefn($d}">{$d}</result>
would return <result path="/root/date[5]"><date when="2010-03-25"/></result> or some such?
I understand that nodes are identified internally in BaseX by their pre-order traversal index – is there a way get the pre number? If not directly from an XQuery function, perhaps in some of the Java client code?
My use case is that I'd like to return elements – <date>'s, e.g. – with info about their location in the document so that later & on-demand I can get more info about certain dates – ancestor elements, &c; so, in short, I'd like to get a handle on the node for later retrieval.
Thanks, Perry Trolard
Dear Perry,
by chance, we have just readded an XQuery function "basex:node-id()", which returns the explicit id of a database node:
Request id from the specified database node: basex:node-id(node)
Open specific database node: basex:db(name, id)
As you correctly observed, we're internally using the document pre-order to reference nodes. As long as no updates are performed, pre and id values are the same. – You need to check out the latest version from our repository to use the function.
Christian
On Thu, Mar 25, 2010 at 7:40 PM, Perry Trolard ptrolard@artsci.wustl.edu wrote:
Dear List,
I wonder if there's a method in BaseX for getting a unique identifier for a node. If I had a document in memory & was using, say, Saxon, I'd call a method on the node to return its location as an XPath string, but using XQuery in BaseX, is there a "somefn" such that
for $d in $doc//date return <result path="{somefn($d}">{$d}</result>
would return <result path="/root/date[5]"><date when="2010-03-25"/></result> or some such?
I understand that nodes are identified internally in BaseX by their pre-order traversal index – is there a way get the pre number? If not directly from an XQuery function, perhaps in some of the Java client code?
My use case is that I'd like to return elements – <date>'s, e.g. – with info about their location in the document so that later & on-demand I can get more info about certain dates – ancestor elements, &c; so, in short, I'd like to get a handle on the node for later retrieval.
Thanks, Perry Trolard
___________________________
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen
Dear List,
Is there a way to know when a database has been last updated, i.e. the last time an XQuery Update statement was successfully executed? If so, at what level of granularity - database, document, &c.?
Thank you, Perry
Dear Perry,
the time stamp is updated every time an update is performed. You can use the "info db" command to look at this property, or look into the MetaData class.
Hope this helps, Christian ___________________________
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen
On Thu, Mar 25, 2010 at 9:19 PM, Perry Trolard ptrolard@artsci.wustl.edu wrote:
Dear List,
Is there a way to know when a database has been last updated, i.e. the last time an XQuery Update statement was successfully executed? If so, at what level of granularity - database, document, &c.?
Thank you, Perry
basex-talk@mailman.uni-konstanz.de