Re: [basex-talk] Server Variables, cached vars, etc

2017-09-21 Thread Marco Lettere

Great!
M.


On 21/09/2017 12:52, Christian Grün wrote:

…done [1]. A new 8.7 snapshot is available [1].

[1] http://docs.basex.org/wiki/Command-Line_Options#HTTP_Server
[2] http://files.basex.org/releases/latest/


On Wed, Sep 20, 2017 at 7:37 PM, Christian Grün
 wrote:

Fabrice, Marco, thanks for your asseessment. After I have realized
that it’ll take some more time to make this happen, I have added yet
another issue for this feature request [1].

[1] https://github.com/BaseXdb/basex/issues/1499

On Mon, Sep 18, 2017 at 5:03 PM, Fabrice ETANCHAUD
 wrote:

Hello Christian !

Yes, a -c option for the basexhttp would help, as mentioned earlier, for 
example creating a shared mainmem collection.

Best regards,
Fabrice





Re: [basex-talk] Server Variables, cached vars, etc

2017-09-21 Thread Christian Grün
…done [1]. A new 8.7 snapshot is available [1].

[1] http://docs.basex.org/wiki/Command-Line_Options#HTTP_Server
[2] http://files.basex.org/releases/latest/


On Wed, Sep 20, 2017 at 7:37 PM, Christian Grün
 wrote:
> Fabrice, Marco, thanks for your asseessment. After I have realized
> that it’ll take some more time to make this happen, I have added yet
> another issue for this feature request [1].
>
> [1] https://github.com/BaseXdb/basex/issues/1499
>
> On Mon, Sep 18, 2017 at 5:03 PM, Fabrice ETANCHAUD
>  wrote:
>> Hello Christian !
>>
>> Yes, a -c option for the basexhttp would help, as mentioned earlier, for 
>> example creating a shared mainmem collection.
>>
>> Best regards,
>> Fabrice


Re: [basex-talk] Server Variables, cached vars, etc

2017-09-20 Thread Christian Grün
Fabrice, Marco, thanks for your asseessment. After I have realized
that it’ll take some more time to make this happen, I have added yet
another issue for this feature request [1].

[1] https://github.com/BaseXdb/basex/issues/1499

On Mon, Sep 18, 2017 at 5:03 PM, Fabrice ETANCHAUD
 wrote:
> Hello Christian !
>
> Yes, a -c option for the basexhttp would help, as mentioned earlier, for 
> example creating a shared mainmem collection.
>
> Best regards,
> Fabrice


Re: [basex-talk] Server Variables, cached vars, etc

2017-09-18 Thread Fabrice ETANCHAUD
Hello Christian !

Yes, a -c option for the basexhttp would help, as mentioned earlier, for 
example creating a shared mainmem collection.

Best regards,
Fabrice

-Message d'origine-
De : basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Christian Grün
Envoyé : lundi 18 septembre 2017 16:20
À : Kendall Shaw; coach3pete
Cc : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] Server Variables, cached vars, etc

Hi Erik,

I think that Xavier-Laurent, Marco, Fabrice and Kendall have already given 
excellent feedback.

In our own projects, we store all global data in databases, or in local 
configuration files. One advantage is that this data requires no initialization 
and will automatically be available after a restart.

I don’t know anything about »server variables« in MarkLogic so far, so
@Erik: feel free to pass me on a link to the documentation, and I can check if 
a similar solution could make sense for BaseX.

Talking about the start script server option: The basexserver command comes 
with a -c flag, which allows you run initial commands [1]. We could add such a 
flag for basexhttp, or even allow an initial input for both startup commands 
(similar to basex/basexclient). Would this be helpful for some of you reading 
this? Quite obviously, this requires BaseX to be run via these scripts (it 
wouldn’t have any effect if BaseX is deployed as servlet).

Cheers,
Christian

[1] http://docs.basex.org/wiki/Command-Line_Options#Server



