Dear BaseX people, I cannot use copy/modify/return in order to add a namespacing: let $doc := <doc><a/></doc>return copy $doc_ := $doc modify insert node namespace xyz {'https://basex.org/ns%27%7D into $doc_ return $doc_ =><doc> <a/></doc> Is this a bug? Kind regards,Hans-Jürgen
Hi Hans-Jürgen,
The insertion of namespace nodes has not been defined in the XQuery Update spec. You may need choose the classic element constructor for that:
let $doc := <doc><a/></doc> return element { node-name($doc) } { $doc/@*, namespace xyz { 'https://basex.org/ns' }, $doc/node() }
Hope this helps, Christian ________________________________ Von: Hans-Juergen Rennau via BaseX-Talk basex-talk@mailman.uni-konstanz.de Gesendet: Samstag, 2. August 2025 15:51 An: BaseX basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] Add namespace bindings via copy/modify/return
Dear BaseX people,
I cannot use copy/modify/return in order to add a namespacing:
let $doc := <doc><a/></doc> return copy $doc_ := $doc modify insert node namespace xyz {'https://basex.org/ns%27%7D into $doc_ return $doc_
=> <doc> <a/> </doc>
Is this a bug?
Kind regards, Hans-Jürgen
Thank you, Christian! The problem is that this way I lose the base URI! The only way how to retain it which I am aware of would be the insertion of @xml:base, but this amounts to a change of the document I may not be authorized to do by the context. Is there any way how to change a document (as modified copy, not via copy/modify/return) and retain or control the base URI of the result, without inserting @xml:base? Kind regards,Hans-Jürgen Am Montag, 4. August 2025 um 12:49:50 MESZ hat Christian Grün cg@basex.org Folgendes geschrieben:
#yiv8241575627 P {margin-top:0;margin-bottom:0;}Hi Hans-Jürgen, The insertion of namespace nodes has not been defined in the XQuery Update spec. You may need choose the classic element constructor for that: let $doc := <doc><a/></doc>return element { node-name($doc) } { $doc/@*, namespace xyz { 'https://basex.org/ns' }, $doc/node()} Hope this helps,ChristianVon: Hans-Juergen Rennau via BaseX-Talk basex-talk@mailman.uni-konstanz.de Gesendet: Samstag, 2. August 2025 15:51 An: BaseX basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] Add namespace bindings via copy/modify/return Dear BaseX people, I cannot use copy/modify/return in order to add a namespacing: let $doc := <doc><a/></doc>return copy $doc_ := $doc modify insert node namespace xyz {'https://basex.org/ns%27%7D into $doc_ return $doc_ =><doc> <a/></doc> Is this a bug? Kind regards,Hans-Jürgen
Hi Hans-Jürgen,
It feels a bit clumsy, but adding a prefixed attribute and removing it again should do the job:
let $xml := doc('x.xml') let $updated := $xml update { insert node <a xmlns:prefix='URI' prefix:attr=''/>/@* into * } update { delete node */@attr } return ($updated, base-uri($updated))
Best, Christian
________________________________ Von: Hans-Juergen Rennau <hrennau@yahoo.de> Gesendet: Montag, 4. August 2025 13:09 An: BaseX <basex-talk@mailman.uni-konstanz.de>; Christian Grün <cg@basex.org> Betreff: Re: AW: [basex-talk] Add namespace bindings via copy/modify/return
Thank you, Christian! The problem is that this way I lose the base URI! The only way how to retain it which I am aware of would be the insertion of @xml:base, but this amounts to a change of the document I may not be authorized to do by the context.
Is there any way how to change a document (as modified copy, not via copy/modify/return) and retain or control the base URI of the result, without inserting @xml:base?
Kind regards, Hans-Jürgen
Am Montag, 4. August 2025 um 12:49:50 MESZ hat Christian Grün <cg@basex.org> Folgendes geschrieben:
Hi Hans-Jürgen,
The insertion of namespace nodes has not been defined in the XQuery Update spec. You may need choose the classic element constructor for that:
let $doc := <doc><a/></doc> return element { node-name($doc) } { $doc/@*, namespace xyz { 'https://basex.org/ns' }, $doc/node() }
Hope this helps, Christian ________________________________ Von: Hans-Juergen Rennau via BaseX-Talk <basex-talk@mailman.uni-konstanz.de> Gesendet: Samstag, 2. August 2025 15:51 An: BaseX <basex-talk@mailman.uni-konstanz.de> Betreff: [basex-talk] Add namespace bindings via copy/modify/return
Dear BaseX people,
I cannot use copy/modify/return in order to add a namespacing:
let $doc := <doc><a/></doc> return copy $doc_ := $doc modify insert node namespace xyz {'https://basex.org/ns'} into $doc_ return $doc_
=> <doc> <a/> </doc>
Is this a bug?
Kind regards, Hans-Jürgen
Thank you very much, Christian, a tip much appreciated! It works. In case (quite improbable) that someone else faces the requirement to add namespaces, retaining the base URI, I add the code of a function I wrote for this operation. Kind regards,Hans-Jürgen PS: Is it not simply oversight that the Update spec does not support the insertion of namespace nodes, although XQuery 3.0 does define their constructors? Would a feature request have any chance? (:~ : Adds namespace nodes to a node, retaining its base URI. : Note that the namespaces are added to the root element of : the incoming document or fragment. :) declare function f:addNamespaces($node as node(), $namespaces as namespace-node()*) as node() { let $root := $node ! root() let $fnElem := function($n) {$n/descendant-or-self::*[1]} let $prefixes := $namespaces ! name(.) let $uris := $namespaces ! string(.) return $root update { for $p at $pos in $prefixes let $uri := $uris[$pos] let $attName := QName($uri, $p||':_') return insert node attribute {$attName} {()} into $fnElem(.) } update { let $elem := $fnElem(.) for $p in $prefixes return delete node $elem/@*[name() eq $p||':_'] }};
Am Montag, 4. August 2025 um 17:03:28 MESZ hat Christian Grün cg@basex.org Folgendes geschrieben:
#yiv3648432543 P {margin-top:0;margin-bottom:0;}Hi Hans-Jürgen, It feels a bit clumsy, but adding a prefixed attribute and removing it again should do the job: let $xml := doc('x.xml') let $updated := $xml update { insert node <a xmlns:prefix='URI' prefix:attr=''/>/@* into * } update { delete node */@attr } return ($updated, base-uri($updated)) Best,Christian Von: Hans-Juergen Rennau <hrennau@yahoo.de> Gesendet: Montag, 4. August 2025 13:09 An: BaseX <basex-talk@mailman.uni-konstanz.de>; Christian Grün <cg@basex.org> Betreff: Re: AW: [basex-talk] Add namespace bindings via copy/modify/return Thank you, Christian! The problem is that this way I lose the base URI! The only way how to retain it which I am aware of would be the insertion of @xml:base, but this amounts to a change of the document I may not be authorized to do by the context. Is there any way how to change a document (as modified copy, not via copy/modify/return) and retain or control the base URI of the result, without inserting @xml:base? Kind regards,Hans-Jürgen Am Montag, 4. August 2025 um 12:49:50 MESZ hat Christian Grün <cg@basex.org> Folgendes geschrieben:
Hi Hans-Jürgen, The insertion of namespace nodes has not been defined in the XQuery Update spec. You may need choose the classic element constructor for that: let $doc := <doc><a/></doc>return element { node-name($doc) } { $doc/@*, namespace xyz { 'https://basex.org/ns' }, $doc/node()} Hope this helps,ChristianVon: Hans-Juergen Rennau via BaseX-Talk <basex-talk@mailman.uni-konstanz.de> Gesendet: Samstag, 2. August 2025 15:51 An: BaseX <basex-talk@mailman.uni-konstanz.de> Betreff: [basex-talk] Add namespace bindings via copy/modify/return Dear BaseX people, I cannot use copy/modify/return in order to add a namespacing: let $doc := <doc><a/></doc>return copy $doc_ := $doc modify insert node namespace xyz {'https://basex.org/ns'} into $doc_ return $doc_ =><doc> <a/></doc> Is this a bug? Kind regards,Hans-Jürgen
PS: Is it not simply oversight that the Update spec does not support the insertion of namespace nodes, although XQuery 3.0 does define their constructors? Would a feature request have any chance?
If I remember correctly, the namespace constructor had not yet been defined when XQuery Update 1.0 was finalized. On XQUF 3.0, not too much time was spent, so it can indeed be regarded as an oversight.
While it may not be too much effort to implement, it could take some time to specify it properly. Anything involving namespaces takes much longer than it seems at first glance…
Dear BaseX people,
As I use BaseX mainly for data containing a lot of geospatial information i'd love to see support for querying gml (3.x) in BaseX.
Google points me to some promising but very old materials (eg. https://files.basex.org/publications/Seydi%20Gheranghiyeh%20%5B2015%5D,%20Ge...) which is already more than 10 years old.
I can see that the Geo module was removed at version 10 and only supported gml 2.
This leads me to a few questions. Any help greatly appreciated:
* Is there any feasible way to query gml 3.x using BaseX? * Are there any plans for bringing back geo module and add support for gml 3 * Would it help if I do some funding for this?
Regards, MArco
Dear Gunther,
Great to hear that things are already possible. Can you please point me to some docs on how this is working?
Most of my use cases will be covered by Simple features (points, lines, polygon also in the multi form), geometry collections of one geometry type (so collections of eg multipoints only, but not multipoint and multipolygon in one collection) and curves defined by 3 points. Functionality as described in http://expath.org/spec/geo does meet my needs.
regards, Marco On 24-09-2025 18:52, Gunther Rademacher wrote:
Dear Marco,
thank you for your interest in the BaseX Geo Module.
Although unpublished, we currently have an updated version that works with both GML 2 and GML 3.2. It supports the basic geometry types (Point, Polygon, etc.), while more complex constructs, such as Feature Collections, are not covered. In practice, this means that the module can parse and process GML 3.2 geometries, but there are limitations with regard to the broader schema. The module has already been used successfully in customer projects with GML 3.2 data.
The functionality largely corresponds to the EXPath Geo Module specification, http://expath.org/spec/geo , with both GML 2 and their corresponding GML 3.2 geometries being recognized. Functions that return geometries will produce results in GML 2 or GML 3.2, depending on the input.
To better understand your situation, could you share which parts of GML 3 you rely on most - for example, specific geometry types? In addition, it might be helpful for you to review the EXPath specification and check whether the functions described there already meet your needs. This would give us a clearer picture of whether the current functionality is sufficient for your use case.
Best regards, Gunther *Gesendet: *Mittwoch, 24. September 2025 um 15:44 *Von: *"Marco Duiker - LandGoed via BaseX-Talk" basex-talk@mailman.uni-konstanz.de *An: *basex-talk@mailman.uni-konstanz.de *Betreff: *[basex-talk] gml3 support Dear BaseX people,
As I use BaseX mainly for data containing a lot of geospatial information i'd love to see support for querying gml (3.x) in BaseX.
Google points me to some promising but very old materials (eg. https://files.basex.org/publications/Seydi%20Gheranghiyeh%20%5B2015%5D,%20Ge...) which is already more than 10 years old.
I can see that the Geo module was removed at version 10 and only supported gml 2.
This leads me to a few questions. Any help greatly appreciated:
- Is there any feasible way to query gml 3.x using BaseX?
- Are there any plans for bringing back geo module and add support for gml 3
- Would it help if I do some funding for this?
Regards, MArco
-- Marco Duiker LandGoed Technisch directeur +31617115114
Hi Marco,
On 24.09.2025 15:44, Marco Duiker - LandGoed via BaseX-Talk wrote:
Would it help if I do some funding for this?
This hasn’t been covered by Gunther’s reply, but it is an important point.
BaseX could have so many more attractive and modern features if there were more funding, especially from commercial or public entities. The transform() function [1], a new storage layout that supports more than 255 namespaces [2], or multiversion concurrency control [3] come to my mind. Or GML 3.2 support and a revived geospatial module.
We and our customers sponsored a few features already, such as XML catalog support for xsl:include/xsl:import in Saxon (that is invoked from BaseX) or xslt:transform-report() [4]. We know how hard it is to convince individual customers or a consortium to sponsor a feature in an open source project.
So please, try to hand over as much money as you can afford to the team to get the features that you need (without distracting them too much, of course).
Gerrit
[1] https://www.w3.org/TR/xpath-functions-31/#func-transform [2] https://github.com/BaseXdb/basex/issues/902 [3] https://en.wikipedia.org/wiki/Multiversion_concurrency_control [4] https://docs.basex.org/main/XSLT_Functions#xslt:transform-report
basex-talk@mailman.uni-konstanz.de