Search code examples
marklogicmarklogic-8

import XQuery module from parent directory


I am working on a CPF Action module. I have an import that looks like:

import module namespace adu = "http://ir.abbvie.com/marklogic/authorization/lib/document-util"
  at "../document-util.xqy";

Do relative paths work here? In my CPF trace in the properties of the loaded document, I see that is is trying to load /document-util.xqy, instead of just going up to the parent directory.

XDMP-MODNOTFOUND: (err:XQST0059) Module /document-util.xqy not found

Do I need to put all my modules in order for this to work? I have these loaded in the modules db, and not in the filesystem. These are intended to be library modules that someone can add to their internal project, so I would like to use relative paths rather than fully qualified paths due to not knowing what the full path is going to be. Which might be different from project to project.


Solution

  • I resolved this by changing the root setting on the Pipeline Domain to point to the parent directory. Then in the pipeline config XML, I just refer to the action module using a relative sub-directory, like cpf/apply-permissions.xqy. And in that module, I have no issues referring to parent modules via '../module.xqy'.