Hi,

I'm a bit more familiar with a SQL database like Oracle than BaseX, though I did cut my teeth on MarkLogic.  MarkLogic from what I've read seems to handle updates differently than BaseX.  I'm working through examples I found from the website, but wanted to adapt them for my own understanding.

I believe every time I have the copy keyword, it's creating a copy of variable and applies one or more modfiications to that copy.  Because the original isn't changed, it's called "non-updating".  For instance

copy $c := <peace/>
modify (
   insert node element german { 'Friede'} into $c,
   insert node attribute guid {'asdf'} into $c
)
return $c

the original node <peace/>, even if it were a variable would not be touched.

However,

insert node element german { 'Friede'} into <peace/>

Takes the <peace/> element, modifies it and returns the modified form.  Or at least it does not complain.  I ran SET WRITEBACK on and set MIXEDUPDATES before starting these examples. 

Unfortunately, the insert above just returns an empty set.  I *think* it puts it into some PUL list, not unlike a set of transactions to be applied.  These modifications seem to be invisible to subsequent queries, even in the same session (unlike a SQL database wherein the same session would see the modifications). 

How can I get these changes flushed so I can see and use the modified result?

Separately, if I do haver an insert or some other modification, what's the syntax if I wanted to add a for, let order by or other FLOWR keyword? 

Kind Regards,
Ben Pracht
919.809.2439