I was trying to have a RESTXQ module import a library module stored in the configured REPO directory. I copied my module into that directory and verified that it was listed:
Name Version Type Path ----------------------------------------------------- basex-utils - Internal basex-utils.xqm dita-utils - Internal dita-utils.xqm linkmgmt-utils - Internal linkmgmt-utils.xqm relpath-utils - Internal relpath-utils.xqm
4 package(s).
Where I want to import the basex-utils module.
The docs say:
<lq> Repository modules are stored in a directory named BaseXRepo or repo, which resides in your home directory http://docs.basex.org/wiki/Configuration#Home_Directory. XQuery modules can be manually copied to the repository directory or installed and deleted via commands http://docs.basex.org/wiki/Repository#Commands.
If a modules is placed in the repository, there is no need to specify a location. </lq>
However, this import failed to find the module:
import module namespace bxutil="http://dita-for-small-teams.org/xquery/modules/basex-utils";
But, after I did an explicit REPO INSTALL on the module, BaseX put it in a directory that mirrors the namespace URL structure. At that point the import succeeded.
Thus, it appears that the module needs to be installed or otherwise stored in a directory that mirrors the namespace declaration--it is not sufficient to simply copy the module into the repo directory.
I think this assumption that the namespace URI will be a URL is not valid. If I create a module that uses a URN for the namespace URI, I get this failure on REPO INSTALL:
[bxerr:BXRE0002] URI is invalid or has no path component: 'urn:names:xquerymodule:testurn'.
In the case of URNs, the token separator is ":", so you could treat each token as a directory name.
Cheers,
Eliot