Hi Arthur,
Can you provide us with a little code snippet (ideally self-contained) that allows us to reproduce the problem?
Examples on how to run queries via Java (with and without XQJ) can be found in our Wiki [1].
Thanks in advance, Christian
[1] http://docs.basex.org/wiki/Java_Examples
On Tue, May 14, 2019 at 7:58 PM Gardner, Arthur arthur.gardner@metlife.com wrote:
Hi folks.
First a disclaimer: I’m omitting a lot of information, because there is hardly any limit to what I *could* include.
Instead, I’ll mention what seems most important, then dialog if anyone shows an interest.
The objective: convert an existing private java library from ddxq to BaseX.
I am using these libraries, all coming to me via BaseX (I think):
My intention is to use the local option … this library is already running in the server (or in Eclipse).
*import* net.xqj.basex.local.BaseXXQDataSource;
Here’s my connection code (actually a constructor method):
*public* XQTransformer (String xqueryName) *throws* Exception { String queryPath = String.*format*(*filePath*, xqueryName); URI queryUri = *new* URI(queryPath); FileReader xqueryReader = *new* FileReader(*new* File(
queryUri));
xqds = *new* BaseXXQDataSource(); //xqds.setOptions("serialize=indent=yes"); //xqds.setBaseUri(queryPath); xqconnection = xqds.getConnection(); XQStaticContext context = xqconnection.getStaticContext(); context.setBindingMode(XQConstants.*BINDING_MODE_IMMEDIATE*); xqconnection.setStaticContext(context); xqpe = xqconnection.prepareExpression(xqueryReader); }
setBaseUri is for references from the xQuery to helper files in the same directory. Later I compensate by overriding the current user directory.
But I am throwing an Exception here:
*while* (!rs.isClosed() && rs.next()) {
*java.lang.NullPointerException*
at org.basex.query.QueryContext.next(*QueryContext.java:353*) at org.basex.query.expr.gflwor.GFLWOR$1.next(*GFLWOR.java:64*) at org.basex.query.QueryContext.next(*QueryContext.java:353*) at org.basex.query.scope.MainModule$1.next(*MainModule.java:101*) at net.xqj.basex.bin.h.b(Unknown Source) at net.xqj.basex.bin.r.a(Unknown Source) at net.xqj.basex.bin.bL.next(Unknown Source) at net.xqj.basex.bin.bR.next(Unknown Source) at com.emc.metlife.util.xql.XqueryTransformation.xmlFormatted(
*XqueryTransformation.java:89*)
at com.emc.metlife.util.xql.XqueryTransformation.getTransformedData(
*XqueryTransformation.java:194*)
at com.emc.metlife.util.xql.XqueryPooledTester.test(
*XqueryPooledTester.java:58*)
at com.emc.metlife.util.xql.XqueryPooledTester.main(
*XqueryPooledTester.java:43*)
The particular xquery file is working for me in the BaseX GUI.
Thanks!
Arthur Gardner | Infosys Ltd
MetLife | Clarks Summit, PA
Office 570-587-6898 | Mobile 262-442-7472
The information contained in this message may be CONFIDENTIAL and is for the intended addressee only. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, please notify the sender immediately and delete this message.