On Sun, Sep 10, 2017 at 1:56 AM, Kendall Shaw <kendall.s...@workday.com> wrote:
> The servlet could populate your singleton just once upon startup, or 
> run xquery etc. The load-on-startup configuration means that the 
> servlet is initialized after basex has been loaded. So, if you restart 
> jetty or whatever web server/web container you are using basex 
> restarts and then your servlet’s init method is invoked.
>
>
>
> Kendall
>
>
>
> From: Erik Peterson <e...@ardec.com>
> Date: Saturday, September 9, 2017 at 4:16 AM
> To: Kendall Shaw <kendall.s...@workday.com>
> Cc: "basex-talk@mailman.uni-konstanz.de"
> <basex-talk@mailman.uni-konstanz.de>
>
>
> Subject: Re: [basex-talk] Server Variables, cached vars, etc
>
>
>
> Thanks Kendal for your reply. What would be the advantage of creating 
> a servlet over a singleton class to do the same thing?
>
>
>
> On Fri, Sep 8, 2017 at 11:12 AM, Kendall Shaw 
> <kendall.s...@workday.com>
> wrote:
>
> I thought it might be useful to mention advice I was given about 
> startup
> hooks:
>
>
>
>> From: "Kirsten, Dirk" dirk.kirs...@senacor.com
>
> ,,,
>
>> there is currently no way to do this using BaseX itself. But I also 
>> don’t think that should be the job of BaseX. Instead you can write a 
>> servlet and deploy it using Tomcat which runs some Java application, 
>> e.g. which could trigger some BaseXX command. See 
>> http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-
>> startup/
>> for an example how to do this.
>
>
>
> I switched from using a cron job, to doing this in order to schedule jobs.
> I have very simple servlet that is configured with 
> 2 (basex has load-on-startup 2). It 
> runs a shell script which schedules the jobs, soon after basex is loaded.
>
>
>
> Kendall
>
>
>
> From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Erik 
> Peterson <e...@ardec.com>
> Date: Tuesday, September 5, 2017 at 7:02 AM
> To: Fabrice ETANCHAUD <fetanch...@pch.cerfrance.fr>, 
> "basex-talk@mailman.uni-konstanz.de" 
> <basex-talk@mailman.uni-konstanz.de>
> Subject: Re: [basex-talk] Server Variables, cached vars, etc
>
>
>
> Thank you all for your replys.  It looks like a main memory database 
> is the best "built in" option.  However, I have created Jar file  to 
> drop him/lib with a Java Singleton object...holding a map.  That should be  
> accessible
> across requests and sessions.   The question is how to populate this just
> once upon start up?  Perhaps I could do a job that would do that?  
> Also I could memoize the variables in a global script.  That way the 
> expensive operation is only run the first time it is needed.
>
>
>
> Any other suggestions welcome.  Recommend that a standard built-in 
> feature be added to handle these scenarios.
>
>
>
> On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD 
> <fetanch...@pch.cerfrance.fr> wrote:
>
> To be confirmed : there is no 'start script' server option.
> I do manually create and populate the mainmem db in the dba query interface.
>
> Best regards,
> Fabrice
>
> -Mes

Re: [basex-talk] Server Variables, cached vars, etc

2017-09-18 Thread Marco Lettere

Hi Christian,
welcome back to the list!
Having the possibility to run a script or call any sort of cuntvionality 
at startup is quite a useful thing.
Doing it in a declarative way would be great maybe exploiting the .basex 
file or the web.xml?


Btw, hooking up on Server variables, a colleague of mine has just come 
up with another (somewhat exotic) way of passing content from one RestXQ 
call to another using proc:system to set and get environment variables 
variables. ;-)

Regards,
Marco.

On 18/09/2017 16:19, Christian Grün wrote:

Hi Erik,

I think that Xavier-Laurent, Marco, Fabrice and Kendall have already
given excellent feedback.

In our own projects, we store all global data in databases, or in
local configuration files. One advantage is that this data requires no
initialization and will automatically be available after a restart.

I don’t know anything about »server variables« in MarkLogic so far, so
@Erik: feel free to pass me on a link to the documentation, and I can
check if a similar solution could make sense for BaseX.

Talking about the start script server option: The basexserver command
comes with a -c flag, which allows you run initial commands [1]. We
could add such a flag for basexhttp, or even allow an initial input
for both startup commands (similar to basex/basexclient). Would this
be helpful for some of you reading this? Quite obviously, this
requires BaseX to be run via these scripts (it wouldn’t have any
effect if BaseX is deployed as servlet).

Cheers,
Christian

[1] http://docs.basex.org/wiki/Command-Line_Options#Server



On Sun, Sep 10, 2017 at 1:56 AM, Kendall Shaw <kendall.s...@workday.com> wrote:

