Dear Eliúd,
The syntax of method calls was changed in the 4.0 draft of the specification. The %method annotation was replaced by a "=?>" operator:
let $number := {
'value': 1,
'inc': fn { map:put(., 'value', ?value + 1) }
}
return $number =?> inc()
This is mostly syntactic sugar. In XQuery 3.1, the same code could have been written as:
let $number := map {
'value': 1,
'inc': function($map) { map:put($map, 'value', $map?value + 1) }
}
let $inc-function := $number?inc
return $inc-function($number)
The syntax of the newest version of BaseX is currently documented in the 13 branch of our Wiki [1,2]. Due to numerous changes in the spec, it is about time for a BaseX 13 release.
Hope this helps,
Christian
[1] https://docs.basex.org/main/XQuery_4.0#methods
[2] https://docs.basex.org/13/XQuery_4.0#methods
________________________________________
Von: Eliúd Santiago Meza y Rivera via BaseX-Talk <basex-talk@mailman.uni-konstanz.de>
Gesendet: Donnerstag, 26. März 2026 03:06
An: BaseX
Betreff: [basex-talk] Fwd: Re: [XQST0045] Annotation %method is in reserved namespace.
I tested you suggestions and it's works, the last one with little variation:
let $number := {
'value': 1,
'inc': fn { map:put(., 'value', .?value + 1) }
}
return $number=?>inc()
I was testing 'cause I need to use values objects.
Thanks!!!!!
---------- Forwarded message ---------
From: Martin Honnen via BaseX-Talk <basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Date: Wed, Mar 25, 2026 at 6:55 PM
Subject: [basex-talk] Re: [XQST0045] Annotation %method is in reserved namespace.
To: <basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
On 26/03/2026 01:12, Eliúd Santiago Meza y Rivera via BaseX-Talk wrote:
Hello,
I was testing the feature https://docs.basex.org/main/XQuery_4.0#methods, but the examples raise the error XQST0045
let $vector := {
'x': 5,
'y': 6,
'sum': %method fn() { ?x + ?y }
}
return $vector =?> sum()
In the fiddle the variation
let $vector := {
'x': 5,
'y': 6,
'sum': fn { ?x + ?y }
}
return $vector =?> sum()
works
let $number := {
'value': 1,
'inc': %method fn() { map:put(., 'value', ?value + 1) }
}
return $number?inc()
as does
let $number := {
'value': 1,
'inc': fn { map:put(., 'value', ?value + 1) }
}
return $number=?>inc()
Not sure about the state of the annotation %method
--
LSC Eliud Santiago Meza y Rivera