Forwarding to mailing list.
Anfang der weitergeleiteten E-Mail:
Von: Isidro Vila Verde jvverde@gmail.com Datum: 30. März 2011 16:54:37 MESZ An: Andreas Weiler andreas.weiler@uni-konstanz.de Betreff: Re: [basex-talk] Xquery through the PERL (or Java) API
Dear Andreas,
Thank you for you quick answer~. I didn't know about logs. It is in fact a great help, but for presente it seems the query is correctly received. This is what I got
07:50:25.999 [127.0.0.1:39722] LOGIN serprest OK 07:50:26.193 [127.0.0.1:39722] QUERY(0) declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare option output:method "xml"; let $col := collection('invoiceDB') let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279'] return $invoice OK 07:50:26.193 [127.0.0.1:39722] QUERY(0) OK 07:50:26.307 [127.0.0.1:39722] INIT(0) OK 07:50:26.319 [127.0.0.1:39722] EXEC(0) OK 07:50:26.320 [127.0.0.1:39722] INFO(0) OK 07:50:26.320 [127.0.0.1:39722] CLOSE(0) OK 07:50:26.347 [127.0.0.1:39722] LOGOUT serprest OK
Regards
Isidro
Em 30-03-2011 15:45, Andreas Weiler escreveu:
Dear Isidro,
as a quick help, you could have a look at the log files on the server, they are located in your BaseXData folder (.logs).
Here you can check if the query did arrive correctly at the server.
-- Andreas
Am 30.03.2011 um 16:39 schrieb Isidro Vila Verde:
Dear all,
I have a very strange situation when invoking this xquery
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare option output:method "xml";
let $col := collection('invoiceDB') let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279'] return $invoice
When invoked from GUI it returns the right XML element, but the same query invoked through the perl (or java) API it returns a null result.
Bellow is the perl (andf java version) code. What is more strange is that it works for any other value of node saf:InvoiceNo/text(). It just doesn't work for the value 279.
In collection invoice DB each saf:Invoice is a single document and the invoiceNo/text()='279' is the "last" document. The collection was just created from a input directory and no other operations was performed on it.
Can you help please?
I am using the last Basex 6.6 version on ubuntu with java-6-sun.
I came to this error when I was in a process to identify why a update operation through the perl API corrupted the database while the same upadate query works fine when invoked from GUI. So, my problem is not exactly this one but I can go any further without resolving this.
I notice, on page https://github.com/BaseXdb/BaseX, there is no API version not the last basex 6.6. Should I go back to the version 6.5?
Thanks in advance for your help
Isidro
------------------Perl Version----------------------------- #!/usr/bin/perl use strict; use lib qw|/var/www/serprest/perl/3rd-party|; use BaseXClient; use warnings;
eval { my $session = Session->new("localhost", 1984, "serprest", ".prest,ser");
my $q = q| declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare option output:method "xml";
let $col := collection('invoiceDB') let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279'] return $invoice
|; my $query = $session->query($q); $query->init(); print $query->execute(); print $query->info(); $query->close(); $session->close(); };
# print exception print qq|<error>$@</error>| if $@;
------------------Java Version----------------------------- import java.io.IOException;
public final class QueryTeste { public static void main(final String[] args) { try { BaseXClient session = new BaseXClient("localhost", 1984, "serprest", ".prest,ser");
try { String input = "declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01";" + "declare option output:method "xml";" + "let $col := collection('invoiceDB')" + "let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279']" + "return $invoice"; BaseXClient.Query query = session.query(input); System.out.print(query.init()); while(query.more()) { System.out.println(query.next()); } System.out.print(query.close()); } catch(IOException ex) { ex.printStackTrace(); } session.close(); } catch(IOException ex) { ex.printStackTrace(); } } }
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:39:30 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:47:51 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:54:40 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
Sorry and Thank you.
I just reply and forgot to change the destination address.
Isidro Em 30-03-2011 15:56, Andreas Weiler escreveu:
Forwarding to mailing list.
Anfang der weitergeleiteten E-Mail:
*Von: *Isidro Vila Verde <jvverde@gmail.com mailto:jvverde@gmail.com> *Datum: *30. März 2011 16:54:37 MESZ *An: *Andreas Weiler <andreas.weiler@uni-konstanz.de mailto:andreas.weiler@uni-konstanz.de> *Betreff: **Re: [basex-talk] Xquery through the PERL (or Java) API*
Dear Andreas,
Thank you for you quick answer~. I didn't know about logs. It is in fact a great help, but for presente it seems the query is correctly received. This is what I got
07:50:25.999 [127.0.0.1:39722] LOGIN serprest OK 07:50:26.193 [127.0.0.1:39722] QUERY(0) declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare option output:method "xml"; let $col := collection('invoiceDB') let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279'] return $invoice OK 07:50:26.193 [127.0.0.1:39722] QUERY(0) OK 07:50:26.307 [127.0.0.1:39722] INIT(0) OK 07:50:26.319 [127.0.0.1:39722] EXEC(0) OK 07:50:26.320 [127.0.0.1:39722] INFO(0) OK 07:50:26.320 [127.0.0.1:39722] CLOSE(0) OK 07:50:26.347 [127.0.0.1:39722] LOGOUT serprest OK
Regards
Isidro
Em 30-03-2011 15:45, Andreas Weiler escreveu:
Dear Isidro,
as a quick help, you could have a look at the log files on the server, they are located in your BaseXData folder (.logs).
Here you can check if the query did arrive correctly at the server.
-- Andreas
Am 30.03.2011 um 16:39 schrieb Isidro Vila Verde:
Dear all,
I have a very strange situation when invoking this xquery
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare option output:method "xml";
let $col := collection('invoiceDB') let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279'] return $invoice
When invoked from GUI it returns the right XML element, but the same query invoked through the perl (or java) API it returns a null result.
Bellow is the perl (andf java version) code. What is more strange is that it works for any other value of node saf:InvoiceNo/text(). It just doesn't work for the value 279.
In collection invoice DB each saf:Invoice is a single document and the invoiceNo/text()='279' is the "last" document. The collection was just created from a input directory and no other operations was performed on it.
Can you help please?
I am using the last Basex 6.6 version on ubuntu with java-6-sun.
I came to this error when I was in a process to identify why a update operation through the perl API corrupted the database while the same upadate query works fine when invoked from GUI. So, my problem is not exactly this one but I can go any further without resolving this.
I notice, on page https://github.com/BaseXdb/BaseX, there is no API version not the last basex 6.6. Should I go back to the version 6.5?
Thanks in advance for your help
Isidro
------------------Perl Version----------------------------- #!/usr/bin/perl use strict; use lib qw|/var/www/serprest/perl/3rd-party|; use BaseXClient; use warnings;
eval { my $session = Session->new("localhost", 1984, "serprest", ".prest,ser");
my $q = q| declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare option output:method "xml";
let $col := collection('invoiceDB') let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() =
'279'] return $invoice |; my $query = $session->query($q); $query->init(); print $query->execute(); print $query->info(); $query->close(); $session->close(); };
# print exception print qq|<error>$@</error>| if $@;
------------------Java Version----------------------------- import java.io.IOException;
public final class QueryTeste { public static void main(final String[] args) { try { BaseXClient session = new BaseXClient("localhost", 1984, "serprest", ".prest,ser");
try { String input = "declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01";" + "declare option output:method "xml";" + "let $col := collection('invoiceDB')" + "let $invoice := $col/saf:Invoice[saf:InvoiceNo/text() = '279']" + "return $invoice"; BaseXClient.Query query = session.query(input); System.out.print(query.init()); while(query.more()) { System.out.println(query.next()); } System.out.print(query.close()); } catch(IOException ex) { ex.printStackTrace(); } session.close(); } catch(IOException ex) { ex.printStackTrace(); } } }
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:39:30 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de mailto:BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:47:51 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:54:40 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 15:56:44 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 16:06:19 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
basex-talk@mailman.uni-konstanz.de