load-xquery-module

Thursday, 11 September 2025 · 4 messages · last reply 11 Nov 2025
RS
Rob Stapper11 Sep 2025 17:24 #
Hi Christian, I'm experimenting with dynamic modul loading using: 'load-xquery-module'. I have a few questions concerning this function: - Does this function cache the loaded modul like "import module" does? If I interpret the profiling data correcty, it does not. If so is it possible to also cache dynamicly loaded modules? - "location-hints" of this function accepts a set of locations. It seems that all these locations must contain a module with the given modul-uri. I would expect the one would be sufficient. What is the idea behind this locationset? Thanx in advance for your response. mvgr. Rob Stapper
GR
Gunther Rademacher15 Sep 2025 11:45 #
Hi Rob, there is currently no caching for modules loaded via load-xquery-module, rather the module source is accessed with each invocation. However as the function is defined as "deterministic", it should guarantee within a single query execution to return the same results for the same parameters. Which it currently can't - thanks for pointing this out. We will take care of this to make sure that a module source is accessed only once per query execution. The multitude of "location-hints" mirrors the multitude of URILiterals following the "at" keyword of "import module". This is because a module is explicitly allowed to be split across multiple sources. So the behavior of "location-hints" is that of "import module": each source is expected to contain a part of the module. Best regards Gunther Gesendet: Donnerstag, 11. September 2025 um 17:24
Quoted text · Rob Stapper · 10 lines
Von: "Rob Stapper via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] load-xquery-module Hi Christian, I'm experimenting with dynamic modul loading using: 'load-xquery-module'. I have a few questions concerning this function: - Does this function cache the loaded modul like "import module" does? If I interpret the profiling data correcty, it does not. If so is it possible to also cache dynamicly loaded modules? - "location-hints" of this function accepts a set of locations. It seems that all these locations must contain a module with the given modul-uri. I would expect the one would be sufficient. What is the idea behind this locationset? Thanx in advance for your response. mvgr. Rob Stapper
CG
Christian Grün20 Oct 2025 12:17 #
Hi Rob, I have finally added an issue to support caching for load-xquery-module; we’ll see what we can do [1]. Best, Christian [1] https://github.com/BaseXdb/basex/issues/2516
Quoted text · Gunther Rademacher · 20 lines
Von: Gunther Rademacher via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> Gesendet: Montag, 15. September 2025 11:45 An: r.stapper at lijbrandt.nl <r.stapper at lijbrandt.nl>; basex-talk at mailman.uni-konstanz.de <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] Re: load-xquery-module Hi Rob, there is currently no caching for modules loaded via load-xquery-module, rather the module source is accessed with each invocation. However as the function is defined as "deterministic", it should guarantee within a single query execution to return the same results for the same parameters. Which it currently can't - thanks for pointing this out. We will take care of this to make sure that a module source is accessed only once per query execution. The multitude of "location-hints" mirrors the multitude of URILiterals following the "at" keyword of "import module". This is because a module is explicitly allowed to be split across multiple sources. So the behavior of "location-hints" is that of "import module": each source is expected to contain a part of the module. Best regards Gunther Gesendet: Donnerstag, 11. September 2025 um 17:24 Von: "Rob Stapper via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] load-xquery-module Hi Christian, I'm experimenting with dynamic modul loading using: 'load-xquery-module'. I have a few questions concerning this function: - Does this function cache the loaded modul like "import module" does? If I interpret the profiling data correcty, it does not. If so is it possible to also cache dynamicly loaded modules? - "location-hints" of this function accepts a set of locations. It seems that all these locations must contain a module with the given modul-uri. I would expect the one would be sufficient. What is the idea behind this locationset? Thanx in advance for your response. mvgr. Rob Stapper
CG
Christian Grünin reply to Gunther Rademacher, 15 Sep 2025, 11:4511 Nov 2025 13:03 #
Hi Rob, modules that are parsed with fn:load-xquery-modules and with the same (and a single) "location-hints" option are now cached and reused. An updated snapshot is available; your feedback is welcome [1]. Best, Christian [1] https://files.basex.org/releases/latest/
Quoted text · Rob Stapper · 10 lines
Von: "Rob Stapper via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] load-xquery-module Hi Christian, I'm experimenting with dynamic modul loading using: 'load-xquery-module'. I have a few questions concerning this function: - Does this function cache the loaded modul like "import module" does? If I interpret the profiling data correcty, it does not. If so is it possible to also cache dynamicly loaded modules? - "location-hints" of this function accepts a set of locations. It seems that all these locations must contain a module with the given modul-uri. I would expect the one would be sufficient. What is the idea behind this locationset? Thanx in advance for your response. mvgr. Rob Stapper

⚡Generated with XQuery