The servlet could populate your singleton just once upon startup, or run
xquery etc. The load-on-startup configuration means that the servlet is
initialized after basex has been loaded. So, if you restart jetty or
whatever web server/web container you are using basex restarts and then your
servlet’s init method is invoked.



Kendall



From: Erik Peterson <e...@ardec.com>
Date: Saturday, September 9, 2017 at 4:16 AM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: "basex-talk@mailman.uni-konstanz.de"
<basex-talk@mailman.uni-konstanz.de>


Subject: Re: [basex-talk] Server Variables, cached vars, etc



Thanks Kendal for your reply. What would be the advantage of creating a
servlet over a singleton class to do the same thing?



On Fri, Sep 8, 2017 at 11:12 AM, Kendall Shaw <kendall.s...@workday.com>
wrote:

I thought it might be useful to mention advice I was given about startup
hooks:




From: "Kirsten, Dirk" dirk.kirs...@senacor.com

,,,


there is currently no way to do this using BaseX itself. But I also don’t
think that should be the job of BaseX. Instead you can write a servlet and
deploy it using Tomcat which runs some Java application, e.g. which could
trigger some BaseXX command. See
http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/
for an example how to do this.



I switched from using a cron job, to doing this in order to schedule jobs.
I have very simple servlet that is configured with
2 (basex has load-on-startup 2). It runs
a shell script which schedules the jobs, soon after basex is loaded.



Kendall



From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Erik
Peterson <e...@ardec.com>
Date: Tuesday, September 5, 2017 at 7:02 AM
To: Fabrice ETANCHAUD <fetanch...@pch.cerfrance.fr>,
"basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Server Variables, cached vars, etc



Thank you all for your replys.  It looks like a main memory database is the
best "built in" option.  However, I have created Jar file  to drop him/lib
with a Java Singleton object...holding a map.  That should be  accessible
across requests and sessions.   The question is how to populate this just
once upon start up?  Perhaps I could do a job that would do that?  Also I
could memoize the variables in a global script.  That way the expensive
operation is only run the first time it is needed.



Any other suggestions welcome.  Recommend that a standard built-in feature
be added to handle these scenarios.



On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD
<fetanch...@pch.cerfrance.fr> wrote:

To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a
memory cache.
In Client/Server mode, any main memory created by one client is available to
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : basex-talk-bou

Re: [basex-talk] Server Variables, cached vars, etc

2017-09-18 Thread Christian Grün
Hi Erik,

I think that Xavier-Laurent, Marco, Fabrice and Kendall have already
given excellent feedback.

In our own projects, we store all global data in databases, or in
local configuration files. One advantage is that this data requires no
initialization and will automatically be available after a restart.

I don’t know anything about »server variables« in MarkLogic so far, so
@Erik: feel free to pass me on a link to the documentation, and I can
check if a similar solution could make sense for BaseX.

Talking about the start script server option: The basexserver command
comes with a -c flag, which allows you run initial commands [1]. We
could add such a flag for basexhttp, or even allow an initial input
for both startup commands (similar to basex/basexclient). Would this
be helpful for some of you reading this? Quite obviously, this
requires BaseX to be run via these scripts (it wouldn’t have any
effect if BaseX is deployed as servlet).

Cheers,
Christian

[1] http://docs.basex.org/wiki/Command-Line_Options#Server



