Re: [basex-talk] Improper use error

2024-01-12 Thread Christian Grün
Hi Dharmendra,

We can only give limited free support for older versions of BaseX. Please
check if the behavior can be reproduced with the latest release.

Thanks in advance
Christian




DK Singh  schrieb am Fr., 12. Jan. 2024, 17:11:

> Hi i am executing the simple
> command  uri-collection('SYS_CONTENT_METADATA') and i am getting the below
> error:
>
> Error:
> Improper use? Potential bug? Your feedback is welcome:
> Contact: basex-talk@mailman.uni-konstanz.de
> Version: BaseX 9.5
> Java: Oracle Corporation, 1.8.0_151
> OS: Windows Server 2012 R2, amd64
> Stack Trace:
> java.lang.ArrayIndexOutOfBoundsException
>
> Can you please suggest how to resolve this issue?
>
> Thanks
> Dharmendra Kumar Singh
>
>
>


[basex-talk] Improper use error

2024-01-12 Thread DK Singh
Hi i am executing the simple
command  uri-collection('SYS_CONTENT_METADATA') and i am getting the below
error:

Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.5
Java: Oracle Corporation, 1.8.0_151
OS: Windows Server 2012 R2, amd64
Stack Trace:
java.lang.ArrayIndexOutOfBoundsException

Can you please suggest how to resolve this issue?

Thanks
Dharmendra Kumar Singh


Re: [basex-talk] Processing stack traces in XQuery code

2024-01-12 Thread Omar Siam

Hi Christian,

So I already forgot about the first few lines of the message (I always 
cut them away).
What I miss is the rest, the stack trace, the list of calls that got me 
to that line:


I need something like
`Stopped at { $err:module }, { $err:line-number }/{ $err:column-number }:
{ $err:description }
{ $err:stack-trace }`

I create XML and JSON according to an RFC and I want to be able to have 
the trace there.
I already use { $err:module }, { $err:line-number }, { 
$err:column-number } and { $err:description } E. g:


https://tools.ietf.org/html/rfc7807/tests
  _:an-error: testError Test1 Test2 Test3
   Test1 Test2 Test3
https://tools.ietf.org/html/rfc7807/tests/an-error
  500
  /app/tests/api-problem-rest-test.xqm, 38/10
- /app/tests/api-problem-rest-test.xqm, 34/16
- /app/tests/api-problem-rest-test.xqm, 30/15
- /app/tests/api-problem-rest-test.xqm, 26/15
- /app/tests/api-problem-rest-test.xqm, 21/58
- /app/api-problem/api-problem.xqm, 41/26
  
  3.55


While in 10.7+ I only get


  https://tools.ietf.org/html/rfc7807/tests
  _:an-error: testError Test1 Test2 Test3
   Test1 Test2 Test3
  https://tools.ietf.org/html/rfc7807/tests/an-error
  500
  /app/tests/api-problem-rest-test.xqm, 38/10
  2.15



See 
https://github.com/acdh-oeaw/api-problem4restxq/blob/master/tests/api-problem-rest-test.xqm#L15-L23 
for details.

There is a docker image using 10.6 for quick testing.
docker run --rm -it -p 5000:5000 ghcr.io/acdh-oeaw/api-problem4restxq vs
docker run --rm -it -p 5000:5000 
ghcr.io/acdh-oeaw/api-problem4restxq:27f2a42

Look at to http://localhost:5000

Best regards
Omar

Am 12.01.2024 um 14:14 schrieb Christian Grün:

Hi Omar,

Thanks for your observation.

We have removed the BaseX-specific string output, as it was redundant. 
You should be able to reproduce the old output as follows (using the 
new XQuery 4 string template syntax):


`Stopped at { $err:module }, { $err:line-number }/{ $err:column-number }:
{ $err:description }`

As you’ve already discovered the responsible commit, you may have 
discovered the new XQuery 4 $err:map variable: It bundles all other 
error values into a single variable.


And @Martin Honnen thanks for mentioning fn:stack-trace. The function 
is still under discussion and might be dropped again: The 
specification gives processors much freedom in optimizing its 
expressions, so it’s hardly possible to define the function in a way 
that’s not completely implementation-defined.


Hope this helps,
Christian


--
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] Corrupt data base not recognized by inspect

2024-01-12 Thread Christian Grün
Dear Jürgen,

Thanks for the observation.

In fact, the existing consistency checks won’t allow you to completely rule
out inconsistencies in databases. If your data is not strictly
confidential, we invite you to share the corrupt database instance with us,
it may help us to improve our checks. In addition, it could be interesting
to learn more about the update operation that was running during the power
fail (provided it was logged, e.g. in the data/.logs directory).

All the best,
Christian



On Thu, Jan 11, 2024 at 6:07 PM Jürgen Schwenk Büro <
juergen.schw...@gruendler.de> wrote:

