I attached a complete demo project.
---------- Oorspronkelijk Bericht ---------- Van: Rob Stapper r.stapper@lijbrandt.nl Aan: "basex-talk-owner@mailman.uni-konstanz.de" basex-talk-owner@mailman.uni-konstanz.de Datum: 23-11-2024 11:17 CET Onderwerp: db-rename unexpected behaviour
Hi Christian,
It's been a while so I thought it was time to find some trouble, which I did. (;-)
In my database I want the document-names to be consistent with the id-attribute of its root-element. So, a document named: "test.xml" should have a root--element with @id also: "test.xml". When renaming a with an updated root-element updated document, I find db-rename not working[1]. However creating a new with an updated root-element updated document under the new name and deleting the origional document does work[2].
I would think that if solution[2] works then also solution[1] would work. In both cases all database updating functions follow the same PUL-order. Am I missing something here or is db-rename misbehaving?
[1] declare %updating function this:rename-document-alt1 (: does NOT work :) ( $serverName , $itemName1 , $itemName2 ) { db:put( $serverName , this:get-element( $serverName , $itemName1 ) => this:update-element-name( $itemName2 ) , $itemName1 (: <------------------------ updates org document with renamed root-element :) ) , db:rename( $serverName , $itemName1 , $itemName2 ) } ;
[2] declare %updating function this:rename-document-alt2 (: does work :) ( $serverName , $itemName1 , $itemName2 ) { db:put( $serverName , this:get-element( $serverName , $itemName1 ) => this:update-element-name( $itemName2 ) , $itemName2 (: <------------------------ creates new document with renamed root-element :) ) , db:delete( $serverName , $itemName1 ) } ;
mvgr.
Rob Stapper
mvgr.
Rob Stapper
Hi Rob,
Please help us and state…
• how the project can be run, • what result you would expect and • what result you get.
Thanks in advance Christian
On Mon, Nov 25, 2024 at 8:38 AM Rob Stapper r.stapper@lijbrandt.nl wrote:
I attached a complete demo project.
---------- Oorspronkelijk Bericht ---------- Van: Rob Stapper r.stapper@lijbrandt.nl Aan: "basex-talk-owner@mailman.uni-konstanz.de" < basex-talk-owner@mailman.uni-konstanz.de> Datum: 23-11-2024 11:17 CET Onderwerp: db-rename unexpected behaviour
Hi Christian,
It's been a while so I thought it was time to find some trouble, which I did. (;-)
In my database I want the document-names to be consistent with the id-attribute of its root-element. So, a document named: "test.xml" should have a root--element with @id also: "test.xml". When renaming a with an updated root-element updated document, I find db-rename not working[1]. However creating a new with an updated root-element updated document under the new name and deleting the origional document does work[2].
I would think that if solution[2] works then also solution[1] would work. In both cases all database updating functions follow the same PUL-order. Am I missing something here or is db-rename misbehaving?
[1] declare %updating function this:rename-document-alt1 (: does NOT work :) ( $serverName , $itemName1 , $itemName2 ) { db:put( $serverName , this:get-element( $serverName , $itemName1 ) => this:update-element-name( $itemName2 ) , $itemName1 (: <------------------------ updates org document with renamed root-element :) ) , db:rename( $serverName , $itemName1 , $itemName2 ) } ;
[2] declare %updating function this:rename-document-alt2 (: does work :) ( $serverName , $itemName1 , $itemName2 ) { db:put( $serverName , this:get-element( $serverName , $itemName1 ) => this:update-element-name( $itemName2 ) , $itemName2 (: <------------------------ creates new document with renamed root-element :) ) , db:delete( $serverName , $itemName1 ) } ;
mvgr.
Rob Stapper
mvgr.
Rob Stapper
basex-talk@mailman.uni-konstanz.de