bug in import statement
Saturday, 5 September 2026 · 2 messages · last reply 7 Sep 2026
RS
Rob Stapper5 Sep 2026 09:47 #
Hi,
I stumbled upon this bug when importing modules:
When declaring a module ( without the at-clause) capitals in the module-URI are ignored in relation to its filename, under Windows anyway. Modulename and -URI can be differently capitalized. However, this results in duplicate declaration errors in case of cyclic-imports. There seems to be a inconsistency in the capitalization check somewhere. Module 3 is the culprit here: filename has lower case 'm' while URI in the module has upper case 'M'. The resulting error-message is also pretty vague: it tells you there are duplicate declarations but no why.
I'm aware of the situation now but for those who are not the situation can be pretty challenging. Hope it is an easy fix.
Module 1: <repo/test/Module1.xqm>
========
module namespace m1 = "test.Module1";
import module namespace m2 = "test.Module2";
import module namespace m3 = "test.Module3";
declare variable $m1:test := "" ;
Module 2: <repo/test/Module2.xqm>
========
module namespace m2 = "test.Module2";
import module namespace m1 = "test.Module1";
declare variable $m2:test := "" ;
Module 3: <repo/test/module3.xqm>
========
module namespace m3 = "test.Module3";
import module namespace m1 = "test.Module1";
declare variable $m3:test := "" ; (: error due to capital mismatch in modulename: 'module3.xqm', instead of: 'Module3.xqm' :)mvgr.
Rob Stapper
CG
Christian Grün7 Sep 2026 10:59 #
Hi Rob,
Thanks for the pointer. The problem has been fixed in the latest snapshot [1,2].
Best,
Christian
[1] https://github.com/BaseXdb/basex/commit/46be01127f6e80b88e9a86ae3a7e677c43615d22 [2] https://files.basex.org/releases/latest/
Quoted text · Rob Stapper · 27 lines
Von: Rob Stapper via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> Gesendet: Samstag, 5. September 2026 09:47 An: basex-talk at mailman.uni-konstanz.de Betreff: [basex-talk] bug in import statement Hi, I stumbled upon this bug when importing modules: When declaring a module ( without the at-clause) capitals in the module-URI are ignored in relation to its filename, under Windows anyway. Modulename and -URI can be differently capitalized. However, this results in duplicate declaration errors in case of cyclic-imports. There seems to be a inconsistency in the capitalization check somewhere. Module 3 is the culprit here: filename has lower case 'm' while URI in the module has upper case 'M'. The resulting error-message is also pretty vague: it tells you there are duplicate declarations but no why. I'm aware of the situation now but for those who are not the situation can be pretty challenging. Hope it is an easy fix. Module 1: <repo/test/Module1.xqm> ======== module namespace m1 = "test.Module1"; import module namespace m2 = "test.Module2"; import module namespace m3 = "test.Module3"; declare variable $m1:test := "" ; Module 2: <repo/test/Module2.xqm> ======== module namespace m2 = "test.Module2"; import module namespace m1 = "test.Module1"; declare variable $m2:test := "" ; Module 3: <repo/test/module3.xqm> ======== module namespace m3 = "test.Module3"; import module namespace m1 = "test.Module1"; declare variable $m3:test := "" ; (: error due to capital mismatch in modulename: 'module3.xqm', instead of: 'Module3.xqm' :) mvgr. Rob Stapper
Written for BaseX 12.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery