Thanks, Arthur. If there is any chance to get an SSCCE that would be marvellous ;)



Gardner, Arthur <arthur.gardner@metlife.com> schrieb am Do., 16. Mai 2019, 17:36:

I found the difference between the snippet and our existing code.  In our case, there will only ever be one result.  But the second next() should return false.  Instead, it throws an Exception.

 

Existing (fails with BaseX):

 

while (rs.next()) {

                rs.writeSequenceToResult(new StreamResult(sw));

}

 

Snippet (works):

 

rs.next();

rs.writeSequenceToResult(new StreamResult(sw));

 

 

Arthur Gardner | Infosys Ltd

MetLife | Clarks Summit, PA

Office 570-587-6898 | Mobile 262-442-7472

 

From: Gardner, Arthur
Sent: Wednesday, May 15, 2019 2:09 PM
To: Christian Grün <christian.gruen@gmail.com>
Cc: basex-talk@mailman.uni-konstanz.de
Subject: RE: [EXT] Re: [basex-talk] Adventures with XQJ

 

No, I can’t.

 

To elaborate, I wrote a code snippet, covering all that I need to do, and it worked.

 

So the issue is with us.

 

😊

 

Arthur Gardner | Infosys Ltd

MetLife | Clarks Summit, PA

Office 570-587-6898 | Mobile 262-442-7472

 

From: Christian Grün <christian.gruen@gmail.com>
Sent: Tuesday, May 14, 2019 2:06 PM
To: Gardner, Arthur <arthur.gardner@metlife.com>
Cc: basex-talk@mailman.uni-konstanz.de
Subject: [EXT] Re: [basex-talk] Adventures with XQJ

 

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

 

 

 

 

 

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):

 

cid:image001.jpg@01D50B27.AF8CFBA0

 

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.