Hi Bryan,
I'm glad to tell I've updated the db:add() function; it now automatically detects and adopts original database document paths. Feel free to check out the latest stable snapshot [1].
Christian
[1] http://files.basex.org/releases/latest/ ___________________________
On Fri, Oct 26, 2012 at 1:22 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Bryan,
I noticed I overlooked an important detail in your query: there was no indication of how the target document should be called. The following query should work:
for $doc in db:open('AFGDOK') let $name := $doc/*/name() let $target := replace(base-uri($doc), '.*?/', '') return db:add($name, $doc, $target)
In the existing example, we have a document name, which is encoded in the base uri; but there are many examples in which no document name exists; e.g.:
db:add('db', document { <a/> }, 'name.xml")
However, I'll think about implicitly assigning the original document name if it exists. If this works out, the former query will work in future, too.
I never actually put a document in there, but it says it has a document, is that normal? I figured probably like there is some sort of hidden metadata document in every db?
Correct! This hidden document has been removed in the latest 7.5 snapshots [1].
Hope this helps, Christian