Hi,
I recently upgraded to BaseX 6.1. I now receive an error when running a query that run without complications in BaseX 6.0
The offending query has this prolog:
which results in
declare variable $metadata as xs:anyAtomicType := doc('libx2_meta')/metadata;
^
javax.xml.xquery.XQQueryException: Stopped at line 3, column 48:
[XQST0049] Duplicate definition of $metadata as xs:anyAtomicType.
at org.basex.api.xqj.BXQDynamicContext.execute(BXQDynamicContext.java:251)
at org.basex.api.xqj.BXQPreparedExpression.executeQuery(BXQPreparedExpression.java:54)
at org.libx.libappdatabase.Query.main(Query.java:100)
Simply exchanging BaseX61.jar with BaseX6.jar makes this query work as expected. I note that if I switch lines 3 and 4 (so that the 'declare variable $feed' appears first), the error is flagged on this line.
The query runs fine using the command-client in both BaseX 6 and 6.1
I'm using org.basex.api.xqj.BXQDataSource, following by prepareExpression, followed by executeQuery. This query has no external variables.
Another point of information: out of curiosity, I printed information about the prepared expression after prepareExpression like so:
System.out.println("external vars: " + Arrays.asList(pe.getAllExternalVariables()));
System.out.println("unbound vars: " + Arrays.asList(pe.getAllUnboundExternalVariables()));
this shows 'metadata' and 'feed' as external variables:
external vars: [metadata, feed]
unbound vars: []
Why are 'metadata' listed as external, even though they are not declared as such?
I would appreciate any insight. If the problem is mysterious, I can prepare a self-contained test case or aid in debugging.
Thanks.
- Godmar