Hi,
first of all: Great work! BaseX is the fastest/feature-rich XQuery Processor I have found so far.
Currently, I'm working on a RESTful Service, where your processor is a great enhancement.
So far, I've encountered a few problems.
First: There is problem with XQuery Update, especially with "insert", which is not always reproducable. Example query:
declare variable $newrec as node() external; insert node $newrec as first into basex:db('Recordings')/recordings
The variable $newrec is bound to a "recording" Node with XQJ *.bindNode(new QName("newrec"), node, null);
Sometimes, a ArrayIndexOutOfBoundsException is thrown in "org.basex.query.up.Primitives" at line 51.
I did a quick hack, and replaced the null constraint with: } else if(l.length < pos) { l = new UpdatePrimitive[PrimitiveType.values().length]; l[pos] = p;
But I think it's only a quick hack ..
The second problem I've encountered is with "order by" clause and XQJ API. Order by has no effect, if I use the XQJ Api something like this: XQResultSequence result = null; XQExpression loadExp = null; try { loadExp = this.xqueryManager.createExpression(); result = loadExp.executeQuery(queryString); while(result.next()) { // do something } }
But when I use the classes of BaseX directly, "order by" orders correctly. For example: QueryProcessor processor = new QueryProcessor(queryString, context); Result resultX = processor.query(); resultX.serialize(new XMLSerializer(out));
Sample query: element recordings { for $rec at $pos in basex:db('Recordings')/recordings/recording order by xs:dateTime($rec/startDate) descending return $rec }
Any comments are appreciated ;) Thanks!
Bye, Marcus