On Sun, Sep 10, 2017 at 1:56 AM, Kendall Shaw <kendall.s...@workday.com> wrote:
> The servlet could populate your singleton just once upon startup, or run
> xquery etc. The load-on-startup configuration means that the servlet is
> initialized after basex has been loaded. So, if you restart jetty or
> whatever web server/web container you are using basex restarts and then your
> servlet’s init method is invoked.
>
>
>
> Kendall
>
>
>
> From: Erik Peterson <e...@ardec.com>
> Date: Saturday, September 9, 2017 at 4:16 AM
> To: Kendall Shaw <kendall.s...@workday.com>
> Cc: "basex-talk@mailman.uni-konstanz.de"
> <basex-talk@mailman.uni-konstanz.de>
>
>
> Subject: Re: [basex-talk] Server Variables, cached vars, etc
>
>
>
> Thanks Kendal for your reply. What would be the advantage of creating a
> servlet over a singleton class to do the same thing?
>
>
>
> On Fri, Sep 8, 2017 at 11:12 AM, Kendall Shaw <kendall.s...@workday.com>
> wrote:
>
> I thought it might be useful to mention advice I was given about startup
> hooks:
>
>
>
>> From: "Kirsten, Dirk" dirk.kirs...@senacor.com
>
> ,,,
>
>> there is currently no way to do this using BaseX itself. But I also don’t
>> think that should be the job of BaseX. Instead you can write a servlet and
>> deploy it using Tomcat which runs some Java application, e.g. which could
>> trigger some BaseXX command. See
>> http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/
>> for an example how to do this.
>
>
>
> I switched from using a cron job, to doing this in order to schedule jobs.
> I have very simple servlet that is configured with
> 2 (basex has load-on-startup 2). It runs
> a shell script which schedules the jobs, soon after basex is loaded.
>
>
>
> Kendall
>
>
>
> From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Erik
> Peterson <e...@ardec.com>
> Date: Tuesday, September 5, 2017 at 7:02 AM
> To: Fabrice ETANCHAUD <fetanch...@pch.cerfrance.fr>,
> "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
> Subject: Re: [basex-talk] Server Variables, cached vars, etc
>
>
>
> Thank you all for your replys.  It looks like a main memory database is the
> best "built in" option.  However, I have created Jar file  to drop him/lib
> with a Java Singleton object...holding a map.  That should be  accessible
> across requests and sessions.   The question is how to populate this just
> once upon start up?  Perhaps I could do a job that would do that?  Also I
> could memoize the variables in a global script.  That way the expensive
> operation is only run the first time it is needed.
>
>
>
> Any other suggestions welcome.  Recommend that a standard built-in feature
> be added to handle these scenarios.
>
>
>
> On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD
> <fetanch...@pch.cerfrance.fr> wrote:
>
> To be confirmed : there is no 'start script' server option.
> I do manually create and populate the mainmem db in the dba query interface.
>
> Best regards,
> Fabrice
>
> -Message d'origine-
> De : Fabrice ETANCHAUD
> Envoyé : mardi 5 septembre 2017 09:29
> À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
> Objet : RE: [basex-talk] Server Variables, cached vars, etc
>
> Hi all,
>
> Another solution is to share a main memory database, that behaves like a
> memory cache.
> In Client/Server mode, any main memory created by one client is available to
> all the other ones.
>
> Best regards,
> Fabrice
>
>
> -Message d'origine-
> De : basex-talk-boun..

Re: [basex-talk] Server Variables, cached vars, etc

2017-09-09 Thread Kendall Shaw
The servlet could populate your singleton just once upon startup, or run xquery 
etc. The load-on-startup configuration means that the servlet is initialized 
after basex has been loaded. So, if you restart jetty or whatever web 
server/web container you are using basex restarts and then your servlet’s init 
method is invoked.

Kendall

From: Erik Peterson <e...@ardec.com>
Date: Saturday, September 9, 2017 at 4:16 AM
To: Kendall Shaw <kendall.s...@workday.com>
Cc: "basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Thanks Kendal for your reply. What would be the advantage of creating a servlet 
over a singleton class to do the same thing?

On Fri, Sep 8, 2017 at 11:12 AM, Kendall Shaw 
<kendall.s...@workday.com<mailto:kendall.s...@workday.com>> wrote:
I thought it might be useful to mention advice I was given about startup hooks:

> From: "Kirsten, Dirk" 
> dirk.kirs...@senacor.com<mailto:dirk.kirs...@senacor.com>
,,,
> there is currently no way to do this using BaseX itself. But I also don’t 
> think that should be the job of BaseX. Instead you can write a servlet and 
> deploy it using Tomcat which runs some Java application, e.g. which could 
> trigger some BaseXX command. See 
> http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/<https://urldefense.proofpoint.com/v2/url?u=http-3A__crunchify.com_how-2Dto-2Drun-2Djava-2Dprogram-2Dautomatically-2Don-2Dtomcat-2Dstartup_=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=fPChED25tvjfNbUFkPSuyRBFfpYGFrqPI1DLNeEovLI=0q_rTZpxZNOefv3G77E1Vna_JmrxWcl0OcoKc1EmHAc=>
>  for an example how to do this.

I switched from using a cron job, to doing this in order to schedule jobs.  I 
have very simple servlet that is configured with 
2 (basex has load-on-startup 2). It runs a 
shell script which schedules the jobs, soon after basex is loaded.

Kendall

