Hi Mike,
I’ll send you another mail once I have found out why it’s not possible anymore to access the currently opened database inside your query.
Here we are… I was surprised to see that the specified database was not considered so far in combination with the 'run' option. This has now changed with the latest snapshot [1]. I assume we never noticed this because we are working with RESTXQ almost exclusively.
All the best Christian
[1] http://files.basex.org/releases/latest/
However, I’d like to add another question to your three:
o Are there better ways to do this?
Yes: use RESTXQ :) It may take some more time to understand how it’s working, but it will allow you to specify much nicer APIs than REST.
Here is how your previous example would look like with RESTXQ:
URL (use the DELETE Method to delete data...): http://localhost:8984/db/abc/def
XQUERY (in the server webapp directory):
declare namespace zss = 'your-zss-namespace-uri'; declare %updating %rest:path("{$database}/{$driver}/{$contributor}") %rest:method("DELETE") function local:delete( $database as xs:string, $driver as xs:string, $contributor as xs:string ) { delete node db:open($database) /zss:driver[@name=$driver] /zss:part[@contributor=$contributor] }; ()
Hope this helps Christian