BaseX Gui import (Add) doesn't replace items
Hello France,
documents in BaseX can be added multiple times with the same path. You can take a look at the previous discussion here and for some explanation why it behaves like it does today: https://github.com/BaseXdb/basex/issues/429
If you want to replace a resource the simplest thing to do would be to use the db:replace function, see http://docs.basex.org/wiki/Database_Module#db:replace
Cheers, Dirk
Quoted text · France Baril · 45 lines
On 08/20/2013 10:13 PM, France Baril wrote: > Hi, > > Context: DB name A > Collection B > File C.xml with <p id="i1">Hello</p> > > In BaseX Gui, DB A is opened. > In the Properties window, browse to the file C.xml, say you want to add in > under B and click Add. > Repeat the operation (to replace C.xml, with a new update C.xml) > > In BaseX Gui, try: > for $x in /*[@id='i1'] > return $x > > You'll get this: > <p id="i1">Hello</p> > <p id="i1">Hello</p> > > If you try this: > for $x in /*[@id='i1'] > return $x/base-uri() > > You'll get > A/B/C.xml > A/B/C.xml > > Applying db:optimize won't change anything. > > Basically, it looks like the content of the file is appended to the > existing file. Expectation is that it should replace it. > > Side effect: When we open the file in XML Oxygen through WebDAV, the file > appears to be empty. > > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Hi,
Context: DB name A Collection B File C.xml with <p id="i1">Hello</p>
In BaseX Gui, DB A is opened. In the Properties window, browse to the file C.xml, say you want to add in under B and click Add. Repeat the operation (to replace C.xml, with a new update C.xml)
In BaseX Gui, try:
for $x in /*[@id='i1']
return $xYou'll get this:
<p id="i1">Hello</p>
<p id="i1">Hello</p>If you try this:
for $x in /*[@id='i1']
return $x/base-uri()You'll get A/B/C.xml A/B/C.xml
Applying db:optimize won't change anything.
Basically, it looks like the content of the file is appended to the existing file. Expectation is that it should replace it.
Side effect: When we open the file in XML Oxygen through WebDAV, the file appears to be empty.
Written for BaseX 7.7. BaseX may have changed since: please check the current documentation.