Perl BaseX API questions

Wednesday, 12 December 2012 · 7 messages · last reply 14 Dec 2012
LQ
Liam R E Quin12 Dec 2012 21:47 #
(1) The sample perl files and the perl module implementing the API mention a readme file that explains the methods; does anyone know where one might find such a readme file? It might answer my other question... (2) if there's an error in my query and I catch the exception, the message I get is about how many milliseconds the query took, not the actual error. I can enclose my Perl script, but I'm wondering if others have seen this? Thanks, Liam
-- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ (fromoldbooks.org uses BaseX e.g. for Search and for the tag cloud)
CG
Christian Grün13 Dec 2012 03:15 #
Hi Liam, be sure I'll have a look at this tomorrow. Christian
Quoted text · Liam R E Quin · 25 lines
Am 12.12.2012 20:48 schrieb "Liam R E Quin" <liam at w3.org>: > (1) The sample perl files and the perl module implementing the API > mention a readme file that explains the methods; does anyone know where > one might find such a readme file? It might answer my other question... > > (2) if there's an error in my query and I catch the exception, the > message I get is about how many milliseconds the query took, not the > actual error. I can enclose my Perl script, but I'm wondering if others > have seen this? > > Thanks, > > Liam > > > -- > Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ > Pictures from old books: http://fromoldbooks.org/ > (fromoldbooks.org uses BaseX e.g. for Search and for the tag cloud) > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Christian Grünin reply to Liam R E Quin, 12 Dec 2012, 21:4713 Dec 2012 18:30 #
Hi Liam,
Quoted text · Liam R E Quin · 3 lines
> (1) The sample perl files and the perl module implementing the API > mention a readme file that explains the methods; does anyone know where > one might find such a readme file? It might answer my other question...
The quoted readme.txt file is currently found in the parent directory, which lists all other client APIs [1]. As the latest version of this file also contains a link to our Wiki, I have removed to simply remove all the readme.txt comments. Instead, our Wiki page is supposed to include all relevant information for using the language bindings [2].
Quoted text · Liam R E Quin · 4 lines
> (2) if there's an error in my query and I catch the exception, the > message I get is about how many milliseconds the query took, not the > actual error. I can enclose my Perl script, but I'm wondering if others > have seen this?
In Perl, the error message can be retrieved by enclosing the query with eval {...} and printing $@ if an error occurs. This is eg shown in Example.pl. If this does not help, you are invited to send us an example that demonstrates what goes wrong. Christian [1] https://github.com/BaseXdb/basex-api/tree/master/src/main [2] http://docs.basex.org/wiki/Clients [3] https://github.com/BaseXdb/basex-api/blob/master/src/main/perl/Example.pl
LQ
Liam R E Quin13 Dec 2012 21:31 #
Quoted text · Christian Grün · 9 lines
On Thu, 2012-12-13 at 18:30 +0100, Christian Grün wrote: > Hi Liam, > > > (1) The sample perl files and the perl module implementing the API > > mention a readme file that explains the methods; does anyone know where > > one might find such a readme file? It might answer my other question... > > The quoted readme.txt file is currently found in the parent directory, > which lists all other client APIs [1].
Thank you, this led me to http://docs.basex.org/wiki/Server_Protocol which at least gave a list of methods and what they are expected to do.
Quoted text · Christian Grün · 9 lines
> > (2) if there's an error in my query and I catch the exception, the > > message I get is about how many milliseconds the query took, not the > > actual error. I can enclose my Perl script, but I'm wondering if others > > have seen this? > > In Perl, the error message can be retrieved by enclosing the query > with eval {...} and printing $@ if an error occurs. This is eg shown > in Example.pl. If this does not help, you are invited to send us an > example that demonstrates what goes wrong.
Enclosed. When I run this the error I get is always: Database 'rdf' was opened in 0.6 ms. If I use the commandline BsaeX program on the same query I get this instead (for this same deliberately malformed query): $ ~/packages/basex/BaseX7.3/bin/basexclient Username: admin Password: BaseX 7.3 [Client] Try help to get more information.
Quoted text · Christian Grün · 1 line
> open rdf
Database 'rdf' was opened in 0.65 ms.
Quoted text · Christian Grün · 1 line
> run /home/liam/tmp/error.xq
Stopped at line 1, column 9 in /home/liam/tmp/error.xq: [XPST0003] Unexpected end of query: 'with syntax err...'.
Quoted text · Christian Grün · 1 line
>
Liam
-- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml Co-author, 5th edition of "Beginning XML", Wrox, 2012
CG
Christian Grün13 Dec 2012 23:11 #
Liam, the bug has been fixed [1]; feel free to check out the latest version [2]. Thanks for sharing this, Christian [1] https://github.com/BaseXdb/basex-api/commit/aaa17f4e408e4e86d0ff3a72a8261acfb0a0b3aa [2] https://github.com/BaseXdb/basex-api/blob/master/src/main/perl/BaseXClient.pm
Quoted text · Christian Grün · 49 lines
On Thu, Dec 13, 2012 at 8:29 PM, Liam R E Quin <liam at w3.org> wrote: > On Thu, 2012-12-13 at 18:30 +0100, Christian Grün wrote: >> Hi Liam, >> >> > (1) The sample perl files and the perl module implementing the API >> > mention a readme file that explains the methods; does anyone know where >> > one might find such a readme file? It might answer my other question... >> >> The quoted readme.txt file is currently found in the parent directory, >> which lists all other client APIs [1]. > > Thank you, this led me to http://docs.basex.org/wiki/Server_Protocol > which at least gave a list of methods and what they are expected to do. > >> > (2) if there's an error in my query and I catch the exception, the >> > message I get is about how many milliseconds the query took, not the >> > actual error. I can enclose my Perl script, but I'm wondering if others >> > have seen this? >> >> In Perl, the error message can be retrieved by enclosing the query >> with eval {...} and printing $@ if an error occurs. This is eg shown >> in Example.pl. If this does not help, you are invited to send us an >> example that demonstrates what goes wrong. > > Enclosed. When I run this the error I get is always: > Database 'rdf' was opened in 0.6 ms. > > If I use the commandline BsaeX program on the same query I get this > instead (for this same deliberately malformed query): > $ ~/packages/basex/BaseX7.3/bin/basexclient > Username: admin > Password: > BaseX 7.3 [Client] > Try help to get more information. > >> open rdf > Database 'rdf' was opened in 0.65 ms. >> run /home/liam/tmp/error.xq > Stopped at line 1, column 9 in /home/liam/tmp/error.xq: > [XPST0003] Unexpected end of query: 'with syntax err...'. >> > > Liam > > -- > Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ > Pictures from old books: http://fromoldbooks.org/ > Ankh: irc.sorcery.net irc.gnome.org freenode/#xml > Co-author, 5th edition of "Beginning XML", Wrox, 2012
CG
Christian Grün13 Dec 2012 23:18 #
..and a related note to everyone: I have fixed a similar bug in the Ruby API. It has already been noted that some of the APIs, such as PHP or Python, don’t support the current iterative binding yet. If some of you are using one of those clients and if you are interested in finalizing the APIs, your contributions are welcome! Christian
Quoted text · Christian Grün · 63 lines
On Thu, Dec 13, 2012 at 11:11 PM, Christian Grün <christian.gruen at gmail.com> wrote: > Liam, > > the bug has been fixed [1]; feel free to check out the latest version [2]. > > Thanks for sharing this, > Christian > > [1] https://github.com/BaseXdb/basex-api/commit/aaa17f4e408e4e86d0ff3a72a8261acfb0a0b3aa > [2] https://github.com/BaseXdb/basex-api/blob/master/src/main/perl/BaseXClient.pm > > ______________________________________________ > > On Thu, Dec 13, 2012 at 8:29 PM, Liam R E Quin <liam at w3.org> wrote: >> On Thu, 2012-12-13 at 18:30 +0100, Christian Grün wrote: >>> Hi Liam, >>> >>> > (1) The sample perl files and the perl module implementing the API >>> > mention a readme file that explains the methods; does anyone know where >>> > one might find such a readme file? It might answer my other question... >>> >>> The quoted readme.txt file is currently found in the parent directory, >>> which lists all other client APIs [1]. >> >> Thank you, this led me to http://docs.basex.org/wiki/Server_Protocol >> which at least gave a list of methods and what they are expected to do. >> >>> > (2) if there's an error in my query and I catch the exception, the >>> > message I get is about how many milliseconds the query took, not the >>> > actual error. I can enclose my Perl script, but I'm wondering if others >>> > have seen this? >>> >>> In Perl, the error message can be retrieved by enclosing the query >>> with eval {...} and printing $@ if an error occurs. This is eg shown >>> in Example.pl. If this does not help, you are invited to send us an >>> example that demonstrates what goes wrong. >> >> Enclosed. When I run this the error I get is always: >> Database 'rdf' was opened in 0.6 ms. >> >> If I use the commandline BsaeX program on the same query I get this >> instead (for this same deliberately malformed query): >> $ ~/packages/basex/BaseX7.3/bin/basexclient >> Username: admin >> Password: >> BaseX 7.3 [Client] >> Try help to get more information. >> >>> open rdf >> Database 'rdf' was opened in 0.65 ms. >>> run /home/liam/tmp/error.xq >> Stopped at line 1, column 9 in /home/liam/tmp/error.xq: >> [XPST0003] Unexpected end of query: 'with syntax err...'. >>> >> >> Liam >> >> -- >> Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ >> Pictures from old books: http://fromoldbooks.org/ >> Ankh: irc.sorcery.net irc.gnome.org freenode/#xml >> Co-author, 5th edition of "Beginning XML", Wrox, 2012
LQ
Liam R E Quinin reply to Christian Grün, 13 Dec 2012, 23:1114 Dec 2012 02:12 #
Quoted text · Christian Grün · 4 lines
On Thu, 2012-12-13 at 23:11 +0100, Christian Grün wrote: > Liam, > > the bug has been fixed [1]; feel free to check out the latest version [2].
Thank you! Confirmed as fixed. Liam
-- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml Co-author: 5th edition of "Beginning XML", Wrox, 2012

⚡Generated with XQuery