From: 
<basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>>
 on behalf of Erik Peterson <e...@ardec.com<mailto:e...@ardec.com>>
Date: Tuesday, September 5, 2017 at 7:02 AM
To: Fabrice ETANCHAUD 
<fetanch...@pch.cerfrance.fr<mailto:fetanch...@pch.cerfrance.fr>>, 
"basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" 
<basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>>
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Thank you all for your replys.  It looks like a main memory database is the 
best "built in" option.  However, I have created Jar file  to drop him/lib with 
a Java Singleton object...holding a map.  That should be  accessible across 
requests and sessions.   The question is how to populate this just once upon 
start up?  Perhaps I could do a job that would do that?  Also I could memoize 
the variables in a global script.  That way the expensive operation is only run 
the first time it is needed.

Any other suggestions welcome.  Recommend that a standard built-in feature  be 
added to handle these scenarios.

On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD 
<fetanch...@pch.cerfrance.fr<mailto:fetanch...@pch.cerfrance.fr>> wrote:
To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : 
basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>]
 De la part de Marco Lettere Envoyé : mardi 5 septembre 2017 09:14 À : 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed
> across many RestXQ requests and sessions. I'm trying to cache data
> that comes from an integration with an expensive operation. Does BaseX
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session 
http://docs.basex

Re: [basex-talk] Server Variables, cached vars, etc

2017-09-09 Thread Erik Peterson
Thanks Kendal for your reply. What would be the advantage of creating a
servlet over a singleton class to do the same thing?

On Fri, Sep 8, 2017 at 11:12 AM, Kendall Shaw <kendall.s...@workday.com>
wrote:

> I thought it might be useful to mention advice I was given about startup
> hooks:
>
>
>
> > From: "Kirsten, Dirk" dirk.kirs...@senacor.com
>
> ,,,
>
> > there is currently no way to do this using BaseX itself. But I also
> don’t think that should be the job of BaseX. Instead you can write a
> servlet and deploy it using Tomcat which runs some Java application, e.g.
> which could trigger some BaseXX command. See http://crunchify.com/how-to-
> run-java-program-automatically-on-tomcat-startup/ for an example how to
> do this.
>
>
>
> I switched from using a cron job, to doing this in order to schedule
> jobs.  I have very simple servlet that is configured with
> 2 (basex has load-on-startup 2). It
> runs a shell script which schedules the jobs, soon after basex is loaded.
>
>
>
> Kendall
>
>
>
> *From: *<basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Erik
> Peterson <e...@ardec.com>
> *Date: *Tuesday, September 5, 2017 at 7:02 AM
> *To: *Fabrice ETANCHAUD <fetanch...@pch.cerfrance.fr>, "
> basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
> *Subject: *Re: [basex-talk] Server Variables, cached vars, etc
>
>
>
> Thank you all for your replys.  It looks like a main memory database is
> the best "built in" option.  However, I have created Jar file  to drop
> him/lib with a Java Singleton object...holding a map.  That should be
>  accessible across requests and sessions.   The question is how to populate
> this just once upon start up?  Perhaps I could do a job that would do
> that?  Also I could memoize the variables in a global script.  That way the
> expensive operation is only run the first time it is needed.
>
>
>
> Any other suggestions welcome.  Recommend that a standard built-in feature
>  be added to handle these scenarios.
>
>
>
> On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD <
> fetanch...@pch.cerfrance.fr> wrote:
>
> To be confirmed : there is no 'start script' server option.
> I do manually create and populate the mainmem db in the dba query
> interface.
>
> Best regards,
> Fabrice
>
> -Message d'origine-
> De : Fabrice ETANCHAUD
> Envoyé : mardi 5 septembre 2017 09:29
> À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
> Objet : RE: [basex-talk] Server Variables, cached vars, etc
>
> Hi all,
>
> Another solution is to share a main memory database, that behaves like a
> memory cache.
> In Client/Server mode, any main memory created by one client is available
> to all the other ones.
>
> Best regards,
> Fabrice
>
>
> -Message d'origine-
> De : basex-talk-boun...@mailman.uni-konstanz.de [mailto:
> basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere
> Envoyé : mardi 5 septembre 2017 09:14 À : basex-t...@mailman.uni-
> konstanz.de
> Objet : Re: [basex-talk] Server Variables, cached vars, etc
>
> On 05/09/2017 01:37, Erik Peterson wrote:
> > How can I create a variable that is evaluated only once but accessed
> > across many RestXQ requests and sessions. I'm trying to cache data
> > that comes from an integration with an expensive operation. Does BaseX
> > support something similar to server variables like Mark Logic?
>
> Hi Erik,
>
> AFAIK you have the following possibilities to keep a variable live accross
> multiple RestXQ calls:
>
> 1) Use session http://docs.basex.org/wiki/Session_Module
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Session-5FModule=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=DfAtFmXgoUqMIP116Hn78cCdB0klwv2oiZZ8v8di0Ew=VUiY8Im77MBCa2uPCzDsV7HRZEC-Sqx2WNzt_CD9Iok=>
>
> 2) Use a database which is builtin in BaseX and is very lightweight.
> Especially if your data is serializable to XML you could benefit also from
> indexes to speed up access to your cached objects.
>
> 3) Use the file system.
>
> Hope this helps [cit] ;-)
>
> Marco.
>
> --
>
> *Erik Peterson*
>
> President, Ardec LLC
>
> 281-804-9023 <(281)%20804-9023> | e...@ardec.com
>



