I’ve been noticing an inconsistent behavior in the GUI with BaseX 11 beta (build 17d8426).
I have a simple query on a database created from a CSV file. Sometimes it works, but sometimes the root context is evaluated as an empty sequence:
- rewrite context value: . -> () - rewrite util:root(nodes): util:root(()) -> ()
I notice this when I open the database as context and try to execute the query. After the query fails, if I try to click on the “home” icon in the result panel, it also returns an empty sequence, even though the database is open.
If I reopen the database and run the query, it works again.
Sample data:
<csv> <record> <entry>http://id.loc.gov/authorities/names/n00000121</entryhttp://id.loc.gov/authorities/names/n00000121%3c/entry> <entry>http://id.loc.gov/rwo/agents/n00000121</entryhttp://id.loc.gov/rwo/agents/n00000121%3c/entry> <entry>0.11861849</entry> </record> <record> <entry>http://id.loc.gov/authorities/names/n00000122</entryhttp://id.loc.gov/authorities/names/n00000122%3c/entry> <entry>http://id.loc.gov/rwo/agents/n00000122</entryhttp://id.loc.gov/rwo/agents/n00000122%3c/entry> <entry>0.11699477</entry> </record> <record> <entry>http://id.loc.gov/authorities/names/n00000267</entryhttp://id.loc.gov/authorities/names/n00000267%3c/entry> <entry>http://id.loc.gov/rwo/agents/n00000267</entryhttp://id.loc.gov/rwo/agents/n00000267%3c/entry> <entry>0.10811427</entry> </record> </csv>
Query (with DB open as context):
count(distinct-values( for $rec in /csv/record where contains($rec/entry[1], "id.loc.gov") return $rec/entry[1] ))
Thanks in advance, Tim
-- Tim A. Thompson (he, him) Librarian for Applied Metadata Research Yale University Library www.linkedin.com/in/timathompsonhttp://www.linkedin.com/in/timathompson
Hi Tim,
Thanks for your observation. We need more help to reproduce this: Could you describe in detail, and step by step, how to trigger this issue?
In addition, you could… • tell us more about your OS and JDK version • start BaseX on command line and share a possible stack trace with us • verify if the error also occurs with other XML input (such as <x/>) and other queries (such as .)
The simpler the use case, the better…
Thanks Christian
On Fri, Mar 1, 2024 at 6:11 PM Thompson, Timothy timothy.thompson@yale.edu wrote:
I’ve been noticing an inconsistent behavior in the GUI with BaseX 11 beta (build 17d8426).
I have a simple query on a database created from a CSV file. Sometimes it works, but sometimes the root context is evaluated as an empty sequence:
rewrite context value: . -> ()
rewrite util:root(nodes): util:root(()) -> ()
I notice this when I open the database as context and try to execute the query. After the query fails, if I try to click on the “home” icon in the result panel, it also returns an empty sequence, even though the database is open.
If I reopen the database and run the query, it works again.
Sample data:
<csv>
<record>
<entry>http://id.loc.gov/authorities/names/n00000121</entry> <entry>http://id.loc.gov/rwo/agents/n00000121</entry> <entry>0.11861849</entry>
</record>
<record>
<entry>http://id.loc.gov/authorities/names/n00000122</entry> <entry>http://id.loc.gov/rwo/agents/n00000122</entry> <entry>0.11699477</entry>
</record>
<record>
<entry>http://id.loc.gov/authorities/names/n00000267</entry> <entry>http://id.loc.gov/rwo/agents/n00000267</entry> <entry>0.10811427</entry>
</record>
</csv>
Query (with DB open as context):
count(distinct-values(
for $rec in /csv/record
where contains($rec/entry[1], "id.loc.gov")
return $rec/entry[1]
))
Thanks in advance,
Tim
Hi, Christian,
Yes, this is a tricky one to reproduce :)
I’ve made a short video that illustrates the behavior (attached). Here are the steps that typically (although not always) reproduce the issue for me:
1. Reboot computer. 2. Start BaseX GUI from command line. 3. Recreate the sample database for testing. 4. Run the sample query (wrapped in fn:count). Query returns 3. 5. Change the query to call fn:count using the sequence arrow operator instead. 6. Run the sample query again. Query returns 0, and queries are now “broken,” such that repeating step (4) also returns 0.
Here’s the additional information:
* MacBook Pro, Apple M2 Max, macOS Ventura (13.2.1) * JDK 17 (java 17.0.7 2023-04-18 LTS) * There’s no error that’s thrown, so I’m not certain about how to share a stack trace? * I’ve tried to reproduce the issue with other XML input and queries, but nothing else seems to trigger it.
All best, Tim
-- Tim A. Thompson (he, him) Librarian for Applied Metadata Research Yale University Library www.linkedin.com/in/timathompsonhttp://www.linkedin.com/in/timathompson
From: Christian Grün christian.gruen@gmail.com Date: Sunday, March 3, 2024 at 6:42 AM To: Thompson, Timothy timothy.thompson@yale.edu Cc: BaseX basex-talk@mailman.uni-konstanz.de Subject: Re: [basex-talk] Inconsistent behavior for root context in BaseX GUI Hi Tim,
Thanks for your observation. We need more help to reproduce this: Could you describe in detail, and step by step, how to trigger this issue?
In addition, you could… • tell us more about your OS and JDK version • start BaseX on command line and share a possible stack trace with us • verify if the error also occurs with other XML input (such as <x/>) and other queries (such as .)
The simpler the use case, the better…
Thanks Christian
On Fri, Mar 1, 2024 at 6:11 PM Thompson, Timothy <timothy.thompson@yale.edumailto:timothy.thompson@yale.edu> wrote: I’ve been noticing an inconsistent behavior in the GUI with BaseX 11 beta (build 17d8426).
I have a simple query on a database created from a CSV file. Sometimes it works, but sometimes the root context is evaluated as an empty sequence:
- rewrite context value: . -> () - rewrite util:root(nodes): util:root(()) -> ()
I notice this when I open the database as context and try to execute the query. After the query fails, if I try to click on the “home” icon in the result panel, it also returns an empty sequence, even though the database is open.
If I reopen the database and run the query, it works again.
Sample data:
<csv> <record> <entry>http://id.loc.gov/authorities/names/n00000121</entryhttp://id.loc.gov/authorities/names/n00000121%3c/entry> <entry>http://id.loc.gov/rwo/agents/n00000121</entryhttp://id.loc.gov/rwo/agents/n00000121%3c/entry> <entry>0.11861849</entry> </record> <record> <entry>http://id.loc.gov/authorities/names/n00000122</entryhttp://id.loc.gov/authorities/names/n00000122%3c/entry> <entry>http://id.loc.gov/rwo/agents/n00000122</entryhttp://id.loc.gov/rwo/agents/n00000122%3c/entry> <entry>0.11699477</entry> </record> <record> <entry>http://id.loc.gov/authorities/names/n00000267</entryhttp://id.loc.gov/authorities/names/n00000267%3c/entry> <entry>http://id.loc.gov/rwo/agents/n00000267</entryhttp://id.loc.gov/rwo/agents/n00000267%3c/entry> <entry>0.10811427</entry> </record> </csv>
Query (with DB open as context):
count(distinct-values( for $rec in /csv/record where contains($rec/entry[1], "id.loc.govhttp://id.loc.gov/") return $rec/entry[1] ))
Thanks in advance, Tim
Hi Tim,
Thanks for spending so much time on this, and the visual “proof”.
A mysterious one! The query seems to be correctly evaluated on my system, whatever I do.
- There’s no error that’s thrown, so I’m not certain about how to
share a stack trace?
Good to know. If no stack trace is output on command line, it’s at least no obvious bug.
- I’ve tried to reproduce the issue with other XML input and queries,
but nothing else seems to trigger it.
Good to know, too ;)
We’ll keep on trying. If someone else in our group manages to trigger the bug, I’ll give you an update. Feel free to share more information with us if you should manage to further isolate the bug.
Best, Christian
basex-talk@mailman.uni-konstanz.de