BaseX generate-id()
Monday, 20 May 2013 · 4 messages · last reply 21 May 2013
CG
Hi James,
a node id generated via generate-id() is unique and the same during the runtime of a query. If you want to ensure that you are requesting the same nodes of a database, I recommend you to check out the node-id() and node-pre() functions of our database module [1].
Hope this helps,
Christian
[1] http://docs.basex.org/wiki/Database_Module
Quoted text · James Wright · 15 lines
On Mon, May 20, 2013 at 10:09 PM, James Wright <james.jw at hotmail.com> wrote: > In the W3C specs it says this method should generate the same ID for a node > regardless of when its called. Is this how it is implemented in BaseX or > does it simply generate a random number? My testing seems to implicate the > ladder. If it does generate the same ID for each node each time its run, > does it do ensure uniqueness at the db or resource level? > > Thx for your time. > - James > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Christian Grün20 May 2013 23:50 #
I’m not quite sure on what you were asking, but I noticed that the explanation of PRE and ID values in our Wiki was somewhat deficient. Please don‘t hesitate to have yet another look at the revised articles [1,2], which are hopefully more self-explanatory. If not, you are always invited to read the dissertation in more detail ;)
[1] http://docs.basex.org/wiki/Database_Module#db:open-pre
[2] http://docs.basex.org/wiki/Node_Storage
Quoted text · James Wright · 52 lines
On Mon, May 20, 2013 at 10:46 PM, James Wright <james.jw at hotmail.com> wrote: > How did I not notice this!! I have read through those modules so many times > now!! I think this is exactly what I was looking for. I expected there to be > some sort of persistent id because I skimmed the initial dissertation on > BaseX from several years ago and it talks about a persistent ID. In regards > to the 'pre' this ID represents the id of a node which 'hasn't' been > inserted yet but it does not necessarily denote the ID the node will take > when actually inserted... So whats the point? Is this more for internal > uses? Maybe I don't fully understand... > > Thanks for the quick reply! > > - James > >> From: christian.gruen at gmail.com >> Date: Mon, 20 May 2013 22:30:08 +0200 >> Subject: Re: [basex-talk] BaseX generate-id() >> To: james.jw at hotmail.com >> CC: basex-talk at mailman.uni-konstanz.de > >> >> Hi James, >> >> a node id generated via generate-id() is unique and the same during >> the runtime of a query. If you want to ensure that you are requesting >> the same nodes of a database, I recommend you to check out the >> node-id() and node-pre() functions of our database module [1]. >> >> Hope this helps, >> Christian >> >> [1] http://docs.basex.org/wiki/Database_Module >> ___________________________ >> >> On Mon, May 20, 2013 at 10:09 PM, James Wright <james.jw at hotmail.com> >> wrote: >> > In the W3C specs it says this method should generate the same ID for a >> > node >> > regardless of when its called. Is this how it is implemented in BaseX or >> > does it simply generate a random number? My testing seems to implicate >> > the >> > ladder. If it does generate the same ID for each node each time its run, >> > does it do ensure uniqueness at the db or resource level? >> > >> > Thx for your time. >> > - James >> > >> > _______________________________________________ >> > BaseX-Talk mailing list >> > BaseX-Talk at mailman.uni-konstanz.de >> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >
JW
James Wright21 May 2013 00:09 #
In the W3C specs it says this method should generate the same ID for a node regardless of when its called. Is this how it is implemented in BaseX or does it simply generate a random number? My testing seems to implicate the ladder. If it does generate the same ID for each node each time its run, does it do ensure uniqueness at the db or resource level? Thx for your time.- James
JW
Christian,
Thanks for the update. Speed was my thinking and it looks like what you updated the wiki to state...
Thanks again!
- James
Quoted text · Christian Grün · 67 lines
> From: christian.gruen at gmail.com > Date: Mon, 20 May 2013 23:50:18 +0200 > Subject: Re: [basex-talk] BaseX generate-id() > To: james.jw at hotmail.com; basex-talk at mailman.uni-konstanz.de > > I’m not quite sure on what you were asking, but I noticed that the > explanation of PRE and ID values in our Wiki was somewhat deficient. > Please don‘t hesitate to have yet another look at the revised articles > [1,2], which are hopefully more self-explanatory. If not, you are > always invited to read the dissertation in more detail ;) > > [1] http://docs.basex.org/wiki/Database_Module#db:open-pre > [2] http://docs.basex.org/wiki/Node_Storage > _______________________________ > > On Mon, May 20, 2013 at 10:46 PM, James Wright <james.jw at hotmail.com> wrote: > > How did I not notice this!! I have read through those modules so many times > > now!! I think this is exactly what I was looking for. I expected there to be > > some sort of persistent id because I skimmed the initial dissertation on > > BaseX from several years ago and it talks about a persistent ID. In regards > > to the 'pre' this ID represents the id of a node which 'hasn't' been > > inserted yet but it does not necessarily denote the ID the node will take > > when actually inserted... So whats the point? Is this more for internal > > uses? Maybe I don't fully understand... > > > > Thanks for the quick reply! > > > > - James > > > >> From: christian.gruen at gmail.com > >> Date: Mon, 20 May 2013 22:30:08 +0200 > >> Subject: Re: [basex-talk] BaseX generate-id() > >> To: james.jw at hotmail.com > >> CC: basex-talk at mailman.uni-konstanz.de > > > >> > >> Hi James, > >> > >> a node id generated via generate-id() is unique and the same during > >> the runtime of a query. If you want to ensure that you are requesting > >> the same nodes of a database, I recommend you to check out the > >> node-id() and node-pre() functions of our database module [1]. > >> > >> Hope this helps, > >> Christian > >> > >> [1] http://docs.basex.org/wiki/Database_Module > >> ___________________________ > >> > >> On Mon, May 20, 2013 at 10:09 PM, James Wright <james.jw at hotmail.com> > >> wrote: > >> > In the W3C specs it says this method should generate the same ID for a > >> > node > >> > regardless of when its called. Is this how it is implemented in BaseX or > >> > does it simply generate a random number? My testing seems to implicate > >> > the > >> > ladder. If it does generate the same ID for each node each time its run, > >> > does it do ensure uniqueness at the db or resource level? > >> > > >> > Thx for your time. > >> > - James > >> > > >> > _______________________________________________ > >> > BaseX-Talk mailing list > >> > BaseX-Talk at mailman.uni-konstanz.de > >> > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >> >
Written for BaseX 7.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery