Error parsing query, related to qualified name of function

Tuesday, 26 May 2026 · 5 messages · last reply 28 May 2026
AG
Amanda Galtman26 May 2026 15:26 #
Hi, BaseX team. An XSpec user found an error when running a particular test with BaseX. I reproduced the error in its original form, and I also shrunk the reproduction steps to obtain a similar error. The small, self-contained reproduction steps in BaseX 12.2, 12.3, or BaseX124-20260521.170507 are:
xquery version "3.1";
declare namespace pfx = "some-uri";
declare function pfx:namespace-node() { 'some result' };
declare function pfx:my-fcn() { Q{some-uri}namespace-node() };
pfx:my-fcn()
Error message: [XPST0003] Expecting '}', found '('. It points to the end of the qualified function name Q{some-uri}namespace-node. The error does not occur if I call the function using a prefix pfx:namespace-node() or if I change the function's local name. The original reproduction steps are in https://github.com/xspec/xspec/issues/2354 . In that context, the error does not occur if I change the function's local name in both the XQuery module being tested and the XSpec test file. Thanks, Amanda
GR
Gunther Rademacher26 May 2026 22:03 #
Hi Amanda, thank you for the concise reproduction. This is triggered by BaseX's handling of the "reserved-function-names" grammar constraint. `namespace-node` is one of the reserved function names, and the spec [1] says that such names are not allowed as an "unprefixed function name". The open question is whether an `EQName` written as a `URIQualifiedName`, such as `Q{some-uri}namespace-node`, should count as "unprefixed" for this constraint. It has no namespace prefix, but it is also not the ambiguous form `namespace-node()`, since the `Q{...}` syntax unambiguously identifies it as a function call, not a node kind test. We are currently clarifying the intended interpretation of the spec and will decide how to proceed from there. For now, using a namespace prefix is the best workaround. Best regards, Gunther [1] https://qt4cg.org/specifications/xquery-40/xquery-40.html#parse-note-reserved-function-names Gesendet: Dienstag, 26. Mai 2026 um 15:26
Quoted text · Amanda Galtman · 17 lines
Von: "Amanda Galtman via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] Error parsing query, related to qualified name of function Hi, BaseX team. An XSpec user found an error when running a particular test with BaseX. I reproduced the error in its original form, and I also shrunk the reproduction steps to obtain a similar error. The small, self-contained reproduction steps in BaseX 12.2, 12.3, or BaseX124-20260521.170507 are: xquery version "3.1"; declare namespace pfx = "some-uri"; declare function pfx:namespace-node() { 'some result' }; declare function pfx:my-fcn() { Q{some-uri}namespace-node() }; pfx:my-fcn() Error message: [XPST0003] Expecting '}', found '('. It points to the end of the qualified function name Q{some-uri}namespace-node. The error does not occur if I call the function using a prefix pfx:namespace-node() or if I change the function's local name. The original reproduction steps are in https://github.com/xspec/xspec/issues/2354 . In that context, the error does not occur if I change the function's local name in both the XQuery module being tested and the XSpec test file. Thanks, Amanda
AG
Amanda Galtman26 May 2026 23:00 #
Gunther, Thank you for explaining what is going on! As a bit of extra background on the original reproduction steps, in case it informs the clarification discussion: when XSpec compiles a test document (which is in XML format) into an XQuery query, XSpec produces a lot of URI-qualified names. They avoid collisions or incorrect names, if a test author used a prefix to mean different things in different parts of the XML tree of the test document. I am interested in finding out about the eventual resolution of this matter in the spec. Is there a GitHub issue number that I can keep an eye on? Best regards, Amanda
Quoted text · Gunther Rademacher · 40 lines
On Tuesday, May 26th, 2026 at 4:03 PM, Gunther Rademacher <grd at gmx.net> wrote: > Hi Amanda, > thank you for the concise reproduction. > > This is triggered by BaseX's handling of the "reserved-function-names" grammar constraint. `namespace-node` is one of the reserved function names, and the spec [1] says that such names are not allowed as an "unprefixed function name". > > The open question is whether an `EQName` written as a `URIQualifiedName`, such as `Q{some-uri}namespace-node`, should count as "unprefixed" for this constraint. It has no namespace prefix, but it is also not the ambiguous form `namespace-node()`, since the `Q{...}` syntax unambiguously identifies it as a function call, not a node kind test. > > We are currently clarifying the intended interpretation of the spec and will decide how to proceed from there. For now, using a namespace prefix is the best workaround. > > Best regards, > Gunther > > [1] https://qt4cg.org/specifications/xquery-40/xquery-40.html#parse-note-reserved-function-names > > Gesendet: Dienstag, 26. Mai 2026 um 15:26 > Von: "Amanda Galtman via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> > An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > Betreff: [basex-talk] Error parsing query, related to qualified name of function > Hi, BaseX team. > > An XSpec user found an error when running a particular test with BaseX. I reproduced the error in its original form, and I also shrunk the reproduction steps to obtain a similar error. > > The small, self-contained reproduction steps in BaseX 12.2, 12.3, or BaseX124-20260521.170507 are: > > xquery version "3.1"; > declare namespace pfx = "some-uri"; > declare function pfx:namespace-node() { 'some result' }; > declare function pfx:my-fcn() { Q{some-uri}namespace-node() }; > pfx:my-fcn() > > Error message: [XPST0003] Expecting '}', found '('. > It points to the end of the qualified function name Q{some-uri}namespace-node. > > The error does not occur if I call the function using a prefix pfx:namespace-node() or if I change the function's local name. > > The original reproduction steps are in https://github.com/xspec/xspec/issues/2354 . In that context, the error does not occur if I change the function's local name in both the XQuery module being tested and the XSpec test file. > > Thanks, > Amanda
GR
Gunther Rademacher27 May 2026 18:43 #
Hi Amanda, we have come to the opinion that the reserved-function-names constraint is not intended to apply to a `URIQualifiedName`, so I have suggested getting this clarified in the specification in qt4cg/qtspecs #2590 [1]. Meanwhile the latest BaseX snapshot [2] already implements this. Best regards, Gunther [1] https://github.com/qt4cg/qtspecs/issues/2590#issuecomment-4556309009 [2] https://files.basex.org/releases/latest/ Gesendet: Dienstag, 26. Mai 2026 um 23:00
Quoted text · Amanda Galtman · 96 lines
Von: "Amanda Galtman" <galtmana at proton.me> An: "Gunther Rademacher" <grd at gmx.net> CC: basex-talk at mailman.uni-konstanz.de Betreff: Re: [basex-talk] Error parsing query, related to qualified name of function Gunther, Thank you for explaining what is going on! As a bit of extra background on the original reproduction steps, in case it informs the clarification discussion: when XSpec compiles a test document (which is in XML format) into an XQuery query, XSpec produces a lot of URI-qualified names. They avoid collisions or incorrect names, if a test author used a prefix to mean different things in different parts of the XML tree of the test document. I am interested in finding out about the eventual resolution of this matter in the spec. Is there a GitHub issue number that I can keep an eye on? Best regards, Amanda On Tuesday, May 26th, 2026 at 4:03 PM, Gunther Rademacher <grd at gmx.net> wrote: > Hi Amanda, > > > > thank you for the concise reproduction. > > > This is triggered by BaseX's handling of the "reserved-function-names" grammar constraint. `namespace-node` is one of the reserved function names, and the spec [1] says that such names are not allowed as an "unprefixed function name". > > > The open question is whether an `EQName` written as a `URIQualifiedName`, such as `Q{some-uri}namespace-node`, should count as "unprefixed" for this constraint. It has no namespace prefix, but it is also not the ambiguous form `namespace-node()`, since the `Q{...}` syntax unambiguously identifies it as a function call, not a node kind test. > > > We are currently clarifying the intended interpretation of the spec and will decide how to proceed from there. For now, using a namespace prefix is the best workaround. > > > Best regards, > Gunther > > > [1] https://qt4cg.org/specifications/xquery-40/xquery-40.html#parse-note-reserved-function-names > > > > > > > > Gesendet: Dienstag, 26. Mai 2026 um 15:26 > > Von: "Amanda Galtman via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> > > An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> > > Betreff: [basex-talk] Error parsing query, related to qualified name of function > > > > Hi, BaseX team. > > > > An XSpec user found an error when running a particular test with BaseX. I reproduced the error in its original form, and I also shrunk the reproduction steps to obtain a similar error. > > > > > The small, self-contained reproduction steps in BaseX 12.2, 12.3, or BaseX124-20260521.170507 are: > > > > xquery version "3.1"; > declare namespace pfx = "some-uri"; > > declare function pfx:namespace-node() { 'some result' }; > > declare function pfx:my-fcn() { Q{some-uri}namespace-node() }; > > pfx:my-fcn() > > > > > > Error message: [XPST0003] Expecting '}', found '('. > > It points to the end of the qualified function name Q{some-uri}namespace-node. > > > > The error does not occur if I call the function using a prefix pfx:namespace-node() or if I change the function's local name. > > > > The original reproduction steps are in https://github.com/xspec/xspec/issues/2354 . In that context, the error does not occur if I change the function's local name in both the XQuery module being tested and the XSpec test file. > > > > Thanks, > > Amanda > > > >
AG
Amanda Galtman28 May 2026 15:02 #
Gunther, Perfect. Thank you. I confirmed that the latest BaseX snapshot (dated yesterday) successfully executes the query from the original XSpec situation where the error had come up. Best regards, Amanda
Quoted text · Gunther Rademacher · 68 lines
On Wednesday, May 27th, 2026 at 12:44 PM, Gunther Rademacher via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> wrote: > Hi Amanda, > > we have come to the opinion that the reserved-function-names constraint is not intended to apply to a `URIQualifiedName`, so I have suggested getting this clarified in the specification in qt4cg/qtspecs #2590 [1]. Meanwhile the latest BaseX snapshot [2] already implements this. > > Best regards, > Gunther > > [1] https://github.com/qt4cg/qtspecs/issues/2590#issuecomment-4556309009 > [2] https://files.basex.org/releases/latest/ > > Gesendet: Dienstag, 26. Mai 2026 um 23:00 > Von: "Amanda Galtman" <galtmana at proton.me> > An: "Gunther Rademacher" <grd at gmx.net> > CC: basex-talk at mailman.uni-konstanz.de > Betreff: Re: [basex-talk] Error parsing query, related to qualified name of function > Gunther, > > Thank you for explaining what is going on! > > As a bit of extra background on the original reproduction steps, in case it informs the clarification discussion: when XSpec compiles a test document (which is in XML format) into an XQuery query, XSpec produces a lot of URI-qualified names. They avoid collisions or incorrect names, if a test author used a prefix to mean different things in different parts of the XML tree of the test document. > > I am interested in finding out about the eventual resolution of this matter in the spec. Is there a GitHub issue number that I can keep an eye on? > > Best regards, > Amanda > > On Tuesday, May 26th, 2026 at 4:03 PM, Gunther Rademacher <grd at gmx.net> wrote: > >> Hi Amanda, >> thank you for the concise reproduction. >> >> This is triggered by BaseX's handling of the "reserved-function-names" grammar constraint. `namespace-node` is one of the reserved function names, and the spec [1] says that such names are not allowed as an "unprefixed function name". >> >> The open question is whether an `EQName` written as a `URIQualifiedName`, such as `Q{some-uri}namespace-node`, should count as "unprefixed" for this constraint. It has no namespace prefix, but it is also not the ambiguous form `namespace-node()`, since the `Q{...}` syntax unambiguously identifies it as a function call, not a node kind test. >> >> We are currently clarifying the intended interpretation of the spec and will decide how to proceed from there. For now, using a namespace prefix is the best workaround. >> >> Best regards, >> Gunther >> >> [1] https://qt4cg.org/specifications/xquery-40/xquery-40.html#parse-note-reserved-function-names >> >> Gesendet: Dienstag, 26. Mai 2026 um 15:26 >> Von: "Amanda Galtman via BaseX-Talk" <basex-talk at mailman.uni-konstanz.de> >> An: "basex-talk at mailman.uni-konstanz.de" <basex-talk at mailman.uni-konstanz.de> >> Betreff: [basex-talk] Error parsing query, related to qualified name of function >> Hi, BaseX team. >> >> An XSpec user found an error when running a particular test with BaseX. I reproduced the error in its original form, and I also shrunk the reproduction steps to obtain a similar error. >> >> The small, self-contained reproduction steps in BaseX 12.2, 12.3, or BaseX124-20260521.170507 are: >> >> xquery version "3.1"; >> declare namespace pfx = "some-uri"; >> declare function pfx:namespace-node() { 'some result' }; >> declare function pfx:my-fcn() { Q{some-uri}namespace-node() }; >> pfx:my-fcn() >> >> Error message: [XPST0003] Expecting '}', found '('. >> It points to the end of the qualified function name Q{some-uri}namespace-node. >> >> The error does not occur if I call the function using a prefix pfx:namespace-node() or if I change the function's local name. >> >> The original reproduction steps are in https://github.com/xspec/xspec/issues/2354 . In that context, the error does not occur if I change the function's local name in both the XQuery module being tested and the XSpec test file. >> >> Thanks, >> Amanda

⚡Generated with XQuery