Marcus,
You can add documents to the database without first writing them to the file system[1]:
let $mydoc as element() := <root>My document</root> let $doUpdate := db:add(‘mydb’, $mydoc, ‘/somedir/mydoc.xml’)
This needs to be done in an updating function or module as a separate transaction.
If you’re looking for general code on managing sequences of transactions using BaseX’s jobs feature, I created this github project:
https://github.com/ekimbernow/basex-orchestration
At a minimum it demonstrates how to use BaseX jobs to manage updates in the context of a larger XQuery.
[1] https://docs.basex.org/wiki/Database_Module#db:add
Cheers,
E. _____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.comhttps://www.servicenow.com LinkedInhttps://www.linkedin.com/company/servicenow | Twitterhttps://twitter.com/servicenow | YouTubehttps://www.youtube.com/user/servicenowinc | Facebookhttps://www.facebook.com/servicenow
From: BaseX-Talk basex-talk-bounces@mailman.uni-konstanz.de on behalf of Markus Elfring Markus.Elfring@web.de Date: Tuesday, May 17, 2022 at 9:26 AM To: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de Subject: [basex-talk] Adding another document from XQuery evaluation [External Email]
Hello,
The software “BaseX” is providing direct support for file formats like “XML” and “CSV”. Corresponding data can be generated by customised XQuery scripts.
I got the impression that additional documents can be integrated into selected databases so far by specifying file names. Does this mean that data (which would be determined by a script evaluation) need to be exported into a file for a subsequent file import?
I imagine that another function combination for the available modules can make such an operation more convenient.
Regards, Markus