Java from XQuery

Friday, 2 October 2015 · 8 messages · last reply 9 Oct 2015
M
meumapple2 Oct 2015 01:20 #
Hi All, It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks. Joseph
CG
Christian Grün2 Oct 2015 12:04 #
Hi Joseph,
Quoted text · meumapple · 1 line
> It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks.
To me, it's not clear what you mean with "running a jar file"? Would you like to invoke the class that's specified in the MANIFEST.MF file, or any other class? Christian
M
meumapple3 Oct 2015 03:11 #
Hi Cristian, Yes, I mean the main method of the class specified in the main-class header in MANIFEST, which is executed when you command: java -jar file.jar Thanks! J.
Quoted text · Christian Grün · 1 line
Il giorno 02/ott/2015, alle ore 12:04, Christian Grün <christian.gruen at gmail.com> ha scritto:
Hi Joseph,
Quoted text · Christian Grün · 1 line
> It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks.
To me, it's not clear what you mean with "running a jar file"? Would you like to invoke the class that's specified in the MANIFEST.MF file, or any other class? Christian
CG
Christian Grün3 Oct 2015 10:21 #
I see. In that case, you should add the JAR file to your classpath and address this class in your XQuery code via our Java binding [1]. If the JAR file cannot be added to the classpath, you will need to start a separate Java process and address via the process module: proc:system("java", "-jar", "...") [2]. [1] http://docs.basex.org/wiki/Java_Bindings [2] http://docs.basex.org/wiki/Process_Module
Quoted text · meumapple · 19 lines
On Sat, Oct 3, 2015 at 3:11 AM, meumapple <meumapple at gmail.com> wrote: > Hi Cristian, > > Yes, I mean the main method of the class specified in the main-class header in MANIFEST, which is executed when you command: java -jar file.jar > > Thanks! > J. > > Il giorno 02/ott/2015, alle ore 12:04, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Hi Joseph, > >> It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks. > > To me, it's not clear what you mean with "running a jar file"? Would > you like to invoke the class that's specified in the MANIFEST.MF file, > or any other class? > > Christian
M
meumapple4 Oct 2015 00:51 #
Hi Cristian, I have used the proc:execute function for a java command and it works. I use that to invoke a linguistic parser whose output is by default written into a file (XML). I would like to open such a file with doc(), but doc() is processed before the file created with proc:execute is written into the file. What is the best way to force doc() to wait until the file outputted by proc:execute is written? Thanks. J. Ps: is there any significant difference in performance between using java bindings and proc:execute?
Quoted text · Christian Grün · 1 line
Il giorno 03/ott/2015, alle ore 10:21, Christian Grün <christian.gruen at gmail.com> ha scritto:
I see. In that case, you should add the JAR file to your classpath and address this class in your XQuery code via our Java binding [1]. If the JAR file cannot be added to the classpath, you will need to start a separate Java process and address via the process module: proc:system("java", "-jar", "...") [2]. [1] http://docs.basex.org/wiki/Java_Bindings [2] http://docs.basex.org/wiki/Process_Module
Quoted text · meumapple · 19 lines
> On Sat, Oct 3, 2015 at 3:11 AM, meumapple <meumapple at gmail.com> wrote: > Hi Cristian, > > Yes, I mean the main method of the class specified in the main-class header in MANIFEST, which is executed when you command: java -jar file.jar > > Thanks! > J. > > Il giorno 02/ott/2015, alle ore 12:04, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Hi Joseph, > >> It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks. > > To me, it's not clear what you mean with "running a jar file"? Would > you like to invoke the class that's specified in the MANIFEST.MF file, > or any other class? > > Christian
M
meumapple4 Oct 2015 00:54 #
Hi Christian, I have used the proc:execute function for a java command and it works. I use that to invoke a linguistic parser whose output is by default written into a file (XML). I would like to open such a file with doc(), but doc() is processed before the file created with proc:execute is written into the file. What is the best way to force doc() to wait until the file outputted by proc:execute is written? Thanks. J. Ps: is there any significant difference in performance between using java bindings and proc:execute?
Quoted text · Christian Grün · 1 line
Il giorno 03/ott/2015, alle ore 10:21, Christian Grün <christian.gruen at gmail.com> ha scritto:
I see. In that case, you should add the JAR file to your classpath and address this class in your XQuery code via our Java binding [1]. If the JAR file cannot be added to the classpath, you will need to start a separate Java process and address via the process module: proc:system("java", "-jar", "...") [2]. [1] http://docs.basex.org/wiki/Java_Bindings [2] http://docs.basex.org/wiki/Process_Module
Quoted text · meumapple · 19 lines
> On Sat, Oct 3, 2015 at 3:11 AM, meumapple <meumapple at gmail.com> wrote: > Hi Cristian, > > Yes, I mean the main method of the class specified in the main-class header in MANIFEST, which is executed when you command: java -jar file.jar > > Thanks! > J. > > Il giorno 02/ott/2015, alle ore 12:04, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Hi Joseph, > >> It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks. > > To me, it's not clear what you mean with "running a jar file"? Would > you like to invoke the class that's specified in the MANIFEST.MF file, > or any other class? > > Christian
M
meumapple9 Oct 2015 19:10 #
I reforward this email, if anyone knows about this problem: I have used the proc:execute function for a java command and it works. I use that to invoke a linguistic parser whose output is by default written into a file (XML). I would like to open such a file with doc(), but doc() is processed before the file created with proc:execute is written into the file. What is the best way to force doc() to wait until the file outputted by proc:execute is written? Thanks. J. Ps: is there any significant difference in performance between using java bindings and proc:execute?
Quoted text · Christian Grün · 1 line
Il giorno 03/ott/2015, alle ore 10:21, Christian Grün <christian.gruen at gmail.com> ha scritto:
I see. In that case, you should add the JAR file to your classpath and address this class in your XQuery code via our Java binding [1]. If the JAR file cannot be added to the classpath, you will need to start a separate Java process and address via the process module: proc:system("java", "-jar", "...") [2]. [1] http://docs.basex.org/wiki/Java_Bindings [2] http://docs.basex.org/wiki/Process_Module
Quoted text · meumapple · 19 lines
> On Sat, Oct 3, 2015 at 3:11 AM, meumapple <meumapple at gmail.com> wrote: > Hi Cristian, > > Yes, I mean the main method of the class specified in the main-class header in MANIFEST, which is executed when you command: java -jar file.jar > > Thanks! > J. > > Il giorno 02/ott/2015, alle ore 12:04, Christian Grün <christian.gruen at gmail.com> ha scritto: > > Hi Joseph, > >> It is not clear to me if I can run from XQuery a .jar file (it is a simple linguistic parser). Any idea about that? Thanks. > > To me, it's not clear what you mean with "running a jar file"? Would > you like to invoke the class that's specified in the MANIFEST.MF file, > or any other class? > > Christian
AB
Andy Bunce9 Oct 2015 23:15 #
Hi Joseph, This works for me. Where parser.bat is creating out.xml in the folder where the xquery is running. This maybe a case of trying to stop the optimizer, some simpler versions of this did not work
let $uri-process:=file:resolve-path("parser.bat",static-base-uri())
let $uri-output:=file:resolve-path("out.xml",static-base-uri())
let $_:=proc:execute($uri-process)
return doc($uri-output)
/Andy
Quoted text · meumapple · 51 lines
On 9 October 2015 at 18:10, meumapple <meumapple at gmail.com> wrote: > I reforward this email, if anyone knows about this problem: > > I have used the proc:execute function for a java command and it works. I > use that to invoke a linguistic parser whose output is by default written > into a file (XML). I would like to open such a file with doc(), but doc() > is processed before the file created with proc:execute is written into the > file. What is the best way to force doc() to wait until the file outputted > by proc:execute is written? Thanks. > > J. > > Ps: is there any significant difference in performance between using java > bindings and proc:execute? > > Il giorno 03/ott/2015, alle ore 10:21, Christian Grün < > christian.gruen at gmail.com> ha scritto: > > I see. In that case, you should add the JAR file to your classpath and > address this class in your XQuery code via our Java binding [1]. If > the JAR file cannot be added to the classpath, you will need to start > a separate Java process and address via the process module: > proc:system("java", "-jar", "...") [2]. > > [1] http://docs.basex.org/wiki/Java_Bindings > [2] http://docs.basex.org/wiki/Process_Module > > > > On Sat, Oct 3, 2015 at 3:11 AM, meumapple <meumapple at gmail.com> wrote: > > Hi Cristian, > > > > Yes, I mean the main method of the class specified in the main-class > header in MANIFEST, which is executed when you command: java -jar file.jar > > > > Thanks! > > J. > > > > Il giorno 02/ott/2015, alle ore 12:04, Christian Grün < > christian.gruen at gmail.com> ha scritto: > > > > Hi Joseph, > > > >> It is not clear to me if I can run from XQuery a .jar file (it is a > simple linguistic parser). Any idea about that? Thanks. > > > > To me, it's not clear what you mean with "running a jar file"? Would > > you like to invoke the class that's specified in the MANIFEST.MF file, > > or any other class? > > > > Christian >

⚡Generated with XQuery