Sorry!!!
I am been in a process of focus in little details that I missed the most obvious: reboot the server.
I just did that and (this) the problem disappear. I am going now to check if the update problem stills or also go disappear.
Sorry the noise on the channel.
Just a question. The GUI doesn't use the server to access to the DB?
Isidro
Em 30-03-2011 15:54, Isidro Vila Verde escreveu:
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
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 16:16:17 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:22:03 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
Hi Isidro,
On 30.03.2011, at 17:22, Isidro Vila Verde wrote:
Just a question. The GUI doesn't use the server to access to the DB?
that's right. The GUI is a standalone version of BaseX and does not use client/server communication.
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Alexander Holupirek |-- http://www.informatik.uni-konstanz.de/~holupire |-- Database & Information Systems Group, U Konstanz `-- Room E 209, 0049 7531 88 4449 (phone) 3577 (fax)
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279')) Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message ------------------------- import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/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| import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf: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 $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
------------------------------------------------------
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
Hi Isidro,
you have to reopen the database in the GUI.
-- Andreas
Am 30.03.2011 um 18:11 schrieb Isidro Vila Verde:
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message ------------------------- import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/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| import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf: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 $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 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
Andreas,
If I do that I get the following message:
"Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
And if I run the perl script again I get this:
"Not expected (Data Access out of bounds [pre:17508, indexSize:70, access:70> 69]). at /var/www/serprest/perl/3rd-party/BaseXClient.pm line 195"
I really don't know how to workaround this.
Thanks
Isidro
Em 30-03-2011 18:17, Andreas Weiler escreveu:
Hi Isidro,
you have to reopen the database in the GUI.
-- Andreas
Am 30.03.2011 um 18:11 schrieb Isidro Vila Verde:
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message ------------------------- import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/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| import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf: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 $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 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 18:17:54 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 18:28:25 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
Isidro,
Do you run your Perl-script when the database is opened in the GUI? I suspect that will cause a corruption. So make sure that the database is closed in the GUI. Run your Perl-script. And then open the database in the GUI to check the results of your script.
Regards, Frans
Op 30 mrt 2011, om 19:28 heeft Isidro Vila Verde het volgende geschreven:
Andreas,
If I do that I get the following message:
"Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
And if I run the perl script again I get this:
"Not expected (Data Access out of bounds [pre:17508, indexSize:70, access:70> 69]). at /var/www/serprest/perl/3rd-party/BaseXClient.pm line 195"
I really don't know how to workaround this.
Thanks
Isidro
Em 30-03-2011 18:17, Andreas Weiler escreveu:
Hi Isidro,
you have to reopen the database in the GUI.
-- Andreas
Am 30.03.2011 um 18:11 schrieb Isidro Vila Verde:
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message ------------------------- import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/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| import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf: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 $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 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 18:17:54 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 18:28:25 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
Yes Andreas,
In the last minutes I have been testing all my update queries while mantaining GUI closed and until now I don't find any problem.
But I need to continue test it.
Thank you.
Isidro
Em 30-03-2011 18:53, frans@planet escreveu:
Isidro,
Do you run your Perl-script when the database is opened in the GUI? I suspect that will cause a corruption. So make sure that the database is closed in the GUI. Run your Perl-script. And then open the database in the GUI to check the results of your script.
Regards, Frans
Op 30 mrt 2011, om 19:28 heeft Isidro Vila Verde het volgende geschreven:
Andreas,
If I do that I get the following message:
"Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
And if I run the perl script again I get this:
"Not expected (Data Access out of bounds [pre:17508, indexSize:70, access:70> 69]). at /var/www/serprest/perl/3rd-party/BaseXClient.pm line 195"
I really don't know how to workaround this.
Thanks
Isidro
Em 30-03-2011 18:17, Andreas Weiler escreveu:
Hi Isidro,
you have to reopen the database in the GUI.
-- Andreas
Am 30.03.2011 um 18:11 schrieb Isidro Vila Verde:
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message ------------------------- import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/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| import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf: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 $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate--> saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 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 18:17:54 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 18:28:25 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 18:53:31 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 18:57:06 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
Sorry Frans,
I should say: "Yes Frans" instead of "Yes Andreas" :-)
Thank you for your suggestion, Frans.
Regards
Isidro Em 30-03-2011 18:57, Isidro Vila Verde escreveu:
Yes Andreas,
In the last minutes I have been testing all my update queries while mantaining GUI closed and until now I don't find any problem.
But I need to continue test it.
Thank you.
Isidro
Em 30-03-2011 18:53, frans@planet escreveu:
Isidro,
Do you run your Perl-script when the database is opened in the GUI? I suspect that will cause a corruption. So make sure that the database is closed in the GUI. Run your Perl-script. And then open the database in the GUI to check the results of your script.
Regards, Frans
Op 30 mrt 2011, om 19:28 heeft Isidro Vila Verde het volgende geschreven:
Andreas,
If I do that I get the following message:
"Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
And if I run the perl script again I get this:
"Not expected (Data Access out of bounds [pre:17508, indexSize:70, access:70> 69]). at /var/www/serprest/perl/3rd-party/BaseXClient.pm line 195"
I really don't know how to workaround this.
Thanks
Isidro
Em 30-03-2011 18:17, Andreas Weiler escreveu:
Hi Isidro,
you have to reopen the database in the GUI.
-- Andreas
Am 30.03.2011 um 18:11 schrieb Isidro Vila Verde:
Hi again,
This is my (original) problem.
If I try to run a xquery update from GUI and then try to get the modified XML element everything is ok.
But if a run the same xquery from a perl script and then go to the GUI, to get the modified XML element I get this error:
------------------------------Error obtained, in GUI, after run the update query from a perl script--------------------------- Query: import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
Error: Possible bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 6.6 Java: Sun Microsystems Inc., 1.6.0_20 OS: Linux, amd64 Stack Trace: java.lang.IndexOutOfBoundsException java.io.RandomAccessFile.readBytes(Native Method) java.io.RandomAccessFile.read(RandomAccessFile.java:355) java.io.RandomAccessFile.readFully(RandomAccessFile.java:414) org.basex.io.DataAccess.cursor(DataAccess.java:225) org.basex.io.DataAccess.readToken(DataAccess.java:147) org.basex.data.DiskData.txt(DiskData.java:213) org.basex.data.DiskData.text(DiskData.java:181) org.basex.data.Data.atom(Data.java:241) org.basex.query.item.DBNode.atom(DBNode.java:84) org.basex.query.item.Str.eq(Str.java:77) org.basex.query.item.ANode.eq(ANode.java:73) org.basex.query.expr.CmpV$Op$5.e(CmpV.java:80) org.basex.query.expr.CmpG.eval(CmpG.java:232) org.basex.query.expr.CmpG.item(CmpG.java:181) org.basex.query.expr.CmpG.item(CmpG.java:1) org.basex.query.expr.ParseExpr.ebv(ParseExpr.java:85) org.basex.query.expr.ParseExpr.test(ParseExpr.java:98) org.basex.query.expr.Preds.preds(Preds.java:99) org.basex.query.path.IterStep$1.next(IterStep.java:49) org.basex.query.path.AxisPath.iter(AxisPath.java:438) org.basex.query.path.AxisPath.iter(AxisPath.java:408) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Let$1.next(Let.java:94) org.basex.query.expr.FLWR$1.next(FLWR.java:62) org.basex.query.iter.Iter.finish(Iter.java:65) org.basex.query.expr.ParseExpr.value(ParseExpr.java:76) org.basex.query.expr.Func.iter(Func.java:99) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.expr.FuncCall.iter(FuncCall.java:80) org.basex.query.QueryContext.iter(QueryContext.java:330) org.basex.query.QueryContext.iter(QueryContext.java:295) org.basex.query.QueryContext.eval(QueryContext.java:253) org.basex.query.QueryProcessor.execute(QueryProcessor.java:113) org.basex.core.cmd.AQuery.query(AQuery.java:83) org.basex.core.cmd.XQuery.run(XQuery.java:22) org.basex.core.Command.run(Command.java:292) org.basex.core.Command.exec(Command.java:274) org.basex.core.Command.execute(Command.java:67) org.basex.gui.GUI.exec(GUI.java:390) org.basex.gui.GUI$5.run(GUI.java:351)
------------This is the query which throws the above error message
import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:getInvoiceSumary(xs:string('279'))
-------------This is the update query, as invoked from GUI------------------------ import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>)
-------------This is the PERL script with the same update query. Run this script is the the source of problem------------------------ #!/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| import module namespace m =
"http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml";
m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01">
saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf: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 $@;
-----------------This is module which implement the two functions used in the above queries------------------- module namespace x = "http://serprest.pt/invoice/xqm"; declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; declare namespace fx="http://www.basex.org/file"; declare variable $x:col := collection('invoiceDB');
[... some stuff deleted here ...] declare function x:getInvoiceSumary($invoiceNo as xs:string) as node()? { let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text()=$invoiceNo] return if ($invoice/saf:Line) then copy $c := $invoice modify delete node $c/saf:Line return $c else $invoice }; [... some stuff deleted here ...] declare updating function x:invoiceUpdate($newInvoice as node()){ let $invoice := $x:col/saf:Invoice[saf:InvoiceNo/text() = $newInvoice/saf:InvoiceNo/text()] for $p in $newInvoice/* let $target := $invoice/*[name() = name($p)][last()] return if ($target) then replace node $target with $p else insert node $p as last into $invoice };
-------------This is the log----------------------- 08:34:22.513 [127.0.0.1:48542] QUERY(0) import module namespace m = "http://serprest.pt/invoice/xqm" at "http://localhost/xq/m.xqm"; declare option output:omit-xml-declaration "no"; declare option output:method "xml"; m:invoiceUpdate(<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"> saf:InvoiceNo279</saf:InvoiceNo> saf:InvoiceDate2011-01-27</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType>
<!--saf:SystemEntryDate>2011-01-27T20:31:32.212Z</saf:SystemEntryDate-->
saf:CustomerID555561</saf:CustomerID> spi:PayDateExpected2011-02-27</spi:PayDateExpected> spi:PayDate</spi:PayDate> spi:ReceiptID</spi:ReceiptID> spi:StatusIniciada</spi:Status> </saf:Invoice>) OK 08:34:22.523 [127.0.0.1:48542] QUERY(0) OK 08:34:22.611 [127.0.0.1:48542] INIT(0) OK 08:34:22.612 [127.0.0.1:48542] EXEC(0) OK 08:34:22.613 [127.0.0.1:48542] INFO(0) OK 08:34:22.613 [127.0.0.1:48542] CLOSE(0) OK 08:34:22.615 [127.0.0.1:48542] LOGOUT serprest OK
If I run the m:getInvoiceSumary(xs:string('279')) again it runs without any error message but it returns a empty result. If I close and open the GUI again the result still be a empty result and if I try to open the DB I get a popup message saying: "Could not execute OPEN invoiceDB: java.lang.IndexOutOfBoundsException"
Any help/glue is welcome.
Thanks
Isidro
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 17:11:11 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 18:17:54 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 18:28:25 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 18:53:31 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 18:57:06 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110330-0, 30-03-2011 Tested on: 30-03-2011 18:57:55 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 18:59:31 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
basex-talk@mailman.uni-konstanz.de