-- 
*Erik Peterson*
President, Ardec LLC
281-804-9023 | e...@ardec.com


Re: [basex-talk] Server Variables, cached vars, etc

2017-09-08 Thread Kendall Shaw
I thought it might be useful to mention advice I was given about startup hooks:

> From: "Kirsten, Dirk" 
> dirk.kirs...@senacor.com<mailto:dirk.kirs...@senacor.com>
,,,
> there is currently no way to do this using BaseX itself. But I also don’t 
> think that should be the job of BaseX. Instead you can write a servlet and 
> deploy it using Tomcat which runs some Java application, e.g. which could 
> trigger some BaseXX command. See 
> http://crunchify.com/how-to-run-java-program-automatically-on-tomcat-startup/ 
> for an example how to do this.

I switched from using a cron job, to doing this in order to schedule jobs.  I 
have very simple servlet that is configured with 
2 (basex has load-on-startup 2). It runs a 
shell script which schedules the jobs, soon after basex is loaded.

Kendall

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Erik Peterson 
<e...@ardec.com>
Date: Tuesday, September 5, 2017 at 7:02 AM
To: Fabrice ETANCHAUD <fetanch...@pch.cerfrance.fr>, 
"basex-talk@mailman.uni-konstanz.de" <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Thank you all for your replys.  It looks like a main memory database is the 
best "built in" option.  However, I have created Jar file  to drop him/lib with 
a Java Singleton object...holding a map.  That should be  accessible across 
requests and sessions.   The question is how to populate this just once upon 
start up?  Perhaps I could do a job that would do that?  Also I could memoize 
the variables in a global script.  That way the expensive operation is only run 
the first time it is needed.

Any other suggestions welcome.  Recommend that a standard built-in feature  be 
added to handle these scenarios.

On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD 
<fetanch...@pch.cerfrance.fr<mailto:fetanch...@pch.cerfrance.fr>> wrote:
To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : 
basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>
 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de<mailto:basex-talk-boun...@mailman.uni-konstanz.de>]
 De la part de Marco Lettere Envoyé : mardi 5 septembre 2017 09:14 À : 
basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed
> across many RestXQ requests and sessions. I'm trying to cache data
> that comes from an integration with an expensive operation. Does BaseX
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session 
http://docs.basex.org/wiki/Session_Module<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Session-5FModule=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=DfAtFmXgoUqMIP116Hn78cCdB0klwv2oiZZ8v8di0Ew=VUiY8Im77MBCa2uPCzDsV7HRZEC-Sqx2WNzt_CD9Iok=>

2) Use a database which is builtin in BaseX and is very lightweight.
Especially if your data is serializable to XML you could benefit also from 
indexes to speed up access to your cached objects.

3) Use the file system.

Hope this helps [cit] ;-)

Marco.
--
Erik Peterson
President, Ardec LLC
281-804-9023 | e...@ardec.com<mailto:e...@ardec.com>


Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Erik Peterson
Thank you all for your replys.  It looks like a main memory database is the
best "built in" option.  However, I have created Jar file  to drop him/lib
with a Java Singleton object...holding a map.  That should be  accessible
across requests and sessions.   The question is how to populate this just
once upon start up?  Perhaps I could do a job that would do that?  Also I
could memoize the variables in a global script.  That way the expensive
operation is only run the first time it is needed.

