Hi Christian,
Thank you for your reply, you always help me.
- Can you share the query with us?. Yes, of course.
The query is pretty much the same that I've sent to Fabrice:
(# db:copynode false #) {
for $case in doc('file_A.xml')/trademark-applications-daily/application-information/file-segments/action-keys/case-file[case-file-header/status-code=(410,413,616,620,624,625,630,631,638,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,663,664,665,666,667,668,672,680,681,682,686,688,689,690,692,693,694,700,701,702,703,704,705,706,707,708,717,718,719,720,721,722,724,725,730,731,732,733,734,739,740,744,745,746,748,752,753,756,757,760,762,763,764,765,766,771,772,773,774,775,777,778,779,780,790,794,800,801,802,803,804,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,969,973)]
return insert node $case as last into doc("US")
}
And you're totally right about the security concerns: I don't offer to anyone the access to the RESTXQ endpoint, it's only for me but from another app ( on this case an Azure Web job instance ).
It's easy for me to do some maintenance tasks from a C# app, using the RESTXQ, instead of directly on some BaseX GUI.
At the beginning I tried to do this:
let $path:="A:\sources\xml\"
let $files:=
let $parts:=("US00","US01")
for $part in $parts
let $dir:= $path || $part
for $file in file:list($dir)
return $path || $part || "\" || $file
return
(# db:copynode false #) {
for $file in $files
for $case in doc($file)/trademark-applications-daily/application-information/file-segments/action-keys/case-file[case-file-header/status-code=(410,413,616,620,624,625,630,631,638,640,641,642,643,644,645,646,647,648,649,650,651,652,653,654,655,656,657,658,659,660,661,663,664,665,666,667,668,672,680,681,682,686,688,689,690,692,693,694,700,701,702,703,704,705,706,707,708,717,718,719,720,721,722,724,725,730,731,732,733,734,739,740,744,745,746,748,752,753,756,757,760,762,763,764,765,766,771,772,773,774,775,777,778,779,780,790,794,800,801,802,803,804,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823,824,825,969,973)]
return insert node $case as last into doc("US")
}
And, of course, this ran out of memory in a matter of seconds. ( there are more than 100 files )
So, I thought:
- "Maybe, if I execute each of them using the RESTXQ the memory will be released after each execution..."
But seems I'm still missing something because the result is the same. But, at least, I can finish the process restarting the HTTP server when it fails.
I've uploaded two of the XML files in case you want to test something with them.[1]
Por supuesto que ayuda!
Regards,
Sebastian.