command ADD does nothing on existing file?

Wednesday, 11 August 2010 · 5 messages
HO
Hans-Peter Oeri11 Aug 2010 11:09 #
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
MS
Michael Seiferle11 Aug 2010 11:19 #
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.
Quoted text · Hans-Peter Oeri · 16 lines
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 at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
LK
Lukas Kircher11 Aug 2010 11:58 #
Hi Hans-Peter,
Quoted text · Michael Seiferle · 3 lines
> 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."
HO
Hans-Peter Oeriin reply to Michael Seiferle, 11 Aug 2010, 11:1911 Aug 2010 13:02 #
Hi!
Quoted text · Michael Seiferle · 3 lines
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
MS
Michael Seiferle11 Aug 2010 14:58 #
Hi Hans-Peter,
Quoted text · Hans-Peter Oeri · 14 lines
Am 11.08.2010 um 13:02 schrieb Hans-Peter Oeri <hp at 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!
Quoted text · Hans-Peter Oeri · 2 lines
> > HP
Michael

⚡Generated with XQuery