Hi Francis,
thanks for your thorough analysis.
I'm having trouble understanding document/collection semantics with xquery update. ...
yes, you stumbled upon a sensitive issue: both XQuery and its Update extension have no semantics regarding databases. If a document node is specified in a delete expression, it is simply ignored [1].
Our own database commands have been derived from the BaseX-specific database commands. As such, the semantics differs from XQuery Update. As you correctly indicated, it is currently impossible with these commands to delete one of several documents with the same name. We regard this behavior as intermediate, as future versions of BaseX will not allow more than one document with the same name anymore [2].
A general suggestion is to use distinct paths for all stored documents, or use the (slower) replace command/function to enforce distinct document paths – as long as you need to address single documents in your database.
Hope this helps, feel free to ask for more, Christian
[1] http://www.w3.org/TR/xquery-update-10/#id-delete [2] https://github.com/BaseXdb/basex/issues/429