So maybe the better question is:
How best to manage deployment of XQuery modules and top-level scripts from a source environment to a running remote server so that using scripts can import modules using just the module namespace?
In my old DITA for Small Teams link manager application I was copying files into the BaseX repo location and then baking it into a Docker container.
But for my current application we have a remote VM acting as a server, so I was looking to use XAR as a way to remotely install my application code to the running server as our internal infrastructure makes copying files directly to the server punishingly difficult.
Thus my focus on using an EXPath package.
For my immediate purposes I can update my build process to make separate XAR files for each library (I’m using an Ant script to make the packages and then install them to BaseX).
I looked quickly at the code for EXPath package processing but I didn’t spent much time in it, but it probably wouldn’t be too hard to enhance it to behave as I expected. I could possibly pursue that if anyone else would use it.
Cheers,
E.
_____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.comhttps://www.servicenow.com LinkedInhttps://www.linkedin.com/company/servicenow | Twitterhttps://twitter.com/servicenow | YouTubehttps://www.youtube.com/user/servicenowinc | Facebookhttps://www.facebook.com/servicenow
From: Christian Grün christian.gruen@gmail.com Date: Monday, January 24, 2022 at 9:12 AM To: Eliot Kimber eliot.kimber@servicenow.com, BaseX basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Unable to Make My Custom EXPath Module Work [External Email]
I guess you’re right.
We haven’t revised EXPath packaging for a long time now. Actually, I’m not sure how many people use it at all ;) Anyone out there?
On Mon, Jan 24, 2022 at 4:08 PM Eliot Kimber eliot.kimber@servicenow.com wrote:
I did confirm that if the package @name URI matches the URI of a module, then the module is resolved, i.e.:
<package xmlns="https://urldefense.com/v3/__http://expath.org/ns/pkg__;!!N4vogdjhuJM!X1Svs1NMbhha-Yl2b5x5PNQfgZ-8EXu16wMMrk9avEmbi5ZqNoJAAROi9eg1OHdTuFt6qA$ " name="http://servicenow.com/xquery/module/now-dita-utils" abbrev="now-xquery" version="0.1" spec="1.0">
<title>XQuery modules for ServiceNow Product Content processing and support</title> <xquery> <namespace>http://servicenow.com/xquery/module/database-from-git</namespace> <file>database-from-git.xqm</file> </xquery>
…
</package>
That implies that each module needs to be in a separate XAR file in order to also be in a separate namespace.
I don’t think that is consistent with the EXPath packaging spec.
In the description of the XQuery entry it says:
An XQuery library module is referenced by its namespace URI. Thus the xquery element associates a namespace URI to an XQuery file. An importing module just need to use an import statement of the form import module namespace xx = "<namespace-uri>";. An XQuery main module is associated a public URI. Usually an XQuery package will provide functions through library modules, but in some cases one can want to provide main modules as well. This implies to me that the value of the <namespace> element in the <xquery> is what should be used to resolve the package reference, not the package’s @name value, which simply serves to identify the package.
Is my analysis correct or have I misunderstood the package mechanism?
Cheers, E.