> Hello,
>
> in our application we "produced" a corrupt data base caused by a power
> fail. On restart we check data base using the "inspect" command to detect
> failures, creating new empty data base if found one. The attached data base
> seems OK using "inspect", but accessing the data base we get an exception.
> Perhaps this may help to make "inspect" more reliable.
>
> Thanks a lot,
>
> Jürgen Schwenk
>
>
> Client output:
>
> > list
> Name  Resources  Size Input Path
>
> ---
> VentilutionOnlineDataBaseCorrupt  1  1170
> VentilutionOnlineDataBase.xml
>
> 1 database(s).
>
> > open VentilutionOnlineDataBaseCorrupt
> Database 'VentilutionOnlineDataBaseCorrupt' was opened in 0.03 ms.
>
> > inspect
> Checking main table (152 nodes):
> - 0 invalid node kinds
> - 0 invalid parent references
> - 0 wrong parent/descendant relationships
> No inconsistencies found.
> 'VentilutionOnlineDataBaseCorrupt' inspected in 0.06 ms.
>
> > xquery //*
> Improper use? Potential bug? Your feedback is welcome:
> Contact: basex-talk@mailman.uni-konstanz.de
> Version: BaseX 10.1
> Java: Eclipse Adoptium, 17.0.4
> OS: Windows 10, amd64
> Stack Trace:
> java.lang.RuntimeException: Data Access out of bounds:
> - pre value: 152
> - table size: 152
> - first/next pre value: 0/152
> - #total/used pages: 1/1
> - accessed page: 0 (1 > 0]
> at org.basex.util.Util.notExpected(Util.java:64)
> at
> org.basex.io.random.TableDiskAccess.cursor(TableDiskAccess.java:477)
> at
> org.basex.io.random.TableDiskAccess.read1(TableDiskAccess.java:158)
> at org.basex.data.Data.kind(Data.java:312)
> at org.basex.query.value.node.DBNode$6.next(DBNode.java:402)
> at org.basex.query.value.node.DBNode$6.next(DBNode.java:1)
> at org.basex.query.expr.path.IterStep$1.next(IterStep.java:38)
> at org.basex.query.expr.path.IterStep$1.next(IterStep.java:1)
> at org.basex.query.QueryContext.next(QueryContext.java:375)
> at org.basex.query.expr.path.IterPath$1.next(IterPath.java:48)
> at org.basex.query.scope.MainModule$1.next(MainModule.java:55)
> at org.basex.core.cmd.AQuery.run(AQuery.java:88)
> at org.basex.core.Command.run(Command.java:233)
> at org.basex.core.Command.execute(Command.java:93)
> at org.basex.server.ClientListener.run(ClientListener.java:141)
>
> Query "softwareProjectVentilution" executed in 0.31 ms.
>
>
> --
>
>
> --
>
> Jürgen Schwenk
> - R Engineer -
>
>
>
>
> Gründler GmbH Tel: +49 (0)7441 40761-14
> Jaspisstrasse 23 Fax: +49 (0)7441 40761-99
> 72250 Freudenstadt E-Mail: juergen.schw...@gruendler.de
> --
>
>
> --
>
> Jürgen Schwenk
> - R Engineer -
>
>
>
>
> Gründler GmbH Tel: +49 (0)7441 40761-14
> Jaspisstrasse 23 Fax: +49 (0)7441 40761-99
> 72250 Freudenstadt E-Mail: juergen.schw...@gruendler.de
>


Re: [basex-talk] Processing stack traces in XQuery code

2024-01-12 Thread Christian Grün
Hi Omar,

Thanks for your observation.

We have removed the BaseX-specific string output, as it was redundant. You
should be able to reproduce the old output as follows (using the new XQuery
4 string template syntax):

`Stopped at { $err:module }, { $err:line-number }/{ $err:column-number }:
{ $err:description }`

As you’ve already discovered the responsible commit, you may have
discovered the new XQuery 4 $err:map variable: It bundles all other error
values into a single variable.

And @Martin Honnen thanks for mentioning fn:stack-trace. The function is
still under discussion and might be dropped again: The specification gives
processors much freedom in optimizing its expressions, so it’s hardly
possible to define the function in a way that’s not completely
implementation-defined.

Hope this helps,
Christian


On Thu, Jan 11, 2024 at 12:52 PM Omar Siam  wrote:

> I think stack traces were removed in this commit from
> basex-core/src/main/java/org/basex/query/expr/Catch.java
>
> Revision: fc2376f6c9c250babfac7a7161b8a61740878b2b
> Author: Christian Grün  
> Date: 17.05.2023 11:25:01
> Message:
> [XQ4] try/catch, $err:map
>
> 
> Modified: basex-api/src/main/java/org/basex/http/restxq/RestXqFunction.java
> Modified: basex-core/src/main/java/org/basex/query/QueryParser.java
> Modified: basex-core/src/main/java/org/basex/query/expr/Catch.java
> Modified: basex-core/src/test/java/org/basex/query/expr/XQuery4Test.java
>
> line 141 ->  151
> qe.getMessage() is now replaced with an Empty.VALUE const.
>
> Am 11.01.2024 um 12:39 schrieb Martin Honnen:
>
>
>
> Am 11.01.2024 um 12:37 schrieb Omar Siam 
> :
>
> I get: Unknown function: fn:stack-trace() when I use stack-trace().
>
>
> Ah, sorry, it looks like it is not yet implemented. Wait for Christian to
> give you hopefully some better info than my ill guess.
>
>
> --
> 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-7295omar.s...@oeaw.ac.at | www.oeaw.ac.at/acdh
>
>