Problem with module-import via relative / absolute path (WEBPATH, REST-Interface)
Friday, 1 April 2016 · 7 messages · last reply 4 Apr 2016
GD
Günter Dunz-Wolff1 Apr 2016 12:26 #
Hi all,
in my queries I have to import module namespace, for example in the file test.xq something like import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm";
I'm calling the query via REST like
http://localhost/rest?run=xqs/test.xq
The webpath is configured like
# HTTP Services
WEBPATH = /Users/xxx/Documents/kleist/BaseXWeb
RESTPATH =
When I'm using the absolute path, everything works fine:
import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "file:///Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm";
When I'm using the relative path for importing the module namespace like import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; I'll get the following error:
"Could not retrieve module: /Users/modules/kleist-functions.xqm" The correct address should be: Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm
What's wrong in my configuration? Btw, I need the relative path for portability to my remote server.
Any help would be great, thanks a lot,
Best regards, GünterCG
Christian Grün1 Apr 2016 17:58 #
Hi Günter,
You may be generally better off moving all your modules to the repo directory. This way, there will be no need anymore to specify the module location. Did you already think about it?
Christian
Quoted text · Günter Dunz-Wolff · 28 lines
On Fri, Apr 1, 2016 at 12:26 PM, Günter Dunz-Wolff <kleist at mail.dunzwolff.de> wrote: > Hi all, > > in my queries I have to import module namespace, for example in the file test.xq something like > import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; > > I'm calling the query via REST like > http://localhost/rest?run=xqs/test.xq > > The webpath is configured like > # HTTP Services > WEBPATH = /Users/xxx/Documents/kleist/BaseXWeb > RESTPATH = > > When I'm using the absolute path, everything works fine: > import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "file:///Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm"; > > When I'm using the relative path for importing the module namespace like > import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; > I'll get the following error: > "Could not retrieve module: /Users/modules/kleist-functions.xqm" > The correct address should be: Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm > > What's wrong in my configuration? Btw, I need the relative path for portability to my remote server. > > Any help would be great, thanks a lot, > Best regards, Günter
K
kleist-digital1 Apr 2016 21:55 #
Hi Christian,
thanks for the tipp. I tried, but get the message "Module not found: http://kleist-digital.de/ns/kleist“
The working solution with absolute path is:
import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "file:///Users/gdunzwolff/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm“;
My RepoPath is:
REPOPATH = /Applications/basex/repo
The module is now in Applications/basex/repo and is called kleist-functions.xqm. In the module importing file the header is:
import module namespace kleist = "http://kleist-digital.de/ns/kleist“;
With http://localhost/rest?run=xqs/list_ba_flyer.xq I get
Module not found: http://kleist-digital.de/ns/kleist. There is no more ask for kleist-functions.xqm.
How do I have to name the module in repo, so that it will be found. Or do I have to change the import-statement?
GünterQuoted text · Christian Grün · 40 lines
> Am 01.04.2016 um 17:58 schrieb Christian Grün <christian.gruen at gmail.com>: > > Hi Günter, > > You may be generally better off moving all your modules to the repo > directory. This way, there will be no need anymore to specify the > module location. Did you already think about it? > > Christian > > > On Fri, Apr 1, 2016 at 12:26 PM, Günter Dunz-Wolff > <kleist at mail.dunzwolff.de> wrote: >> Hi all, >> >> in my queries I have to import module namespace, for example in the file test.xq something like >> import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; >> >> I'm calling the query via REST like >> http://localhost/rest?run=xqs/test.xq >> >> The webpath is configured like >> # HTTP Services >> WEBPATH = /Users/xxx/Documents/kleist/BaseXWeb >> RESTPATH = >> >> When I'm using the absolute path, everything works fine: >> import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "file:///Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm"; >> >> When I'm using the relative path for importing the module namespace like >> import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; >> I'll get the following error: >> "Could not retrieve module: /Users/modules/kleist-functions.xqm" >> The correct address should be: Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm >> >> What's wrong in my configuration? Btw, I need the relative path for portability to my remote server. >> >> Any help would be great, thanks a lot, >> Best regards, Günter >
AB
Andy Bunce1 Apr 2016 21:59 #
Ignoring the repo..
I can replicate this with the default config
If I create webapp/test.xq with just
static-base-uri()
then
/rest?rest?run=test.xq returns the expected
file:///C:/Program%20Files%20(x86)/BaseX/webapp/test.xq
If I change the module to
import module namespace df = 'ns' at "another.xqm";
static-base-uri()
Stopped at ., 2/1:
[XQST0059] Could not retrieve module: C:/Program Files
(x86)/basex/bin/another.xqm.
Suggesting it maybe resolving against the working directory?
/Andy
Quoted text · kleist-digital · 78 lines
On 1 April 2016 at 20:55, kleist-digital <kleist at mail.dunzwolff.de> wrote: > Hi Christian, > > thanks for the tipp. I tried, but get the message "Module not found: > http://kleist-digital.de/ns/kleist“ > > The working solution with absolute path is: > import module namespace kleist = "http://kleist-digital.de/ns/kleist" at > "file:///Users/gdunzwolff/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm“; > > My RepoPath is: > REPOPATH = /Applications/basex/repo > > The module is now in Applications/basex/repo and is called > kleist-functions.xqm. > In the module importing file the header is: > import module namespace kleist = "http://kleist-digital.de/ns/kleist“; > > With http://localhost/rest?run=xqs/list_ba_flyer.xq I get > Module not found: http://kleist-digital.de/ns/kleist. There is no more > ask for kleist-functions.xqm. > > How do I have to name the module in repo, so that it will be found. Or do > I have to change the import-statement? > > Günter > > > Am 01.04.2016 um 17:58 schrieb Christian Grün <christian.gruen at gmail.com > >: > > > > Hi Günter, > > > > You may be generally better off moving all your modules to the repo > > directory. This way, there will be no need anymore to specify the > > module location. Did you already think about it? > > > > Christian > > > > > > On Fri, Apr 1, 2016 at 12:26 PM, Günter Dunz-Wolff > > <kleist at mail.dunzwolff.de> wrote: > >> Hi all, > >> > >> in my queries I have to import module namespace, for example in the > file test.xq something like > >> import module namespace kleist = "http://kleist-digital.de/ns/kleist" > at "../modules/kleist-functions.xqm"; > >> > >> I'm calling the query via REST like > >> http://localhost/rest?run=xqs/test.xq > >> > >> The webpath is configured like > >> # HTTP Services > >> WEBPATH = /Users/xxx/Documents/kleist/BaseXWeb > >> RESTPATH = > >> > >> When I'm using the absolute path, everything works fine: > >> import module namespace kleist = "http://kleist-digital.de/ns/kleist" > at > "file:///Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm"; > >> > >> When I'm using the relative path for importing the module namespace like > >> import module namespace kleist = "http://kleist-digital.de/ns/kleist" > at "../modules/kleist-functions.xqm"; > >> I'll get the following error: > >> "Could not retrieve module: /Users/modules/kleist-functions.xqm" > >> The correct address should be: > Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm > >> > >> What's wrong in my configuration? Btw, I need the relative path for > portability to my remote server. > >> > >> Any help would be great, thanks a lot, > >> Best regards, Günter > > > > >
CG
Hi Günter,
You’ll have to move your module to the correct sub-directory [1]:
URL: http://kleist-digital.de/ns/kleist
File location: /Applications/basex/repo/de/kleist-digital/ns/kleist.xqm
Hope this helps
Christian
[1] http://docs.basex.org/wiki/Repository#URI_Rewriting
Quoted text · kleist-digital · 64 lines
On Fri, Apr 1, 2016 at 9:55 PM, kleist-digital <kleist at mail.dunzwolff.de> wrote: > Hi Christian, > > thanks for the tipp. I tried, but get the message "Module not found: http://kleist-digital.de/ns/kleist“ > > The working solution with absolute path is: > import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "file:///Users/gdunzwolff/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm“; > > My RepoPath is: > REPOPATH = /Applications/basex/repo > > The module is now in Applications/basex/repo and is called kleist-functions.xqm. > In the module importing file the header is: > import module namespace kleist = "http://kleist-digital.de/ns/kleist“; > > With http://localhost/rest?run=xqs/list_ba_flyer.xq I get > Module not found: http://kleist-digital.de/ns/kleist. There is no more ask for kleist-functions.xqm. > > How do I have to name the module in repo, so that it will be found. Or do I have to change the import-statement? > > Günter > >> Am 01.04.2016 um 17:58 schrieb Christian Grün <christian.gruen at gmail.com>: >> >> Hi Günter, >> >> You may be generally better off moving all your modules to the repo >> directory. This way, there will be no need anymore to specify the >> module location. Did you already think about it? >> >> Christian >> >> >> On Fri, Apr 1, 2016 at 12:26 PM, Günter Dunz-Wolff >> <kleist at mail.dunzwolff.de> wrote: >>> Hi all, >>> >>> in my queries I have to import module namespace, for example in the file test.xq something like >>> import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; >>> >>> I'm calling the query via REST like >>> http://localhost/rest?run=xqs/test.xq >>> >>> The webpath is configured like >>> # HTTP Services >>> WEBPATH = /Users/xxx/Documents/kleist/BaseXWeb >>> RESTPATH = >>> >>> When I'm using the absolute path, everything works fine: >>> import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "file:///Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm"; >>> >>> When I'm using the relative path for importing the module namespace like >>> import module namespace kleist = "http://kleist-digital.de/ns/kleist" at "../modules/kleist-functions.xqm"; >>> I'll get the following error: >>> "Could not retrieve module: /Users/modules/kleist-functions.xqm" >>> The correct address should be: Users/xxx/Documents/kleist/BaseXWeb/modules/kleist-functions.xqm >>> >>> What's wrong in my configuration? Btw, I need the relative path for portability to my remote server. >>> >>> Any help would be great, thanks a lot, >>> Best regards, Günter >> > >
K
kleist-digital2 Apr 2016 14:25 #
Hi all, hi Christian,
in BaseX-specific cases, the Oxygen XQuery-Validation doesn’t work based on the Saxon-Engine, for example
import module namespace kleist = "http://kleist-digital.de/ns/kleist“;
gives feedback: Failed to resolve URI of imported module: Cannot locate module for namespace http://kleist-digital.de/ns/kleist
Is there any way, to use the basex-XQuery-Parser inside of Oxygen?
Best regards,
Günter
CG
Christian Grün4 Apr 2016 18:49 #
Hi Günter,
feel free to have a look at the Argon project [1]. For basic oXygen integration, our Wiki page may be of interest as well [2].
Cheers,
Christian
[1] http://argon-author.com/
[2] http://docs.basex.org/wiki/Integrating_oXygen
Quoted text · kleist-digital · 15 lines
On Sat, Apr 2, 2016 at 2:25 PM, kleist-digital <kleist at mail.dunzwolff.de> wrote: > Hi all, hi Christian, > > in BaseX-specific cases, the Oxygen XQuery-Validation doesn’t work based on the Saxon-Engine, for example > > import module namespace kleist = "http://kleist-digital.de/ns/kleist“; > > gives feedback: Failed to resolve URI of imported module: Cannot locate module for namespace http://kleist-digital.de/ns/kleist > > Is there any way, to use the basex-XQuery-Parser inside of Oxygen? > > Best regards, > Günter > >
Written for BaseX 8.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery