Thanks Dimitar,
The problem seems to be solved with upgrade to latest 6.6 version, as your suggestion.
Thank you for your support
Regards,
Isidro
Em 24-03-2011 07:43, Dimitar Popov escreveu:
Hi Isidro,
thanks for the information - I'll try to find what's going on. Meanwhile, you may want to try our latest 6.6 version - there a lot of improvements and fixes. You can find it here: http://basex.org/products/download/all-downloads . I also noticed that you use openjdk. Is it possible to check if the problem occurs with the Sun (ups, Oracle! ;) ) JRE? Thanks for the feedback.
Best regards, Dimitar
On Thu, 24 Mar 2011 01:16:16 +0100, Isidro Vila Verde jvverde@gmail.com wrote:
Just to complement the previous information
This is the typical structure of each document
<?xml version="1.0" encoding="UTF-8"?>
<saf:Invoice xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:recp="http://serprest.pt/receipt1" xmlns:spi="http://serprest.pt/invoice1" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01" xsi:type="spi:invoiceType" xsi:schemaLocation="http://serprest.pt/invoice1 http://serprest.pt/invoice/invoice.xsd%22%3E saf:InvoiceNo230</saf:InvoiceNo> saf:InvoiceDate2010-02-22</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> saf:SystemEntryDate2010-02-22T16:10:50.181Z</saf:SystemEntryDate> saf:CustomerID555558</saf:CustomerID> saf:Line saf:LineNumber1</saf:LineNumber> saf:ProductCode152</saf:ProductCode> saf:ProductDescriptionChicote RJ45 - 1M</saf:ProductDescription> saf:Quantity20</saf:Quantity> saf:UnitOfMeasureUnit</saf:UnitOfMeasure> saf:UnitPrice3.1</saf:UnitPrice> saf:TaxPointDate2010-02-22Z</saf:TaxPointDate> saf:Description/ saf:DebitAmount62</saf:DebitAmount> saf:CreditAmount0</saf:CreditAmount> <saf:Tax xsi:type="spi:Tax"> saf:TaxTypeIVA</saf:TaxType> saf:TaxCodeNor</saf:TaxCode> saf:TaxPercentage20</saf:TaxPercentage> spi:TaxAmount12.4</spi:TaxAmount> </saf:Tax> saf:SettlementAmount0</saf:SettlementAmount> </saf:Line> saf:Line saf:LineNumber2</saf:LineNumber> saf:ProductCode153</saf:ProductCode> saf:ProductDescriptionChicote RJ45 - 2M</saf:ProductDescription> saf:Quantity16</saf:Quantity> saf:UnitOfMeasureUnit</saf:UnitOfMeasure> saf:UnitPrice3.8</saf:UnitPrice> saf:TaxPointDate2010-02-22Z</saf:TaxPointDate> saf:Description/ saf:DebitAmount60.8</saf:DebitAmount> saf:CreditAmount0</saf:CreditAmount> <saf:Tax xsi:type="spi:Tax"> saf:TaxTypeIVA</saf:TaxType> saf:TaxCodeNor</saf:TaxCode> saf:TaxPercentage20</saf:TaxPercentage> spi:TaxAmount12.16</spi:TaxAmount> </saf:Tax> saf:SettlementAmount0</saf:SettlementAmount> </saf:Line> saf:Line saf:LineNumber3</saf:LineNumber> saf:ProductCode154</saf:ProductCode> saf:ProductDescriptionServiço de suporte</saf:ProductDescription> saf:Quantity1</saf:Quantity> saf:UnitOfMeasureMonth</saf:UnitOfMeasure> saf:UnitPrice160</saf:UnitPrice> saf:TaxPointDate2010-02-22Z</saf:TaxPointDate> saf:Description/ saf:DebitAmount160</saf:DebitAmount> saf:CreditAmount0</saf:CreditAmount> <saf:Tax xsi:type="spi:Tax"> saf:TaxTypeIVA</saf:TaxType> saf:TaxCodeNor</saf:TaxCode> saf:TaxPercentage20</saf:TaxPercentage> spi:TaxAmount32</spi:TaxAmount> </saf:Tax> saf:SettlementAmount0</saf:SettlementAmount> </saf:Line> saf:Line saf:LineNumber4</saf:LineNumber> saf:ProductCode155</saf:ProductCode> saf:ProductDescriptionInstalação e configuração de sistemas informáticos</saf:ProductDescription> saf:Quantity2</saf:Quantity> saf:UnitOfMeasureDay</saf:UnitOfMeasure> saf:UnitPrice200</saf:UnitPrice> saf:TaxPointDate2010-02-22Z</saf:TaxPointDate> saf:Description/ saf:DebitAmount400</saf:DebitAmount> saf:CreditAmount0</saf:CreditAmount> <saf:Tax xsi:type="spi:Tax"> saf:TaxTypeIVA</saf:TaxType> saf:TaxCodeNor</saf:TaxCode> saf:TaxPercentage20</saf:TaxPercentage> spi:TaxAmount80</spi:TaxAmount> </saf:Tax> saf:SettlementAmount0</saf:SettlementAmount> </saf:Line> saf:DocumentTotals saf:TaxPayable136.56</saf:TaxPayable> saf:NetTotal682.8</saf:NetTotal> saf:GrossTotal819.36</saf:GrossTotal> </saf:DocumentTotals> spi:StatusPaga</spi:Status> spi:ReceiptID71</spi:ReceiptID> </saf:Invoice>
I hope this can help to understand what is wrong with my system
Regards
Isidro
Em 24-03-2011 00:09, Isidro Vila Verde escreveu:
Thank you Dimitar for your quick answer
I am using Basex 6.5.1 on ubuntu 10.10 (maverick) and at bottom I have more details about my system.
Now I can reproduce de corrupted DB situation with two update operation.
Immediately, after create a new database from a directory with 6 sub-directories and a few hundreds of XML documents, I ran the following sequence of 3 xquery and the result is unexpected/wrong. The problem is the second updade query.
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; let $col := collection('invoiceDB') let $invoices := $col/saf:Invoice[not(spi:PayDateExpected)] for $i in $invoices let $d := $i/saf:InvoiceDate/text() let $nd := xs:date($d) + xs:yearMonthDuration("P1M") return insert node spi:PayDateExpected{$nd}</spi:PayDateExpected> after $i/saf:DocumentTotals
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; let $col := collection('invoiceDB/invoices') let $invoices := $col/saf:Invoice[not(spi:PayDate)] for $i in $invoices return let $d := $i/spi:PayDateExpected/text() return insert node spi:PayDate{$d}</spi:PayDate> after $i/spi:PayDateExpected
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; let $col := collection('invoiceDB/invoices') let $invoices := $col/saf:Invoice return count($invoices)
The result of this last query is wrong (46) but if I now run the same query just changing the the prefix 'saf' by a wildcard as bellow
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01"; declare namespace spi="http://serprest.pt/invoice1"; let $col := collection('invoiceDB/invoices') let $invoices := $col/*:Invoice return count($invoices)
The result is now correct (104)
I repeat this sequence of operations several times, with and without optimization between each query and importing DB with and without index checked in basexgui interface (text index ON/OFF, attributes index ON/OFF, Path summary ON/OFF and Full Text Index ON/OFF) and the result is always the same
These are the output of my system
info
General Information Database Path: /home/jvv/BaseXData Used Main Memory: 537 KB
Database Creation Whitespace Chopping: ON Entity Parsing: OFF
Indexes Path Summary: ON Text Index: ON Attribute Index: ON Full-Text Index: OFF
info DATABASE
Database Properties Name: invoiceDB Size: 1268 KB Nodes: 17922 Height: 6
Database Creation Path: /opt/data/invoiceData Time Stamp: 23.03.2011 04:20:21 Input Size: 486 KB Encoding: UTF-8 Documents: 225 Whitespace Chopping: ON Entity Parsing: OFF
Indexes Up-to-date: true Path Summary: ON Text Index: ON Attribute Index: ON Full-Text Index: ON (wildcards)
jvv@ubuntu:~/basex/bin$ sudo update-java-alternatives -l java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk jvv@ubuntu:~/basex/bin$
Thank you again for your help
Regards
Isidro
Em 23-03-2011 22:54, Dimitar Popov escreveu:
Hi Isidro,
Could you provide more details on which version of BaseX caused the corrupted database and what operations were performed on it (e.g. update queries). The more information we have the better :)
Best regards, Dimitar
On Wed, 23 Mar 2011 21:06:17 +0100, Isidro Vila Verde jvv@fe.up.pt wrote:
The problem seems to be related with a corrupted DB.
I just import the xml files again in a new DB and with this new collection everything works fine.
Why was the database corrupted? I have no idea. I hope it doesn't happen again.
Regards
Isidro
Em 23-03-2011 18:47, Isidro Vila Verde escreveu:
Greetings,
I am new here and this is my first post.
I just start to work with Basex and I am trying to migrate from eXist-db. Until know everything runs well but... I am now facing a little problem.
With the xquery bellow the result is not what I expect
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01";
let $col := collection('invoiceData/invoices') let $invoices := $col/*[not(saf:InvoiceType)] return $invoices
This is the result (unexpected)
<saf:Invoice xmlns:spi="http://serprest.pt/invoice1" xmlns:saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01" xsi:type="spi:invoiceType" xsi:schemaLocation="http://serprest.pt/invoice1 http://serprest.pt/invoice/invoice.xsd%22%3E saf:InvoiceNo257</saf:InvoiceNo> saf:InvoiceDate2010-09-21</saf:InvoiceDate> saf:InvoiceTypeFactura</saf:InvoiceType> <!-- this element is in fact present --> [... some stuff deleted here ...]
But if I use a wildcard instead of the namespace prefix the result is what is expected
declare namespace saf="urn:OECD:StandardAuditFile-Tax:PT_1.00_01";
let $col := collection('invoiceData/invoices') let $invoices := $col/*[not(*:InvoiceType)] return $invoices
This is (as expected) the result for the above query
<collection xmlns:spi="http://serprest.pt/invoice1" xmlns="http://exist.sourceforge.net/NS/exist" name="/db/invoicingSystem/invoices" owner="admin" group="dba" mode="755" created="2011-02-17T23:15:07Z" version="1"> <resource type="XMLResource" name="1.xml" owner="admin" group="dba" mode="755" created="1970-01-01T01:00:00+01:00" modified="2010-07-27T13:29:12+01:00" filename="1.xml" mimetype="text/xml"/> [... some stuff deleted here ...]
Of course, I can still use wildcards but the question is what is wrong with prefix? I am asking because I have a lot of queries using namespaces and now I have no confidence on the results.
Thanks in advance
Isidro
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110323-1, 23-03-2011 Tested on: 23-03-2011 19:59:07 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: Outbound message clean. Virus Database (VPS): 110323-1, 23-03-2011 Tested on: 24-03-2011 00:10:04 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
avast! Antivirus: Inbound message clean. Virus Database (VPS): 110323-1, 23-03-2011 Tested on: 24-03-2011 00:13:42 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com
avast! Antivirus: Outbound message clean. Virus Database (VPS): 110323-1, 23-03-2011 Tested on: 24-03-2011 00:16:17 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: Outbound message clean. Virus Database (VPS): 110324-0, 24-03-2011 Tested on: 24-03-2011 17:33:50 avast! - copyright (c) 1988-2011 AVAST Software. http://www.avast.com