Hi,
I have developed a restxq service, which executes a command via the process module. The command is actually java (java -cp ...) which actionates a linguistic parser: unfortunately the time of loading/opening of the java process is quite long (14 sec., also at the command line) even if the actual parsing is very fast. I am looking for a way to keep such a java process "open", so that a user's request can be satisfied much much quickier (while now the java process is opened and then closed for each single request). I am not sure this is a question for Basex users (the problem is only due to java), but I am not a java developer at all and I am trying to understand what can be done in this respect. Thanks!
Joseph
Hi Joseph,
You could try to copy your Java library into the 'lib' directory of BaseX. After that, you can directly access it via XQuery Java Bindings [1].
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Java_Bindings
I have developed a restxq service, which executes a command via the process module. The command is actually java (java -cp ...) which actionates a linguistic parser: unfortunately the time of loading/opening of the java process is quite long (14 sec., also at the command line) even if the actual parsing is very fast. I am looking for a way to keep such a java process "open", so that a user's request can be satisfied much much quickier (while now the java process is opened and then closed for each single request). I am not sure this is a question for Basex users (the problem is only due to java), but I am not a java developer at all and I am trying to understand what can be done in this respect. Thanks!
Joseph
Hi Christian,
I have put my jar file in lib but I am not sure I am accessing it in the right way. The bash command is "java -cp myparser.jar is.tag.Tagger -model /mymodel -input /myfile.txt -output /result.txt"
How should I translate this via xquery bindings?
Thanks!
Il giorno 22 apr 2016, alle ore 11:03, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
You could try to copy your Java library into the 'lib' directory of BaseX. After that, you can directly access it via XQuery Java Bindings [1].
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Java_Bindings
I have developed a restxq service, which executes a command via the process module. The command is actually java (java -cp ...) which actionates a linguistic parser: unfortunately the time of loading/opening of the java process is quite long (14 sec., also at the command line) even if the actual parsing is very fast. I am looking for a way to keep such a java process "open", so that a user's request can be satisfied much much quickier (while now the java process is opened and then closed for each single request). I am not sure this is a question for Basex users (the problem is only due to java), but I am not a java developer at all and I am trying to understand what can be done in this respect. Thanks!
Joseph
Hi Joseph,
I have put my jar file in lib but I am not sure I am accessing it in the right way. The bash command is "java -cp myparser.jar is.tag.Tagger -model /mymodel -input /myfile.txt -output /result.txt"
There is no need to use the Process Module anymore. Instead, you’ll need to invoke the Tagger method. It could work as follows:
declare namespace tagger = "is.tag.Tagger"; tagger:main("-model", "/mymodel", "-input", "/myfile.txt", "-output", "/result.txt")
If it doesn’t, you should (if possible) have a look at the Java sources and check how to properly invoke or instantiate the Java class.
Cheers, Christian
How should I translate this via xquery bindings?
Thanks!
Il giorno 22 apr 2016, alle ore 11:03, Christian Grün christian.gruen@gmail.com ha scritto:
Hi Joseph,
You could try to copy your Java library into the 'lib' directory of BaseX. After that, you can directly access it via XQuery Java Bindings [1].
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Java_Bindings
I have developed a restxq service, which executes a command via the process module. The command is actually java (java -cp ...) which actionates a linguistic parser: unfortunately the time of loading/opening of the java process is quite long (14 sec., also at the command line) even if the actual parsing is very fast. I am looking for a way to keep such a java process "open", so that a user's request can be satisfied much much quickier (while now the java process is opened and then closed for each single request). I am not sure this is a question for Basex users (the problem is only due to java), but I am not a java developer at all and I am trying to understand what can be done in this respect. Thanks!
Joseph
basex-talk@mailman.uni-konstanz.de