Hi Christian, Thank you! I should not think of xquery:eval() as "parse this harmless XPath map". Hopefully I will remember this! (Is there a good/better/expected way to pass data around as XPath maps?) A job:eval version works. Much appreciated, Graydon On Thu, Feb 26, 2026, at 11:45, Christian Grün wrote:
Hi Graydon,
let $names as map(xs:string,map(xs:string,xs:string)) := file:read-text($namesMap) => xquery:eval()
The xquery:eval function causes a global lock as the dynamically evaluated code might do all kinds of things. I haven’t explored it further, but maybe you can simply replace it by job:execute() calls.
Best, Christian
*Von:* Graydon Saunders via BaseX-Talk <basex-talk@mailman.uni-konstanz.de> *Gesendet:* Donnerstag, 26. Februar 2026 04:49 *An:* BaseX <BaseX-Talk@mailman.uni-konstanz.de> *Betreff:* [basex-talk] job:execute and locks
Hello --
I'm on the 12.3 413f355 beta and using the BaseX GUI.
So this query runs forever in a way that makes me think I've got a locking problem:
declare namespace v2="https://schema.iccsafe.org/book/schema/1.0";
(: list of query names, in order; order is important here :) declare variable $queryNameList as xs:string+ := ('load-before-1.xq', 'load-after-2.xq','wordcount-3.xq'); (: job:execute wants URIs. We could use file:resolve-path here but minimalist relative URIs work :) declare variable $queryURIList as xs:anyURI+ := $queryNameList ! xs:anyURI(.);
(: the map with the file paths :) declare variable $namesMap as xs:string := '/home/graydon/work/tests/compare_map.xquery'; (: where reports should go :) declare variable $reportsDir as xs:string := '/home/graydon/work/tests/reports/';
(: try putting path pairs in an external map so we ought not have any db lock issues :) let $names as map(xs:string,map(xs:string,xs:string)) := file:read-text($namesMap) => xquery:eval()
return (: bindings to pass values to the queries we're about to run :) for key $k value $v in $names let $bindings as map(*) := {'reportsDir': $reportsDir, 'sourceName': $v?source, 'resultName': $v?result } return for $query in $queryURIList return job:execute($query,$bindings)
When I could get the information to set the values in $v?source and $v?result without having to use doc() to look inside files, this query's immediate ancestor worked.
The docs at https://docs.basex.org/main/Job_Functions#job:execute say "It is safe to use the function if the calling query does not lock anything."
Does having opened a document via doc() in another query in the GUI leave that document locked? If so, is there a way to drop those locks?
Am I locking something with this query?
(The "generate a bxs script" version (from the same map!) runs in about 45 seconds, so I think the queries being called via job:execute work.)
Thanks! Graydon