namespace prefix not declared basex

45 Views Asked by At

I'm trying to use a module that I have imported into Basex database engine. The module can be found here : https://git.unistra.fr/estrades/heimdall

I have done what they said to import the module in basex with the following command

REPO INSTALL https://estrades.pages.unistra.fr/heimdall/heimdall.xar

and then i opened basexgui.

Then I wrote my xQuery file like this :

let $doc := doc('zotero/zotero.xml')
let $result := heimdall:getDatabaseItems('db')
return $result

And I got this error message :

Namespace prefix not declared: heimdall

I suppose that I have to declare or import my module at the begining probably someway like this :

import module namespace heimdall = 'https://estrades.pages.unistra.fr/heimdall/heimdall.xar';

but it is not working.

I think I misunderstand the concept of declared modules. I don't see the meaning of calling my module in my xQuery file if I have imported it earlier directly in BaseX...

Someone could help me maybe ?

Thanks a lot

1

There are 1 best solutions below

0
Christian Grün On

You will indeed need to add an import statement for your module in the prolog of your query. However, the URI must match the namespace of your module, which you can look up in the expath-pkg.xml file or the haimdall.xqm module itself.

This should work:

import module namespace heimdall = 'http://estrades.huma-num.fr/heimdall';

let $doc := doc('zotero/zotero.xml')
let $result := heimdall:getDatabaseItems('db')
return $result