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