Christian Grün schreef op 21.02.2018 13:23:
Hi Rob,
What do you mean by »activating« functions? Do you want to invoke all of the returned functions in a loop?
Best, Christian
r.stapper@lijbrandt.nl schrieb am Mi., 21. Feb. 2018, 11:07:
Christian Grün schreef op 19.02.2018 12:14:
Hi Rob,
Glad to have you back! I have revised the inspect:functions
function;
from now on, it also returns updating functions [1].
Best, Christian
[1] http://files.basex.org/releases/latest/
On Sat, Feb 17, 2018 at 3:22 PM, Rob Stapper
wrote:
Hi Christian,
After a period of focussing on Angular I’m back at to BaseX
;-).
I found that the inspect:functions function does not return
updating
functions. Is that by design?
I would like to be able to use the inspect:functions function for triggering my update function on the server side, which of course are
updating
functions
TIA for you reply,
Cheers,
Rob Stapper
Hi Christian,
one remark: the as a result of a inspect:functions() returned updating functions can only be activated when MIXUPDATES option is set to true. This is however a workaround.
Seems like a generic issue for this kind of %processing functions. Buiding two variants for each situation, %updating and non-%updating, for these kind of %processing functions doesn't feel like the optimal solution. Maybe something to put on the agenda (just a thought)
Best,
Rob
Christian,
this is my actual dispatcher code.
declare %rest:path("/DB") %rest:POST("{$specifications}") %input:json("format=xquery")
%output:method("adaptive") %output:indent("no") %updating function _:dispatch ( $specifications as array(*) ) { _:response( update:apply( function( $requester as xs:string , $objectType as xs:string , $transaction as xs:string , $specifications as array(*) ) { inspect:functions()[ namespace-uri-from-QName( function-name(.)) = $objectType and local-name-from-QName( function-name(.)) = $transaction ]( $specifications) } , $specifications ) ) } ;
I want a flexible client-server configuration for prototyping. Performance is not an issue here. This is what I ended up with. Pretty creative. isn't it?
So no loop, but a filter.
Hope this gives you any insight in my madness ;-)
Rob