Thanks - this fixed my update problem.

One more question ... how do I run a query that is in a file and write the results back to a different file?  The last line in this script does not produce output:

DROP DB oshb-morphology

CREATE DB oshb-morphology

ADD ./morphhb/wlc

SET WRITEBACK true

RUN ./xquery/merge-proper-nouns-oshb.xq

EXPORT ./out

XQUERY ./xquery/mappings.xq


It's not a problem with databases that are not open, I open databases explicitly in mappings.xq, e.g.  db:open("oshb-morphology") and the same query works fine from the GUI with no databases explicitly opened.


Jonathan


On Tue, Jun 29, 2021 at 4:48 AM Christian Grün <christian.gruen@gmail.com> wrote:
Hi Jonathan,

> ...
> XQUERY ./xquery/merge-proper-nouns-oshb.xq

I don’t have access to the query file you want to evaluate, but I
assume your command script should work if you replace XQUERY with the
RUN command [1].

You can skip the WRITEBACK option if you perform updates on database.
It is only required to update local files [2]:

XQUERY file:write(file:base-dir() || 'example.xml', <a/>)
SET WRITEBACK true
XQUERY insert node <b/> into doc('example.xml')/*
XQUERY doc('example.xml')

Hope this helps,
Christian

[1] https://docs.basex.org/wiki/Commands#RUN
[2] https://docs.basex.org/wiki/Options#WRITEBACK