Any other suggestions welcome.  Recommend that a standard built-in feature
 be added to handle these scenarios.

On Tue, Sep 5, 2017 at 1:33 AM Fabrice ETANCHAUD <
fetanch...@pch.cerfrance.fr> wrote:

> To be confirmed : there is no 'start script' server option.
> I do manually create and populate the mainmem db in the dba query
> interface.
>
> Best regards,
> Fabrice
>
> -Message d'origine-
> De : Fabrice ETANCHAUD
> Envoyé : mardi 5 septembre 2017 09:29
> À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
> Objet : RE: [basex-talk] Server Variables, cached vars, etc
>
> Hi all,
>
> Another solution is to share a main memory database, that behaves like a
> memory cache.
> In Client/Server mode, any main memory created by one client is available
> to all the other ones.
>
> Best regards,
> Fabrice
>
>
> -Message d'origine-
> De : basex-talk-boun...@mailman.uni-konstanz.de [mailto:
> basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere
> Envoyé : mardi 5 septembre 2017 09:14 À :
> basex-talk@mailman.uni-konstanz.de
> Objet : Re: [basex-talk] Server Variables, cached vars, etc
>
> On 05/09/2017 01:37, Erik Peterson wrote:
> > How can I create a variable that is evaluated only once but accessed
> > across many RestXQ requests and sessions. I'm trying to cache data
> > that comes from an integration with an expensive operation. Does BaseX
> > support something similar to server variables like Mark Logic?
>
> Hi Erik,
>
> AFAIK you have the following possibilities to keep a variable live accross
> multiple RestXQ calls:
>
> 1) Use session http://docs.basex.org/wiki/Session_Module
>
> 2) Use a database which is builtin in BaseX and is very lightweight.
> Especially if your data is serializable to XML you could benefit also from
> indexes to speed up access to your cached objects.
>
> 3) Use the file system.
>
> Hope this helps [cit] ;-)
>
> Marco.
>
> --
*Erik Peterson*
President, Ardec LLC
281-804-9023 | e...@ardec.com


Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Fabrice ETANCHAUD
To be confirmed : there is no 'start script' server option.
I do manually create and populate the mainmem db in the dba query interface.

Best regards,
Fabrice

-Message d'origine-
De : Fabrice ETANCHAUD 
Envoyé : mardi 5 septembre 2017 09:29
À : 'Marco Lettere'; basex-talk@mailman.uni-konstanz.de
Objet : RE: [basex-talk] Server Variables, cached vars, etc

Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere 
Envoyé : mardi 5 septembre 2017 09:14 À : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed 
> across many RestXQ requests and sessions. I'm trying to cache data 
> that comes from an integration with an expensive operation. Does BaseX 
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight. 
Especially if your data is serializable to XML you could benefit also from 
indexes to speed up access to your cached objects.

3) Use the file system.

Hope this helps [cit] ;-)

Marco.



Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Kendall Shaw
A problem with that is that it evaluates the variable each time. If you need it 
to only evaluate once (expensive operation), something else needs to be done. I 
would like to know an answer to this so that I can schedule jobs on start up 
without involving processes external to basex.

From: <basex-talk-boun...@mailman.uni-konstanz.de> on behalf of Xavier-Laurent 
SALVADOR <xavierlaurent.salva...@gmail.com>
Date: Monday, September 4, 2017 at 11:42 PM
To: Erik Peterson <e...@ardec.com>
Cc: BaseX <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Server Variables, cached vars, etc

Hi,

do you mean something like a repo variable ?

If you define a module name in your repo:

 1-  module namespace myNs = 
'http://www.x.fr/-repo’<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.x.fr_-2Drepo-25E2-2580-2599=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=6BbM4k_uDRdhjURAbaUe8SgS19qfgxyIM03BQbY2xzk=vnUoDRkXSxl-NAs4wmOr8q2saq5Y9K0_k6l71w-jrrM=>;

You can define in your repo a new variable :

 1-declare variable $myNs:testid :=  
