On Mon, Nov 28, 2022 at 11:13:39AM +0100, Christian Grün scripsit:
Hi Graydon,
Hello Christian --
What I want is something similar to transform() but for a main query module, so I'm going to call it query().
Did you have a look at xquery:eval? [1] It allows you to supply a query as string or URI and pass on a context or variables:
Having got it wedged in my head that xquery:eval was for XPath expressions, I did not!
Having looked at it now, that looks like it will do what I want.
Thank you!
fn:load-xquery-module($module-uri as xs:string, $options as map(*)) as
map(*)
The function is not available in BaseX, but inspect:functions works similarly [2]: The functions of the module at the specified URI will be returned as a sequence (back then when the function was added, maps were not available yet).
Thank you!
That's interesting but not directly applicable to my use case, so I'm happier to know I understood the intent of fn:load-xquery-module.
If you have read-only and updating queries, Eliot’s approach of chaining queries is definitely worth looking at.
It's entirely interesting but (I think now) heavier than I need (since individually loading the files suffices at present) and it'd be a tough sell into the local production environment on maturity grounds. (I have used up all my "it's new but interesting!" on ixml.)
Thank you!