Hi all,
trying to understand why we get the exception [2] running the code [1] in a Java app, I stumbled upon a strange behaviour of the GUI.
I rewrote the query to:
xquery:eval(" declare variable $_dep as xs:long* external; $_dep[2] * $_dep[2]", map{ "_dep" : (1,2,3)})
obtaining the correct result (4).
Anyway if I assign (1,2,3) to a binding through the proper dialog of the UI I get the following exception at execution:
Error: Stopped at /home/lettere/git/dasbox-frontend/dasbox-frontend-ui/webapp/ui/resources/js/monitoring/file, 2/12: [FORG0001] Cannot cast to xs:double: (1,2,3).
Strangely enough this happens even if I leave the map overriding locally the values for the external parameters in the xquery:eval. The dialog wins?
If I rewrite the query like this and remove the parameter values from the dialog:
xquery:eval(" declare variable $_dep as xs:long* external := (1,2,3);
$_dep[2] * $_dep[2]")
I get yet another typecast exception:
Error: Stopped at /home/lettere/git/dasbox-frontend/dasbox-frontend-ui/webapp/ui/resources/js/monitoring/file, 2/12: [XPTY0004] Cannot promote xs:integer+ to $_dep as xs:long*: (1, 2, 3).
Is there a nice wording to explain all this different behaviour and might it be that the exception we get in the Java embedded version is somehow related to the same?
Thanks a lot for helping,
Marco.
[1]
declare variable $_history as xs:long* external; declare variable $_now as xs:dateTime external; declare variable $_dep as xs:long* external; declare variable $dep as xs:long external;
$_dep[2] * $_dep[2]
[2]
Caused by: org.basex.query.QueryException: [FORG0001] Cannot cast to xs:double: [Ljava.lang.Object;@2f0539f0. at org.basex.query.QueryError.get(QueryError.java:1365) ~[BaseX.jar:8.6.7] at org.basex.query.QueryError.castError(QueryError.java:1571) ~[BaseX.jar:8.6.7] at org.basex.query.value.item.Dbl.parse(Dbl.java:180) ~[BaseX.jar:8.6.7] at org.basex.query.value.item.Item.dbl(Item.java:134) ~[BaseX.jar:8.6.7] at org.basex.query.value.type.AtomType.checkLong(AtomType.java:927) ~[BaseX.jar:8.6.7] at org.basex.query.value.type.AtomType$20.cast(AtomType.java:331) ~[BaseX.jar:8.6.7] at org.basex.query.value.type.AtomType$20.cast(AtomType.java:1) ~[BaseX.jar:8.6.7] at org.basex.query.QueryContext.cast(QueryContext.java:733) ~[BaseX.jar:8.6.7] at org.basex.query.QueryContext.bind(QueryContext.java:486) ~[BaseX.jar:8.6.7] at org.basex.query.QueryProcessor.bind(QueryProcessor.java:129) ~[BaseX.jar:8.6.7] at com.nw.basex.xquery.XQueryExecutor.bind(XQueryExecutor.java:89) ~[com.nw.dasbox-2018-03-15.jar:?] at com.nw.basex.xquery.XQueryExecutor.execute(XQueryExecutor.java:107) ~[com.nw.dasbox-2018-03-15.jar:?] at com.nw.dasbox.vdr.resolution.InlineXQueryResolutionEngine.evaluate(InlineXQueryResolutionEngine.java:91) ~[com.nw.dasbox-2018-03-15.jar:?] ... 10 more