Hi!
Another thought: ADD doc.xml does neither throw an error nor actually replace a pre-existing doc.xml.
It would probably be nice if ADD intrinsically replaced a pre-existing document?
HP
Hi,
this is true, we are aware of this issue as again the standard leaves it to the implementation to deal with such cases.
For the moment it just adds another document to the database (thus making it a collection). As a workaround you could however delete the old document first and add it afterwards, but you probably thought of that yourself.
I guess for the moment you could also use XQuery Update to achieve this behaviour with replace() - perhaps Lukas has a quick snippet for you?
One might think of adding a `replace doc.xml with path/to/new/doc.xml` command to make the database behave as desired. Feedback/Thoughts on this issue are welcome.
Am 11.08.2010 um 11:09 schrieb Hans-Peter Oeri:
Hi!
Another thought: ADD doc.xml does neither throw an error nor actually replace a pre-existing doc.xml.
It would probably be nice if ADD intrinsically replaced a pre-existing document?
HP
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Hi Hans-Peter,
I guess for the moment you could also use XQuery Update to achieve this behaviour with replace() - perhaps Lukas has a quick snippet for you?
Unfortunately the replace expression in XQuery Update does not operate on document nodes [1].
Using delete/insert as a workaround won't help as well, as document nodes are to be replaced by their child elements during the update process [2]. As a result, you will loose the document information.
Sorry that I can't help you with this ...
Regards, Lukas
[1] http://www.w3.org/TR/xquery-update-10/#id-replacing-node
[2] http://www.w3.org/TR/xquery-update-10/#id-insert (section 1.) "If the insertion sequence contains a document node, the document node is replaced in the insertion sequence by its children."
Hi!
On 08/11/2010 11:19 AM, Michael Seiferle wrote:
One might think of adding a `replace doc.xml with path/to/new/doc.xml` command to make the database behave as desired. Feedback/Thoughts on this issue are welcome.
What I would prefer is a command that either adds (if non-existing) OR replaces (if pre-existing) a document. Sort of:
«Honey, I don't care if you already have doc.xml, but - as of now - please take this one»
It's kind of the same problem as it was with SQL... Neither INSERT nor UPDATE, but MERGE ;)
HP
Hi Hans-Peter,
Am 11.08.2010 um 13:02 schrieb Hans-Peter Oeri hp@oeri.ch:
Hi!
On 08/11/2010 11:19 AM, Michael Seiferle wrote:
One might think of adding a `replace doc.xml with path/to/new/doc.xml` command to make the database behave as desired. Feedback/Thoughts on this issue are welcome.
What I would prefer is a command that either adds (if non-existing) OR replaces (if pre-existing) a document. Sort of:
«Honey, I don't care if you already have doc.xml, but - as of now - please take this one»
It's kind of the same problem as it was with SQL... Neither INSERT nor UPDATE, but MERGE ;)
Yes, that variant sounds very useful - we will talk this over and I will inform you once we agreed on how to continue here. Thanks again for your input!
HP
Michael
basex-talk@mailman.uni-konstanz.de