Doc-available() function, behavior?
Saturday, 25 April 2020 · 5 messages · last reply 26 Apr 2020
AL
Arjan Loeffen25 Apr 2020 17:55 #
Dear Basex People,
I have this fragment:
let $xml-doc := 'MyDatabase/bogus-entry.xml'
let $list := *if (doc-available($xml-doc)) then doc($xml-doc)/** else ()
return $listI'd expect BaseX to return the empty sequence when the document is not in the collection. But Basex returns an error:
[basex:doc] Database path 'MyDatabase/bogus-entry.xml' yields no documents.
What am I doing wrong? I thought I was following the example in https://docs.basex.org/wiki/Databases#XML_Documents nicely...
Thanks in advance!!
--
*Arjan Loeffen*
Armatiek BV & Armatiek Solutions BV
06-12918997
AL
Arjan Loeffen26 Apr 2020 10:39 #
It seems that in VERSION 9.3 (November 29, 2019) the
doc-available($xml-doc) seems to be broken; it should return a boolean but throws an exception.
Has this been fixed recently? Cannot find a reference to such a fix in GIT.
Arjan
---------- Forwarded message ---------
Quoted text · Arjan Loeffen · 23 lines
Van: Arjan Loeffen <arjan.loeffen at armatiek.nl> Date: za 25 apr. 2020 om 17:55 Subject: Doc-available() function, behavior? To: BaseX <basex-talk at mailman.uni-konstanz.de> Dear Basex People, I have this fragment: let $xml-doc := 'MyDatabase/bogus-entry.xml' let $list := *if (doc-available($xml-doc)) then doc($xml-doc)/** else () return $list I'd expect BaseX to return the empty sequence when the document is not in the collection. But Basex returns an error: [basex:doc] Database path 'MyDatabase/bogus-entry.xml' yields no documents. What am I doing wrong? I thought I was following the example in https://docs.basex.org/wiki/Databases#XML_Documents nicely... Thanks in advance!! -- *Arjan Loeffen* Armatiek BV & Armatiek Solutions BV 06-12918997 -- *Arjan Loeffen* Armatiek BV & Armatiek Solutions BV 06-12918997
CG
Christian Grün26 Apr 2020 11:50 #
Hi Arjan,
The bug came in when we changed the error codes of db:open for non-existing documents (maybe that already happened with 9.0.x?). With the latest snapshot [1],
fn:doc-available works for database documents again.
Thanks for the pointer,
Christian
[1] http://files.basex.org/releases/latest/Quoted text · Arjan Loeffen · 42 lines
On Sun, Apr 26, 2020 at 10:40 AM Arjan Loeffen <arjan.loeffen at armatiek.nl> wrote: > > It seems that in VERSION 9.3 (November 29, 2019) the doc-available($xml-doc) seems to be broken; it should return a boolean but throws an exception. > > Has this been fixed recently? Cannot find a reference to such a fix in GIT. > > Arjan > > ---------- Forwarded message --------- > Van: Arjan Loeffen <arjan.loeffen at armatiek.nl> > Date: za 25 apr. 2020 om 17:55 > Subject: Doc-available() function, behavior? > To: BaseX <basex-talk at mailman.uni-konstanz.de> > > > Dear Basex People, > > I have this fragment: > > let $xml-doc := 'MyDatabase/bogus-entry.xml' > let $list := if (doc-available($xml-doc)) then doc($xml-doc)/* else () > return $list > > I'd expect BaseX to return the empty sequence when the document is not in the collection. But Basex returns an error: > > [basex:doc] Database path 'MyDatabase/bogus-entry.xml' yields no documents. > > What am I doing wrong? I thought I was following the example in https://docs.basex.org/wiki/Databases#XML_Documents nicely... > > Thanks in advance!! > > -- > Arjan Loeffen > Armatiek BV & Armatiek Solutions BV > 06-12918997 > > > -- > Arjan Loeffen > Armatiek BV & Armatiek Solutions BV > 06-12918997
HR
Hans-Juergen Rennau26 Apr 2020 12:00 #
[off topic] Other people talk of agility, BaseX does it: BaseXity.
Am Sonntag, 26. April 2020, 11:50:24 MESZ hat Christian Grün <christian.gruen at gmail.com> Folgendes geschrieben:
Hi Arjan,
The bug came in when we changed the error codes of db:open for non-existing documents (maybe that already happened with 9.0.x?). With the latest snapshot [1],
fn:doc-available works for database documents again.
Thanks for the pointer,
Christian
[1] http://files.basex.org/releases/latest/Quoted text · Arjan Loeffen · 42 lines
On Sun, Apr 26, 2020 at 10:40 AM Arjan Loeffen <arjan.loeffen at armatiek.nl> wrote: > > It seems that in VERSION 9.3 (November 29, 2019) the doc-available($xml-doc) seems to be broken; it should return a boolean but throws an exception. > > Has this been fixed recently? Cannot find a reference to such a fix in GIT. > > Arjan > > ---------- Forwarded message --------- > Van: Arjan Loeffen <arjan.loeffen at armatiek.nl> > Date: za 25 apr. 2020 om 17:55 > Subject: Doc-available() function, behavior? > To: BaseX <basex-talk at mailman.uni-konstanz.de> > > > Dear Basex People, > > I have this fragment: > > let $xml-doc := 'MyDatabase/bogus-entry.xml' > let $list := if (doc-available($xml-doc)) then doc($xml-doc)/* else () > return $list > > I'd expect BaseX to return the empty sequence when the document is not in the collection. But Basex returns an error: > > [basex:doc] Database path 'MyDatabase/bogus-entry.xml' yields no documents. > > What am I doing wrong? I thought I was following the example in https://docs.basex.org/wiki/Databases#XML_Documents nicely... > > Thanks in advance!! > > -- > Arjan Loeffen > Armatiek BV & Armatiek Solutions BV > 06-12918997 > > > -- > Arjan Loeffen > Armatiek BV & Armatiek Solutions BV > 06-12918997
AL
Christian,
I have installed the version referenced in your answer and the bug is solved. Thanks!
Arjan
Op zo 26 apr. 2020 om 11:50 schreef Christian Grün <
christian.gruen at gmail.com>:
Quoted text · Christian Grün · 65 lines
> Hi Arjan, > > The bug came in when we changed the error codes of db:open for > non-existing documents (maybe that already happened with 9.0.x?). With > the latest snapshot [1], fn:doc-available works for database documents > again. > > Thanks for the pointer, > Christian > > [1] http://files.basex.org/releases/latest/ > > > > > On Sun, Apr 26, 2020 at 10:40 AM Arjan Loeffen > <arjan.loeffen at armatiek.nl> wrote: > > > > It seems that in VERSION 9.3 (November 29, 2019) the > doc-available($xml-doc) seems to be broken; it should return a boolean but > throws an exception. > > > > Has this been fixed recently? Cannot find a reference to such a fix in > GIT. > > > > Arjan > > > > ---------- Forwarded message --------- > > Van: Arjan Loeffen <arjan.loeffen at armatiek.nl> > > Date: za 25 apr. 2020 om 17:55 > > Subject: Doc-available() function, behavior? > > To: BaseX <basex-talk at mailman.uni-konstanz.de> > > > > > > Dear Basex People, > > > > I have this fragment: > > > > let $xml-doc := 'MyDatabase/bogus-entry.xml' > > let $list := if (doc-available($xml-doc)) then doc($xml-doc)/* else > () > > return $list > > > > I'd expect BaseX to return the empty sequence when the document is not > in the collection. But Basex returns an error: > > > > [basex:doc] Database path 'MyDatabase/bogus-entry.xml' yields no > documents. > > > > What am I doing wrong? I thought I was following the example in > https://docs.basex.org/wiki/Databases#XML_Documents nicely... > > > > Thanks in advance!! > > > > -- > > Arjan Loeffen > > Armatiek BV & Armatiek Solutions BV > > 06-12918997 > > > > > > -- > > Arjan Loeffen > > Armatiek BV & Armatiek Solutions BV > > 06-12918997 >
--
*Arjan Loeffen*
Armatiek BV & Armatiek Solutions BV
06-12918997
Written for BaseX 9.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery