While I can certainly output the result to a file, and then add to a database, how would I actually send the result directly to a database?
xquery version "3.0";
<xml> { for $line in db:open("people.json")//text() return if (matches($line, "[0-9]")) then <data>{$line}</data> else <record>{$line}</record> } </xml>
Currently I'm running it like so:
thufir@dur:~/flwor/people.json$ thufir@dur:~/flwor/people.json$ basex all.xq > all.xml thufir@dur:~/flwor/people.json$ thufir@dur:~/flwor/people.json$ basex BaseX 9.0.1 [Standalone] Try 'help' to get more information.
create database people.all
Database 'people.all' created in 234.74 ms.
set parser xml
PARSER: xml
add all.xml
Resource(s) added in 377.43 ms.
exit
Have fun. thufir@dur:~/flwor/people.json$
but that's a bit cumbersome.
thanks,
Thufir