BaseX 8.3.1, installed on Linux today from zip archive.
I have about 137,000 target elements, each having an average of 550 descendant elements, and each taking about 45k of space on disk. The target elements each have an @uuid value, and I'd like to extract each @uuid value and assign it a unique number from an incrementing sequence of integers. I'd like to be able to start the sequence at an arbitrary value.
I tried a recursive function I borrowed and modified from a StackOverflow post:
declare function local:loop($seq, $count) { if(empty($seq)) then () else let $prod := $seq[1], $count := $count + 1 return ( <result> <id>{$count}</id> <uuid>{data($prod)}</uuid> </result>, local:loop(tail($seq), $count) ) };
and calling it like so:
return <results>{ local:loop($pubs, 0) }</results>
where $prod is a sequence of all the @uuid attributes (not the values, and not the whole elements).
My query fails with the error: [bxerr:BASX0005] Stack Overflow: Try tail recursion?
I'm using -Xmx6g and -Xss4m as flags for Java in the basexgui script.
Is there some way to get BaseX to use tail recursion? Or is there another approach to doing what I want?
Many thanks, Chuck