Hi Cong,
BaseX XQJ supports XQuery 3.0, XQuery Update Facility as well as XQuery Full Text.
If you are executing an XQuery Update expression and the BaseX XQJ driver is producing an XQException where BaseX was never even contacted in the first place, then this is a bug in BaseX XQJ.
Bugs found in any XQJ driver from xqj.net can be reported at:
To find out for sure, I would suggest turning debug mode to its highest level, with code along the lines of:
XQDataSource ds = new BaseXXQDataSource();
ds.setProperty("logLevel", "TRACE"); ds.setLogWriter(new PrintWriter(System.out, true));
XQConnection xqc = ds.getConnection();
/** execute your update expression **/
Regarding the second problem, to make sure your XQResultSequences produced from an XQConnection instance is scrollable, you could use:
XQConnection xqc = ds.getConnection();
XQStaticContext xqsc = xqc.getStaticContext(); xqsc.setScrollability(XQConstants.SCROLLTYPE_SCROLLABLE); xqc.setStaticContext(xqsc);
/** execute expressions via xqc **/
Alternatively, you can create a scrollable copy of any type of XQSequence via the createSequence method, for instance:
XQResultSequence rs = executeQuery();
XQSequence scrollableCopy = xqc.createSequence(rs);
Hope this helps.
Kind Regards,
Charles
---------- Forwarded message ---------- From: Liu Cong p5j6npaa@126.com Date: Sat, Dec 7, 2013 at 8:23 PM Subject: [basex-talk] Seeking help on how to update XML file(INSERTION) To: basex-talk@mailman.uni-konstanz.de
Hi all,
Nice to be in this community!
We are currently doing a project on XML database using BaseX and using XQJ API to develop it in eclipse. What troubled us now is that when we doing an insertion or deletion, there is actually nothing changed in the XML file. Then I checked that it seems that XQJ is not available to XQuery update. Is it really like that? Otherwise, how can we write or delete things in the XML file?
Another problem: when we want to show what has been changed for the cached XML file, I get this notification: '' According to the XQJ 1.0 Specification, executing expressions via XQPreparedExpression or XQExpression implicitly closes the previously created XQResultSequence object which was tied to the parent XQConnection object. To keep a XQResultSequence alive and accessible, you could either create an immutable XQSequence by using XQConnection.createSequence(XQResultSequence) or modify the XQStaticContext's Scrollability property to ensure that future XQResultSequence objects will be "SCROLLABLE" (cached) and not "FORWARD_ONLY" (streamed). Please read the XQJ.NET documentation for further details.'
I understand what does it mean but do not quite understand how to use XQConnection.createSequence(XQResultSequence) or modify the XQStaticContext's Scrollability property. Could you kindly give me some guidance on that?
My code is like:" XQPreparedExpression aaa =xqc.prepareExpression(.......); XQPreparedExpression bbb =xqc.prepareExpression(.......);
XQResultSequence rs = aaa.executeQuery(); XQResultSequence as = bbb.executeQuery();
while(rs.next()) System.out.println(rs.getItemAsString(null)); System.out.println(as.getItemAsString(null));"
Many thanks!
Cong Liu
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de