inspect:functions does not return updating functions
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 Rob,
Glad to have you back! I have revised the inspect:functions function; from now on, it also returns updating functions [1].
Best, Christian
Quoted text · Rob Stapper · 23 lines
On Sat, Feb 17, 2018 at 3:22 PM, Rob Stapper <r.stapper at lijbrandt.nl> 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,
Fantastic, as usual. Great to be back.
Best Rob
Quoted text · Christian Grün · 38 lines
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 <r.stapper at lijbrandt.nl> > 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
Quoted text · Christian Grün · 38 lines
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 <r.stapper at lijbrandt.nl> > 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
Hi Rob,
What do you mean by »activating« functions? Do you want to invoke all of the returned functions in a loop?
Best, Christian
Quoted text · r.stapper · 54 lines
<r.stapper at 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 <r.stapper at lijbrandt.nl> > > 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 >
Quoted text · Christian Grün · 72 lines
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 at 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 >> <r.stapper at lijbrandt.nl> >>> 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
Quoted text · r.stapper · 1 line
> this is my actual dispatcher code.
So this means you are invoking the function, and it will always be updating?
To invoke updating functions, you need the 'updating' keyword:
let $f := function() { db:output('1') }
return updating $f()Hope this helps, Christian
Quoted text · r.stapper · 38 lines
> > 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
Christian,
Looks promising. Will dive into this in the weekend.
Many thanks,
Rob -----Oorspronkelijk bericht-----
Quoted text · Christian Grün · 50 lines
Van: Christian Grün [mailto:christian.gruen at gmail.com] Verzonden: woensdag 21 februari 2018 14:25 Aan: Rob Stapper CC: BaseX Onderwerp: Re: [basex-talk] inspect:functions does not return updating functions > this is my actual dispatcher code. So this means you are invoking the function, and it will always be updating? To invoke updating functions, you need the 'updating' keyword: let $f := function() { db:output('1') } return updating $f() Hope this helps, Christian > > 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
Written for BaseX 8.6. BaseX may have changed since: please check the current documentation.