Hi, why is it not possible to rename a document in a database with an update XQuery? Thanks for helping out!
Regards, Thomas
Hi Thomas,
this is due to the specification - renaming documents inside collections or databases is out of scope: XQuery Update does not allow modifications outside the root node - and this is where actual document node, that contains the document name, resides.
I am sorry that at the moment we can not provide a command that does this for you. You could however delete and re-add that document.
Hope this helps for the moment.
Grüße aus Konstanz Michael
Am 20.04.2011 um 17:13 schrieb Thomas Kaltofen:
Hi, why is it not possible to rename a document in a database with an update XQuery? Thanks for helping out!
Regards, Thomas _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Michael,
thank you for the quick response. Is it planned to add a rename-document-command in the future? Deleting and re-adding is not really an option, because I cannot perform these two operations in one transaction.
Actually I was looking for this functionality because I have a big problem with an insert query which corrupts the whole database. I can easily reproduce the problem with the following steps, so I think it is a bug in BaseX:
1. Create database 'db' 2. Insert a document called 'doca' into 'db': ADD as 'doca' <...complex XML data...> 3. Insert a document called 'docb' into 'db': ADD as 'docb' <...complex XML data...> 4. Perform the following XQuery: insert node collection('db/docb')/somenode after collection('db/doca')/someothernode
The XQuery returns an error "[XQST0054] Circular variable definition?", although the query contains no variables. However, the query still adds parts of docb into doca and after the query the database is corrupt. With corrupt I mean that the GUI returns either an OutOfBounds exception or a StackOverflow exception or a NotExpected exception when re-opening the database. Which exception is thrown is random. With simple XML data in doca and docb (e.g. <a><b>test</b></a>) the steps work properly, however with my XML dataset it does not work. I can supply a sample dataset so you can reproduce the problem, but I would prefer to not post my dataset to the mailing list if possible.
Thanks for your help!
Grüße aus Österreich, Thomas
-----Original Message----- From: Michael Seiferle [mailto:michael.seiferle@uni-konstanz.de] Sent: Wednesday, April 20, 2011 6:22 PM To: thomas@kaltofen.at; Thomas Kaltofen Cc: basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Renaming of documents
Hi Thomas,
this is due to the specification - renaming documents inside collections or databases is out of scope: XQuery Update does not allow modifications outside the root node - and this is where actual document node, that contains the document name, resides.
I am sorry that at the moment we can not provide a command that does this for you. You could however delete and re-add that document.
Hope this helps for the moment.
Grüße aus Konstanz Michael
Am 20.04.2011 um 17:13 schrieb Thomas Kaltofen:
Hi, why is it not possible to rename a document in a database with an update XQuery? Thanks for helping out!
Regards, Thomas _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Thomas,
Am 21.04.2011 12:54, schrieb Thomas Kaltofen:
The XQuery returns an error "[XQST0054] Circular variable definition?", although the query contains no variables.
I think that's the standard error message for stack overflow errors, it should probably be reworded to say that more clearly.
However, the query still adds parts of docb into doca and after the query the database is corrupt. [...] With simple XML data in doca and docb (e.g. <a><b>test</b></a>) the steps work properly, however with my XML dataset it does not work.
That definitely sounds like a stack overflow in the middle of an update, which is a Bad Thing (TM)... I'll definitely look into that ASAP. A workaround until it's fixed would be to increase the JVM's stack size with *java -Xss1m*.
I can supply a sample dataset so you can reproduce the problem, but I would prefer to not post my dataset to the mailing list if possible.
Sample data would greatly simplify the debugging process. You can send it to support@basex.org, we will keep it confidential.
Danke schonmal und Grüße zurück vom Bodensee, Leo
basex-talk@mailman.uni-konstanz.de