Hi Sebastian,

In my Basex 9.0.1 and 8.6.7 you get two "true". 

Best,
Giuseppe

Universität Leipzig
Institute of Computer Science, NLP
Augustusplatz 10
04109 Leipzig
Deutschland
E-mail: celano@informatik.uni-leipzig.de
E-mail: giuseppegacelano@gmail.com
Web site 1: http://www.dh.uni-leipzig.de/wo/team/
Web site 2: https://sites.google.com/site/giuseppegacelano/

On May 11, 2018, at 1:50 AM, Sebastian Zimmer <sebastian.zimmer@uni-koeln.de> wrote:

Hi,

I have this script where I use the lookup operator to perform a unary lookup:

xquery version "3.1";
declare namespace array = "http://www.w3.org/2005/xpath-functions/array";

let $array := []

return (
  empty($array!?*),   (: returns false :)
  empty(
    for $i in 1 to array:size($array)
    return $array($i)
  )                  (: returns true  :)
)

I'm curious that the first expression returns false even though it should be equivalent to the second expression, if I read the XQuery spec [1] right:

If the context item is an array:
If the KeySpecifier is a wildcard ("*"), the UnaryLookup operator is equivalent to the following expression:
for $k in 1 to array:size(.)
return .($k)

But maybe I'm missing something. I'd be glad if you could help.

Best regards,
Sebastian Zimmer

[1] https://www.w3.org/TR/2017/REC-xquery-31-20170321/#id-unary-lookup