Re: [basex-talk] collection('i_do_not_exist')/users/user[@name=()] is () even if i_do_not_exist does not exit

2023-03-23 Thread Christian Grün
>
> 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.
>

True. With BaseX 10, XQuery compilation was split up into a static
(logical) and a dynamic (physical) step to allow for a more fine granular
locking. In the static compilation, your expression will be rewritten as
follows:

collection('i_do_not_exist')/users/user[@name=()]
→collection('i_do_not_exist')/users/user[false()]
→collection('i_do_not_exist')/users/()
→collection('i_do_not_exist')/()
→()


Re: [basex-talk] collection('i_do_not_exist')/users/user[@name=()] is () even if i_do_not_exist does not exit

2023-03-23 Thread Omar Siam
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  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.s...@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.s...@oeaw.ac.at  |www.oeaw.ac.at/acdh


Re: [basex-talk] collection('i_do_not_exist')/users/user[@name=()] is () even if i_do_not_exist does not exit

2023-03-23 Thread 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  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.s...@oeaw.ac.at | www.oeaw.ac.at/acdh
>
>