Well it is definitly an optimization that is new to BaseX 10. But I think I found a way to default to "" where I just passed () from a variable before.

Am 23.03.2023 um 15:00 schrieb Christian Grün:
Hi again, Omar,

The behavior may be surprising, but it's valid: If it can be detected at compile time that an expression will never yield results, it can be simplified and rewritten to an empty sequence, no matter if a referenced database may possibly exist at runtime.

Hope this helps,
Christian



Omar Siam <Omar.Siam@oeaw.ac.at> schrieb am Do., 23. März 2023, 14:49:
Hi,

Either I found an interesting new XQuery feature or a bug:

collection('i_do_not_exist')/some/path[@attr=()] retruns the empty sequence whereas

collection('i_do_not_exist')/some/path throws an error err:FODC0002 so does collection('i_do_not_exist')/ome/path[@attr="i_am_an_attr"]

Am I missing something?

Best regards,

--
Mag. Ing. Omar Siam
Austrian Center for Digital Humanities and Cultural Heritage
Österreichische Akademie der Wissenschaften | Austrian Academy of Sciences
Stellvertretende Behindertenvertrauensperson | Deputy representative for disabled persons
Bäckerstraße 13, 1010 Wien, Österreich | Vienna, Austria
T: +43 1 51581-7295
omar.siam@oeaw.ac.at | www.oeaw.ac.at/acdh


-- 
Mag. Ing. Omar Siam
Austrian Center for Digital Humanities and Cultural Heritage
Österreichische Akademie der Wissenschaften | Austrian Academy of Sciences
Stellvertretende Behindertenvertrauensperson | Deputy representative for disabled persons
Bäckerstraße 13, 1010 Wien, Österreich | Vienna, Austria
T: +43 1 51581-7295
omar.siam@oeaw.ac.at | www.oeaw.ac.at/acdh