db:open(‘x')/utilisateurs/entry/sessions/session/id=session:id();

Then import your module in your restxq:

  1-   import module namespace isi = 
'http://www.isilex.fr/isi-repo’<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.isilex.fr_isi-2Drepo-25E2-2580-2599=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=6BbM4k_uDRdhjURAbaUe8SgS19qfgxyIM03BQbY2xzk=7iT9husSt3pxwCXxx8Kf7Sf1KKDDurqvyhDHERP1p2g=>;

And access your variables:

  1-$myNs:testid

More here: 
http://docs.basex.org/wiki/XQuery_3.0#External_Variables<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_XQuery-5F3.0-23External-5FVariables=DwMFaQ=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA=6BbM4k_uDRdhjURAbaUe8SgS19qfgxyIM03BQbY2xzk=tfVbcjLW6lGgTfWHzfgWtKLPja7kdFONHW74KF_CdiA=>

Sorry If I’m wrong and didn’t understand,

XLS
Le 5 sept. 2017 à 01:37, Erik Peterson <e...@ardec.com<mailto:e...@ardec.com>> 
a écrit :

How can I create a variable that is evaluated only once but accessed across 
many RestXQ requests and sessions. I'm trying to cache data that comes from an 
integration with an expensive operation. Does BaseX support something similar 
to server variables like Mark Logic?




Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Fabrice ETANCHAUD
Hi all,

Another solution is to share a main memory database, that behaves like a memory 
cache.
In Client/Server mode, any main memory created by one client is available to 
all the other ones.

Best regards,
Fabrice


-Message d'origine-
De : basex-talk-boun...@mailman.uni-konstanz.de 
[mailto:basex-talk-boun...@mailman.uni-konstanz.de] De la part de Marco Lettere
Envoyé : mardi 5 septembre 2017 09:14
À : basex-talk@mailman.uni-konstanz.de
Objet : Re: [basex-talk] Server Variables, cached vars, etc

On 05/09/2017 01:37, Erik Peterson wrote:
> How can I create a variable that is evaluated only once but accessed 
> across many RestXQ requests and sessions. I'm trying to cache data 
> that comes from an integration with an expensive operation. Does BaseX 
> support something similar to server variables like Mark Logic?

Hi Erik,

AFAIK you have the following possibilities to keep a variable live accross 
multiple RestXQ calls:

1) Use session http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight. 
Especially if your data is serializable to XML you could benefit also from 
indexes to speed up access to your cached objects.

3) Use the file system.

Hope this helps [cit] ;-)

Marco.



Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Marco Lettere

On 05/09/2017 01:37, Erik Peterson wrote:
How can I create a variable that is evaluated only once but accessed 
across many RestXQ requests and sessions. I'm trying to cache data 
that comes from an integration with an expensive operation. Does BaseX 
support something similar to server variables like Mark Logic?


Hi Erik,

AFAIK you have the following possibilities to keep a variable live 
accross multiple RestXQ calls:


1) Use session http://docs.basex.org/wiki/Session_Module

2) Use a database which is builtin in BaseX and is very lightweight. 
Especially if your data is serializable to XML you could benefit also 
from indexes to speed up access to your cached objects.


3) Use the file system.

Hope this helps [cit] ;-)

Marco.



Re: [basex-talk] Server Variables, cached vars, etc

2017-09-05 Thread Xavier-Laurent SALVADOR
Hi,

do you mean something like a repo variable ?

If you define a module name in your repo:

 1-  module namespace myNs = 'http://www.x.fr/-repo’ 
;

You can define in your repo a new variable :

 1-declare variable $myNs:testid :=  
db:open(‘x')/utilisateurs/entry/sessions/session/id=session:id();

Then import your module in your restxq:

  1-   import module namespace isi = 'http://www.isilex.fr/isi-repo’ 
;

And access your variables: 

  1-$myNs:testid

More here: http://docs.basex.org/wiki/XQuery_3.0#External_Variables 


Sorry If I’m wrong and didn’t understand,

XLS
> Le 5 sept. 2017 à 01:37, Erik Peterson  a écrit :
> 
> How can I create a variable that is evaluated only once but accessed across 
> many RestXQ requests and sessions. I'm trying to cache data that comes from 
> an integration with an expensive operation. Does BaseX support something 
> similar to server variables like Mark Logic? 



[basex-talk] Server Variables, cached vars, etc

2017-09-04 Thread Erik Peterson
How can I create a variable that is evaluated only once but accessed across
many RestXQ requests and sessions. I'm trying to cache data that comes from
an integration with an expensive operation. Does BaseX support something
similar to server variables like Mark Logic?