Incorrect implementation of XQUF?
Tuesday, 10 May 2011 · 9 messages · last reply 23 May 2011
CD
Computer Software Developer10 May 2011 14:53 #
Hi,
I have a collection MyData/Test and another collection MyData/Real. I have the following XML occurring about five times in total, 4 times in collection MyData/Test and once in MyData/Real:
<APPLICATION>
<APPLICATION_ID>1</APPLICATION_ID>
</APPLICATION>When I seek to delete this application only from MyData/Test using updating xquery like so:
xquery version "1.0";
declare namespace fn="http://www.w3.org/2005/xpath-functions";
let $dataSet := 'Test'
let $databaseName := 'MyData'
let $applicationID := '1'
let $finalURL := fn:concat($databaseName, "/",$dataSet)
let $applicationsModified := <APP-DATA-ROOT
xmlns:xforms="http://www.w3.org/2002/xforms">
<APPLICATION>
<APPLICATION_ID>2</APPLICATION_ID>
</APPLICATION>
</APP-DATA-ROOT>
for $all in fn:collection($finalURL)
for $anApp in $all/APPLICATION[APPLICATION_ID=$applicationID]
return
(
delete nodes $anApp
)The application gets deleted from MyData/Real collection as well!
Moreover, an insert statement to insert an APPLICATION element in the return block above, such insert statement placed after the deletion statement above, does not appear to insert anything.
LK
Lukas Kircher11 May 2011 09:27 #
Hi Computer Software Developer,
I had a look at your issue - I attached my setup for reproduction, to make sure there aren't any errors on my side. You can start it by calling
*
'java -cp BaseX.jar org.basex.BaseX < commands.txt'*
For me it works fine with the actual release you can get
from [1]. Which version of BaseX are you using?
Regarding the insert issue: Are you trying to insert something into an APPLICATION element which is deleted by the delete
statement - in this case the insert operation is not carried out at all - as a result of optimization processes. Depending on what you want to do, I'd be happy to help you out ... just let me know.
Feel free to ask for more.
Regards,
Lukas
[1] http://basex.org/products/download/all-downloads/
Quoted text · Computer Software Developer · 49 lines
On Tue, May 10, 2011 at 2:53 PM, Computer Software Developer < computer.software.developer at gmail.com> wrote: > Hi, > > I have a collection MyData/Test and another collection MyData/Real. I > have the following XML occurring about five times in total, 4 times in > collection MyData/Test and once in MyData/Real: > > <APPLICATION> > <APPLICATION_ID>1</APPLICATION_ID> > </APPLICATION> > > When I seek to delete this application only from MyData/Test using > updating xquery like so: > xquery version "1.0"; > > declare namespace fn="http://www.w3.org/2005/xpath-functions"; > > let $dataSet := 'Test' > let $databaseName := 'MyData' > let $applicationID := '1' > > let $finalURL := fn:concat($databaseName, "/",$dataSet) > let $applicationsModified := <APP-DATA-ROOT > xmlns:xforms="http://www.w3.org/2002/xforms"> > <APPLICATION> > <APPLICATION_ID>2</APPLICATION_ID> > </APPLICATION> > </APP-DATA-ROOT> > > for $all in fn:collection($finalURL) > for $anApp in $all/APPLICATION[APPLICATION_ID=$applicationID] > return > ( > delete nodes $anApp > ) > > The application gets deleted from MyData/Real collection as well! > > Moreover, an insert statement to insert an APPLICATION element in the > return block above, such insert statement placed after the deletion > statement above, does not appear to insert anything. > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
LK
Lukas Kircher11 May 2011 09:29 #
Hi Computer Software Developer,
I had a look at your issue - I attached my setup for reproduction, to make sure there aren't any errors on my side. You can start it by calling
*
'java -cp BaseX.jar org.basex.BaseX < commands.txt'*
For me it works fine with the actual release you can get
from [1]. Which version of BaseX are you using?
Regarding the insert issue: Are you trying to insert something into an APPLICATION element which is deleted by the delete
statement - in this case the insert operation is not carried out at all - as a result of optimization processes. Depending on what you want to do, I'd be happy to help you out ... just let me know.
Feel free to ask for more.
Regards,
Lukas
[1] http://basex.org/products/download/all-downloads/
Quoted text · Computer Software Developer · 49 lines
On Tue, May 10, 2011 at 2:53 PM, Computer Software Developer < computer.software.developer at gmail.com> wrote: > Hi, > > I have a collection MyData/Test and another collection MyData/Real. I > have the following XML occurring about five times in total, 4 times in > collection MyData/Test and once in MyData/Real: > > <APPLICATION> > <APPLICATION_ID>1</APPLICATION_ID> > </APPLICATION> > > When I seek to delete this application only from MyData/Test using > updating xquery like so: > xquery version "1.0"; > > declare namespace fn="http://www.w3.org/2005/xpath-functions"; > > let $dataSet := 'Test' > let $databaseName := 'MyData' > let $applicationID := '1' > > let $finalURL := fn:concat($databaseName, "/",$dataSet) > let $applicationsModified := <APP-DATA-ROOT > xmlns:xforms="http://www.w3.org/2002/xforms"> > <APPLICATION> > <APPLICATION_ID>2</APPLICATION_ID> > </APPLICATION> > </APP-DATA-ROOT> > > for $all in fn:collection($finalURL) > for $anApp in $all/APPLICATION[APPLICATION_ID=$applicationID] > return > ( > delete nodes $anApp > ) > > The application gets deleted from MyData/Real collection as well! > > Moreover, an insert statement to insert an APPLICATION element in the > return block above, such insert statement placed after the deletion > statement above, does not appear to insert anything. > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CD
Quoted text · Lukas Kircher · 24 lines
On 11/05/2011 08:27, Lukas Kircher wrote: > Hi Computer Software Developer, > > I had a look at your issue - I attached my setup for reproduction, > to make sure there aren't any errors on my side. You can start > it by calling > * > 'java -cp BaseX.jar org.basex.BaseX < commands.txt'* > > For me it works fine with the actual release you can get > from [1]. Which version of BaseX are you using? > > Regarding the insert issue: Are you trying to insert something > into an APPLICATION element which is deleted by the delete > statement - in this case the insert operation is not carried out > at all - as a result of optimization processes. Depending on > what you want to do, I'd be happy to help you out ... just let me > know. > > Feel free to ask for more. > > Regards, > Lukas >
I could not reproduce it today in my own set up (I dropped the database and re-created the same today). All I can remember from yesterday is that first I was trying some incorrect replace statements (target of replace was a set of nodes instead of just one node) before using delete/insert statements ('cos I needed to replace a set of nodes).
If it helps, when I attempted a query in the UI yesterday (instead of JAX-RX), the database consistently threw some exception and suggested filing a bug report (I did not, unfortunately, store the details and the exception, so do not have access to the same right now).
My comments about insert were incorrect anyway, apologies for the same - I was mistakenly inserting into the parent element of the actual intended location (but was later checking the existence in the actual intended location)
If it happens again, will be more meticulous and will store the various steps/logs. I was using BaseX 6.5.1, will upgrade to 6.6.2 now.
Thanks for your help.
LK
Lukas Kircher11 May 2011 12:33 #
Hi,
thanks for your report. Just for clearance and for the benefit of other readers:
Quoted text · Computer Software Developer · 5 lines
[...] All I can remember from yesterday is > that first I was trying some incorrect replace statements (target of > replace was a set of nodes instead of just one node) before using > delete/insert statements ('cos I needed to replace a set of nodes). >
You could use an iterative approach, i.e.
*for $i in //node
return replace node $n with <newnode/>*This serves as a general solution for similar issues, as an insert or rename statement only allows single target nodes as well.
Quoted text · Computer Software Developer · 5 lines
> If it helps, when I attempted a query in the UI yesterday (instead of > JAX-RX), the database consistently threw some exception and suggested > filing a bug report (I did not, unfortunately, store the details and the > exception, so do not have access to the same right now). >
Interesting ... my first guess would be that there was some kind of concurrent access between the BaseX server and the GUI version. Make sure you don't use them on the same database at the same time as this could lead to concurrent file access on disk. Although possible, it is not intended. We will try to state this in a clearer manner on our website/documentation.
Quoted text · Computer Software Developer · 5 lines
> My comments about insert were incorrect anyway, apologies for the same - > I was mistakenly inserting into the parent element of the actual > intended location (but was later checking the existence in the actual > intended location) >
No worries.
Quoted text · Computer Software Developer · 3 lines
> If it happens again, will be more meticulous and will store the various > steps/logs. I was using BaseX 6.5.1, will upgrade to 6.6.2 now. >
Good to hear. There are a lot of changes between different revisions and we're constantly improving the code base. So running the most recent version is highly encouraged.
Feel free to ask for more, regards,
Lukas
SD
software developer23 May 2011 12:00 #
Hi,
All I did was upgrade from 6.5.1 to 6.6.3-SNAPSHOT which I took from BaseX file-server today (a couple of hours ago) and I get:
Not expected (Data Access out of bounds [pre:2050100, indexSize:8028, access:8028 > 8027]
This is quite similar to the issue I faced when I raised the original query regarding XQUF (this thread).
Immediately downgraded to 6.5.1 and the issue got fixed (I did not update the data at all).
Thanks.
Quoted text · Lukas Kircher · 57 lines
On Wed, May 11, 2011 at 11:33 AM, Lukas Kircher <lukaskircher1 at googlemail.com> wrote: > Hi, > > thanks for your report. Just for clearance and for the benefit of > other readers: > > >> [...] All I can remember from yesterday is >> that first I was trying some incorrect replace statements (target of >> replace was a set of nodes instead of just one node) before using >> delete/insert statements ('cos I needed to replace a set of nodes). > > You could use an iterative approach, i.e. > > for $i in //node > return replace node $n with <newnode/> > > This serves as a general solution for similar issues, as an insert or > rename statement only allows single target nodes as well. > > >> >> If it helps, when I attempted a query in the UI yesterday (instead of >> JAX-RX), the database consistently threw some exception and suggested >> filing a bug report (I did not, unfortunately, store the details and the >> exception, so do not have access to the same right now). > > Interesting ... my first guess would be that there was some kind of > concurrent access between the BaseX server and the GUI version. > Make sure you don't use them on the same database at the same > time as this could lead to concurrent file access on disk. Although > possible, it is not intended. We will try to state this in a clearer manner > on our website/documentation. > > >> >> My comments about insert were incorrect anyway, apologies for the same - >> I was mistakenly inserting into the parent element of the actual >> intended location (but was later checking the existence in the actual >> intended location) > > No worries. > > >> >> If it happens again, will be more meticulous and will store the various >> steps/logs. I was using BaseX 6.5.1, will upgrade to 6.6.2 now. > > Good to hear. There are a lot of changes between different revisions and > we're constantly improving the code base. So running the most recent > version is highly encouraged. > > > Feel free to ask for more, regards, > Lukas >
CG
Christian Grün23 May 2011 12:51 #
It might be that your database is corrupt due to an old version of BaseX anyway. To give you more help, we'll need more details. Christian
Quoted text · software developer · 79 lines
On Mon, May 23, 2011 at 12:00 PM, software developer <computer.software.developer at gmail.com> wrote: > Hi, > > All I did was upgrade from 6.5.1 to 6.6.3-SNAPSHOT which I took from > BaseX file-server today (a couple of hours ago) and I get: > Not expected (Data Access out of bounds [pre:2050100, indexSize:8028, > access:8028 > 8027] > > This is quite similar to the issue I faced when I raised the original > query regarding XQUF (this thread). > > Immediately downgraded to 6.5.1 and the issue got fixed (I did not > update the data at all). > > Thanks. > > On Wed, May 11, 2011 at 11:33 AM, Lukas Kircher > <lukaskircher1 at googlemail.com> wrote: >> Hi, >> >> thanks for your report. Just for clearance and for the benefit of >> other readers: >> >> >>> [...] All I can remember from yesterday is >>> that first I was trying some incorrect replace statements (target of >>> replace was a set of nodes instead of just one node) before using >>> delete/insert statements ('cos I needed to replace a set of nodes). >> >> You could use an iterative approach, i.e. >> >> for $i in //node >> return replace node $n with <newnode/> >> >> This serves as a general solution for similar issues, as an insert or >> rename statement only allows single target nodes as well. >> >> >>> >>> If it helps, when I attempted a query in the UI yesterday (instead of >>> JAX-RX), the database consistently threw some exception and suggested >>> filing a bug report (I did not, unfortunately, store the details and the >>> exception, so do not have access to the same right now). >> >> Interesting ... my first guess would be that there was some kind of >> concurrent access between the BaseX server and the GUI version. >> Make sure you don't use them on the same database at the same >> time as this could lead to concurrent file access on disk. Although >> possible, it is not intended. We will try to state this in a clearer manner >> on our website/documentation. >> >> >>> >>> My comments about insert were incorrect anyway, apologies for the same - >>> I was mistakenly inserting into the parent element of the actual >>> intended location (but was later checking the existence in the actual >>> intended location) >> >> No worries. >> >> >>> >>> If it happens again, will be more meticulous and will store the various >>> steps/logs. I was using BaseX 6.5.1, will upgrade to 6.6.2 now. >> >> Good to hear. There are a lot of changes between different revisions and >> we're constantly improving the code base. So running the most recent >> version is highly encouraged. >> >> >> Feel free to ask for more, regards, >> Lukas >> > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
SD
software developer23 May 2011 13:18 #
Are you saying that due to the fact my database is fine in 6.5.1 but not in 6.6.3-SNAPSHOT implies my database is corrupt?
Do databases need to be 'migrated' every time you release a version (minor or major?)? If so, is there a migration utility?
Can you tell me what details you need? I won't be able to send you the XMLs forming this database. I can tell you, however, all I did was run a query which retrieved one element (having several descendent elements) from a sub-collection. The JAX-RX query was like: http://localhost:8984/basex/jax-rx/?run=getData.xq&var=$databaseName=MyDB%01$v1=SubPath%01$v2=SubSubPath%01dataID=1&wrap=no&output=media-type=application/xml&output=encoding=iso-8859-1&output=omit-xml-declaration=no
The XMLs were loaded via JAX-RX POST to
http://localhost:8984/basex/jax-rx/MyDB/SubPath/SubSubPath/dataFileN where dataFileN is the unique name of the data-file being loaded (dataFileOne, dataFileTwo etc.). The database was created using JAX-RX command invocation (param command=CREATE+DATABASE+MyDB)
Quoted text · Christian Grün · 87 lines
On Mon, May 23, 2011 at 11:51 AM, Christian Grün <christian.gruen at gmail.com> wrote: > It might be that your database is corrupt due to an old version of > BaseX anyway. To give you more help, we'll need more details. > Christian > ___________________________ > > On Mon, May 23, 2011 at 12:00 PM, software developer > <computer.software.developer at gmail.com> wrote: >> Hi, >> >> All I did was upgrade from 6.5.1 to 6.6.3-SNAPSHOT which I took from >> BaseX file-server today (a couple of hours ago) and I get: >> Not expected (Data Access out of bounds [pre:2050100, indexSize:8028, >> access:8028 > 8027] >> >> This is quite similar to the issue I faced when I raised the original >> query regarding XQUF (this thread). >> >> Immediately downgraded to 6.5.1 and the issue got fixed (I did not >> update the data at all). >> >> Thanks. >> >> On Wed, May 11, 2011 at 11:33 AM, Lukas Kircher >> <lukaskircher1 at googlemail.com> wrote: >>> Hi, >>> >>> thanks for your report. Just for clearance and for the benefit of >>> other readers: >>> >>> >>>> [...] All I can remember from yesterday is >>>> that first I was trying some incorrect replace statements (target of >>>> replace was a set of nodes instead of just one node) before using >>>> delete/insert statements ('cos I needed to replace a set of nodes). >>> >>> You could use an iterative approach, i.e. >>> >>> for $i in //node >>> return replace node $n with <newnode/> >>> >>> This serves as a general solution for similar issues, as an insert or >>> rename statement only allows single target nodes as well. >>> >>> >>>> >>>> If it helps, when I attempted a query in the UI yesterday (instead of >>>> JAX-RX), the database consistently threw some exception and suggested >>>> filing a bug report (I did not, unfortunately, store the details and the >>>> exception, so do not have access to the same right now). >>> >>> Interesting ... my first guess would be that there was some kind of >>> concurrent access between the BaseX server and the GUI version. >>> Make sure you don't use them on the same database at the same >>> time as this could lead to concurrent file access on disk. Although >>> possible, it is not intended. We will try to state this in a clearer manner >>> on our website/documentation. >>> >>> >>>> >>>> My comments about insert were incorrect anyway, apologies for the same - >>>> I was mistakenly inserting into the parent element of the actual >>>> intended location (but was later checking the existence in the actual >>>> intended location) >>> >>> No worries. >>> >>> >>>> >>>> If it happens again, will be more meticulous and will store the various >>>> steps/logs. I was using BaseX 6.5.1, will upgrade to 6.6.2 now. >>> >>> Good to hear. There are a lot of changes between different revisions and >>> we're constantly improving the code base. So running the most recent >>> version is highly encouraged. >>> >>> >>> Feel free to ask for more, regards, >>> Lukas >>> >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >> >
CG
Christian Grün23 May 2011 13:33 #
Quoted text · software developer · 2 lines
> Are you saying that due to the fact my database is fine in 6.5.1 but > not in 6.6.3-SNAPSHOT implies my database is corrupt?
The database design hasn't been changed from 6.5.1. to 6.6.3. Instead, it might be that your database has been corrupted before, even if BaseX 6.5.1 doesn't complain.
Quoted text · software developer · 2 lines
> Can you tell me what details you need? I won't be able to send you > the XMLs forming this database.
It's difficult to give you serious feedback without a reproducible example (sscce). As an example, we have no idea what the getData.xq script does.
Did you manage to reproduce the behavior by redoing the relevant steps? C.
Quoted text · software developer · 10 lines
I can tell you, however, all I did > was run a query which retrieved one element (having several descendent > elements) from a sub-collection. The JAX-RX query was like: > http://localhost:8984/basex/jax-rx/?run=getData.xq&var=$databaseName=MyDB%01$v1=SubPath%01$v2=SubSubPath%01dataID=1&wrap=no&output=media-type=application/xml&output=encoding=iso-8859-1&output=omit-xml-declaration=no > > The XMLs were loaded via JAX-RX POST to > http://localhost:8984/basex/jax-rx/MyDB/SubPath/SubSubPath/dataFileN > where dataFileN is the unique name of the data-file being loaded > (dataFileOne, dataFileTwo etc.). The database was created using > JAX-RX command invocation (param command=CREATE+DATABASE+MyDB)
Written for BaseX 6.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery