Query optimizer bug with nested for? - java.lang.NullPointerException at Path.index(Path.java:673)
Monday, 11 May 2020 · 8 messages · last reply 12 May 2020
CG
Quoted text · Sebastian Guerrero · 3 lines
> > Maybe it's a newbie issue, but I would like your comments. >
…definitely something you shouldn't encounter as a newbie either ;) Thanks for reporting it.
Does the exception also occur with the latest snapshot [1]?
Cheers
Christian
[1] http://files.basex.org/releases/latest/
Quoted text · Sebastian Guerrero · 100 lines
> I'm writing a RESTXQ method to search among a couple of databases. ( >100 > databases ) > > Some databases are split into a couple of parts due to the number of > nodes. For example US: it's separated into US00, US01 and US02. > > So, my problem is: > > if I replace "*for $usPart in ('US00')*" by "*for $usPart in > ('US00','US01',''US02)*" in *QUERY [A]*, I get this error: > > *Improper use? Potential bug? Your feedback is welcome:* > *Contact: basex-talk at mailman.uni-konstanz.de > <basex-talk at mailman.uni-konstanz.de>* > *Version: BaseX 9.3.2* > *Java: Oracle Corporation, 1.8.0_251* > *OS: Windows 10, amd64* > *Stack Trace: * > *java.lang.NullPointerException* > * at org.basex.query.expr.path.Path.index(Path.java:673)* > * at org.basex.query.expr.path.Path.optimize(Path.java:157)* > * at org.basex.query.expr.gflwor.For.toPredicate(For.java:220)* > * at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)* > * at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)* > * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)* > * at org.basex.query.expr.Extension.compile(Extension.java:45)* > * at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40)* > * at org.basex.query.expr.Switch.compile(Switch.java:60)* > * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96)* > * at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)* > * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90)* > * at org.basex.query.scope.MainModule.comp(MainModule.java:81)* > * at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114)* > * at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105)* > * at org.basex.query.QueryContext.compile(QueryContext.java:312)* > * at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79)* > > > Using "*for $usPart in ('US00')*" it works without any problem. With one > element there is no problem, with two or more it fails. > > Any ideas about what I'm doing wrong? > > Here is the > *QUERY [A]* > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; > > let $text:="christian" > let $registries:=('GB','US') > > let $results := > for $registry in $registries > return > switch ($registry) > > case "US" > return > (# db:enforceindex #) { > for $usPart in ('US00') > for $tmUS in > db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file > where $tmUS/case-file-header/mark-identification/text() > contains text {$text} using stemming > return > <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> > } > > case "GB" > return > (# db:enforceindex #) { > for $tmGB in > db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark > where > $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains > text {$text} > return > <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> > > } > > default return "" > > return > <result> > <total>{count($results)}</total> > <trademarks> > { > for $result in $results > return $result > } > </trademarks> > </result> > > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > > Regards, > Sebastian >
CG
I’ll have a look at this tomorrow!
Quoted text · Sebastian Guerrero · 134 lines
Sebastian Guerrero <chapeti at gmail.com> schrieb am Mo., 11. Mai 2020, 21:47: > Hi Christian!, thanks for your reply :-) > > I've just downloaded the latest snapshot [1] and executed the query [2], > and yes: the problem is still there. > > Cheers, > Sebastian. > > [1] https://imgur.com/ahgMg7p > [2] https://imgur.com/tDCAtCu > > On Mon, May 11, 2020 at 3:58 PM Christian Grün <christian.gruen at gmail.com> > wrote: > >> Maybe it's a newbie issue, but I would like your comments. >>> >> >> …definitely something you shouldn't encounter as a newbie either ;) >> Thanks for reporting it. >> >> Does the exception also occur with the latest snapshot [1]? >> >> Cheers >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> >> >>> I'm writing a RESTXQ method to search among a couple of databases. ( >>> >100 databases ) >>> >>> Some databases are split into a couple of parts due to the number of >>> nodes. For example US: it's separated into US00, US01 and US02. >>> >>> So, my problem is: >>> >>> if I replace "*for $usPart in ('US00')*" by "*for $usPart in >>> ('US00','US01',''US02)*" in *QUERY [A]*, I get this error: >>> >>> *Improper use? Potential bug? Your feedback is welcome:* >>> *Contact: basex-talk at mailman.uni-konstanz.de >>> <basex-talk at mailman.uni-konstanz.de>* >>> *Version: BaseX 9.3.2* >>> *Java: Oracle Corporation, 1.8.0_251* >>> *OS: Windows 10, amd64* >>> *Stack Trace: * >>> *java.lang.NullPointerException* >>> * at org.basex.query.expr.path.Path.index(Path.java:673)* >>> * at org.basex.query.expr.path.Path.optimize(Path.java:157)* >>> * at org.basex.query.expr.gflwor.For.toPredicate(For.java:220)* >>> * at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)* >>> * at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)* >>> * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)* >>> * at org.basex.query.expr.Extension.compile(Extension.java:45)* >>> * at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40)* >>> * at org.basex.query.expr.Switch.compile(Switch.java:60)* >>> * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96)* >>> * at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)* >>> * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90)* >>> * at org.basex.query.scope.MainModule.comp(MainModule.java:81)* >>> * at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114)* >>> * at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105)* >>> * at org.basex.query.QueryContext.compile(QueryContext.java:312)* >>> * at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79)* >>> >>> >>> Using "*for $usPart in ('US00')*" it works without any problem. With >>> one element there is no problem, with two or more it fails. >>> >>> Any ideas about what I'm doing wrong? >>> >>> Here is the >>> *QUERY [A]* >>> >>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >>> declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; >>> >>> let $text:="christian" >>> let $registries:=('GB','US') >>> >>> let $results := >>> for $registry in $registries >>> return >>> switch ($registry) >>> >>> case "US" >>> return >>> (# db:enforceindex #) { >>> for $usPart in ('US00') >>> for $tmUS in >>> db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file >>> where >>> $tmUS/case-file-header/mark-identification/text() contains text {$text} >>> using stemming >>> return >>> <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> >>> } >>> >>> case "GB" >>> return >>> (# db:enforceindex #) { >>> for $tmGB in >>> db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark >>> where >>> $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains >>> text {$text} >>> return >>> <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> >>> >>> } >>> >>> default return "" >>> >>> return >>> <result> >>> <total>{count($results)}</total> >>> <trademarks> >>> { >>> for $result in $results >>> return $result >>> } >>> </trademarks> >>> </result> >>> >>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >>> >>> Regards, >>> Sebastian >>> >>
SG
Sebastian Guerrero11 May 2020 22:55 #
Hi everybody!
Maybe it's a newbie issue, but I would like your comments.
I'm writing a RESTXQ method to search among a couple of databases. ( >100 databases )
Some databases are split into a couple of parts due to the number of nodes. For example US: it's separated into US00, US01 and US02.
So, my problem is:
if I replace "*for $usPart in ('US00')*" by "*for $usPart in ('US00','US01',''US02)*" in *QUERY [A]*, I get this error:
*Improper use? Potential bug? Your feedback is welcome:*
*Contact: basex-talk at mailman.uni-konstanz.de
<basex-talk at mailman.uni-konstanz.de>*
*Version: BaseX 9.3.2*
*Java: Oracle Corporation, 1.8.0_251*
*OS: Windows 10, amd64*
*Stack Trace: *
*java.lang.NullPointerException*
* at org.basex.query.expr.path.Path.index(Path.java:673)*
* at org.basex.query.expr.path.Path.optimize(Path.java:157)*
* at org.basex.query.expr.gflwor.For.toPredicate(For.java:220)*
* at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)*
* at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)*
* at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)*
* at org.basex.query.expr.Extension.compile(Extension.java:45)*
* at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40)*
* at org.basex.query.expr.Switch.compile(Switch.java:60)*
* at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96)*
* at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)*
* at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90)*
* at org.basex.query.scope.MainModule.comp(MainModule.java:81)*
* at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114)*
* at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105)*
* at org.basex.query.QueryContext.compile(QueryContext.java:312)*
* at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79)*
Using "*for $usPart in ('US00')*" it works without any problem. With one element there is no problem, with two or more it fails.
Any ideas about what I'm doing wrong?
Here is the
*QUERY [A]*
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- declare namespace gb="http://www.ipo.gov.uk/schemas/tm";
let $text:="christian"
let $registries:=('GB','US')
let $results :=
for $registry in $registries
return
switch ($registry)
case "US"
return
(# db:enforceindex #) {
for $usPart in ('US00')
for $tmUS in
db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file
where $tmUS/case-file-header/mark-identification/text()
contains text {$text} using stemming
return
<trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark>
}
case "GB"
return
(# db:enforceindex #) {
for $tmGB in
db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark
where
$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains
text {$text}
return
<trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> }
default return ""
return
<result>
<total>{count($results)}</total>
<trademarks>
{
for $result in $results
return $result
}
</trademarks>
</result>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Regards,
Sebastian
CG
Buenas noticias: The bug is fixed. A new snapshot is waiting for you [1].
Cheers,
Christian
[1] http://files.basex.org/releases/latest/
Quoted text · Sebastian Guerrero · 114 lines
On Mon, May 11, 2020 at 9:47 PM Sebastian Guerrero <chapeti at gmail.com> wrote: > > Hi Christian!, thanks for your reply :-) > > I've just downloaded the latest snapshot [1] and executed the query [2], and yes: the problem is still there. > > Cheers, > Sebastian. > > [1] https://imgur.com/ahgMg7p > [2] https://imgur.com/tDCAtCu > > On Mon, May 11, 2020 at 3:58 PM Christian Grün <christian.gruen at gmail.com> wrote: >>> >>> Maybe it's a newbie issue, but I would like your comments. >> >> >> …definitely something you shouldn't encounter as a newbie either ;) Thanks for reporting it. >> >> Does the exception also occur with the latest snapshot [1]? >> >> Cheers >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> >>> >>> I'm writing a RESTXQ method to search among a couple of databases. ( >100 databases ) >>> >>> Some databases are split into a couple of parts due to the number of nodes. For example US: it's separated into US00, US01 and US02. >>> >>> So, my problem is: >>> >>> if I replace "for $usPart in ('US00')" by "for $usPart in ('US00','US01',''US02)" in QUERY [A], I get this error: >>> >>> Improper use? Potential bug? Your feedback is welcome: >>> Contact: basex-talk at mailman.uni-konstanz.de >>> Version: BaseX 9.3.2 >>> Java: Oracle Corporation, 1.8.0_251 >>> OS: Windows 10, amd64 >>> Stack Trace: >>> java.lang.NullPointerException >>> at org.basex.query.expr.path.Path.index(Path.java:673) >>> at org.basex.query.expr.path.Path.optimize(Path.java:157) >>> at org.basex.query.expr.gflwor.For.toPredicate(For.java:220) >>> at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532) >>> at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109) >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100) >>> at org.basex.query.expr.Extension.compile(Extension.java:45) >>> at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40) >>> at org.basex.query.expr.Switch.compile(Switch.java:60) >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96) >>> at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43) >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90) >>> at org.basex.query.scope.MainModule.comp(MainModule.java:81) >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114) >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105) >>> at org.basex.query.QueryContext.compile(QueryContext.java:312) >>> at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79) >>> >>> >>> Using "for $usPart in ('US00')" it works without any problem. With one element there is no problem, with two or more it fails. >>> >>> Any ideas about what I'm doing wrong? >>> >>> Here is the >>> QUERY [A] >>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >>> declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; >>> >>> let $text:="christian" >>> let $registries:=('GB','US') >>> >>> let $results := >>> for $registry in $registries >>> return >>> switch ($registry) >>> >>> case "US" >>> return >>> (# db:enforceindex #) { >>> for $usPart in ('US00') >>> for $tmUS in db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file >>> where $tmUS/case-file-header/mark-identification/text() contains text {$text} using stemming >>> return <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> >>> } >>> >>> case "GB" >>> return >>> (# db:enforceindex #) { >>> for $tmGB in db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark >>> where $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains text {$text} >>> return <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> >>> } >>> >>> default return "" >>> >>> return >>> <result> >>> <total>{count($results)}</total> >>> <trademarks> >>> { >>> for $result in $results >>> return $result >>> } >>> </trademarks> >>> </result> >>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >>> >>> Regards, >>> Sebastian
SG
Hi Christian!, thanks for your reply :-)
I've just downloaded the latest snapshot [1] and executed the query [2], and yes: the problem is still there.
Cheers,
Sebastian.
[1] https://imgur.com/ahgMg7p
[2] https://imgur.com/tDCAtCu
Quoted text · Christian Grün · 120 lines
On Mon, May 11, 2020 at 3:58 PM Christian Grün <christian.gruen at gmail.com> wrote: > Maybe it's a newbie issue, but I would like your comments. >> > > …definitely something you shouldn't encounter as a newbie either ;) Thanks > for reporting it. > > Does the exception also occur with the latest snapshot [1]? > > Cheers > Christian > > [1] http://files.basex.org/releases/latest/ > > > > > >> I'm writing a RESTXQ method to search among a couple of databases. ( >100 >> databases ) >> >> Some databases are split into a couple of parts due to the number of >> nodes. For example US: it's separated into US00, US01 and US02. >> >> So, my problem is: >> >> if I replace "*for $usPart in ('US00')*" by "*for $usPart in >> ('US00','US01',''US02)*" in *QUERY [A]*, I get this error: >> >> *Improper use? Potential bug? Your feedback is welcome:* >> *Contact: basex-talk at mailman.uni-konstanz.de >> <basex-talk at mailman.uni-konstanz.de>* >> *Version: BaseX 9.3.2* >> *Java: Oracle Corporation, 1.8.0_251* >> *OS: Windows 10, amd64* >> *Stack Trace: * >> *java.lang.NullPointerException* >> * at org.basex.query.expr.path.Path.index(Path.java:673)* >> * at org.basex.query.expr.path.Path.optimize(Path.java:157)* >> * at org.basex.query.expr.gflwor.For.toPredicate(For.java:220)* >> * at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)* >> * at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)* >> * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)* >> * at org.basex.query.expr.Extension.compile(Extension.java:45)* >> * at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40)* >> * at org.basex.query.expr.Switch.compile(Switch.java:60)* >> * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96)* >> * at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43)* >> * at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90)* >> * at org.basex.query.scope.MainModule.comp(MainModule.java:81)* >> * at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114)* >> * at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105)* >> * at org.basex.query.QueryContext.compile(QueryContext.java:312)* >> * at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79)* >> >> >> Using "*for $usPart in ('US00')*" it works without any problem. With one >> element there is no problem, with two or more it fails. >> >> Any ideas about what I'm doing wrong? >> >> Here is the >> *QUERY [A]* >> >> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >> declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; >> >> let $text:="christian" >> let $registries:=('GB','US') >> >> let $results := >> for $registry in $registries >> return >> switch ($registry) >> >> case "US" >> return >> (# db:enforceindex #) { >> for $usPart in ('US00') >> for $tmUS in >> db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file >> where $tmUS/case-file-header/mark-identification/text() >> contains text {$text} using stemming >> return >> <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> >> } >> >> case "GB" >> return >> (# db:enforceindex #) { >> for $tmGB in >> db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark >> where >> $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains >> text {$text} >> return >> <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> >> >> } >> >> default return "" >> >> return >> <result> >> <total>{count($results)}</total> >> <trademarks> >> { >> for $result in $results >> return $result >> } >> </trademarks> >> </result> >> >> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >> >> Regards, >> Sebastian >> >
CG
Quoted text · Sebastian Guerrero · 1 line
> I'm asking because I downloaded it and the error is still there, but now on line 671 instead of the original line 673.
Hm, maybe it was the previous 9.3.3 snapshot you launched?
Feel free to provide me with a minimized query that allows me to reproduce the bug if it persists. On GitHub, I have referenced a query that I used for testing [1].
Best,
Christian
[1] https://github.com/BaseXdb/basex/issues/1860
Quoted text · Sebastian Guerrero · 146 lines
> Unexpected error: Improper use? Potential bug? Your feedback is welcome: > Contact: basex-talk at mailman.uni-konstanz.de > Version: BaseX 9.3.3 beta > Java: Oracle Corporation, 1.8.0_251 > OS: Windows 10, amd64 > Stack Trace: > java.lang.NullPointerException > at org.basex.query.expr.path.Path.index(Path.java:671) > at org.basex.query.expr.path.Path.optimize(Path.java:157) > at org.basex.query.expr.gflwor.For.addPredicate(For.java:190) > at org.basex.query.expr.gflwor.For.toPredicate(For.java:218) > at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532) > at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109) > at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100) > at org.basex.query.expr.Extension.compile(Extension.java:45) > > > Cheers, > Sebastian. > > > On Mon, May 11, 2020 at 6:15 PM Christian Grün <christian.gruen at gmail.com> wrote: >> >> Buenas noticias: The bug is fixed. A new snapshot is waiting for you [1]. >> >> Cheers, >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> On Mon, May 11, 2020 at 9:47 PM Sebastian Guerrero <chapeti at gmail.com> wrote: >> > >> > Hi Christian!, thanks for your reply :-) >> > >> > I've just downloaded the latest snapshot [1] and executed the query [2], and yes: the problem is still there. >> > >> > Cheers, >> > Sebastian. >> > >> > [1] https://imgur.com/ahgMg7p >> > [2] https://imgur.com/tDCAtCu >> > >> > On Mon, May 11, 2020 at 3:58 PM Christian Grün <christian.gruen at gmail.com> wrote: >> >>> >> >>> Maybe it's a newbie issue, but I would like your comments. >> >> >> >> >> >> …definitely something you shouldn't encounter as a newbie either ;) Thanks for reporting it. >> >> >> >> Does the exception also occur with the latest snapshot [1]? >> >> >> >> Cheers >> >> Christian >> >> >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> >> >> >> >> >> >>> >> >>> I'm writing a RESTXQ method to search among a couple of databases. ( >100 databases ) >> >>> >> >>> Some databases are split into a couple of parts due to the number of nodes. For example US: it's separated into US00, US01 and US02. >> >>> >> >>> So, my problem is: >> >>> >> >>> if I replace "for $usPart in ('US00')" by "for $usPart in ('US00','US01',''US02)" in QUERY [A], I get this error: >> >>> >> >>> Improper use? Potential bug? Your feedback is welcome: >> >>> Contact: basex-talk at mailman.uni-konstanz.de >> >>> Version: BaseX 9.3.2 >> >>> Java: Oracle Corporation, 1.8.0_251 >> >>> OS: Windows 10, amd64 >> >>> Stack Trace: >> >>> java.lang.NullPointerException >> >>> at org.basex.query.expr.path.Path.index(Path.java:673) >> >>> at org.basex.query.expr.path.Path.optimize(Path.java:157) >> >>> at org.basex.query.expr.gflwor.For.toPredicate(For.java:220) >> >>> at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532) >> >>> at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109) >> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100) >> >>> at org.basex.query.expr.Extension.compile(Extension.java:45) >> >>> at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40) >> >>> at org.basex.query.expr.Switch.compile(Switch.java:60) >> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96) >> >>> at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43) >> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90) >> >>> at org.basex.query.scope.MainModule.comp(MainModule.java:81) >> >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114) >> >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105) >> >>> at org.basex.query.QueryContext.compile(QueryContext.java:312) >> >>> at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79) >> >>> >> >>> >> >>> Using "for $usPart in ('US00')" it works without any problem. With one element there is no problem, with two or more it fails. >> >>> >> >>> Any ideas about what I'm doing wrong? >> >>> >> >>> Here is the >> >>> QUERY [A] >> >>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >> >>> declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; >> >>> >> >>> let $text:="christian" >> >>> let $registries:=('GB','US') >> >>> >> >>> let $results := >> >>> for $registry in $registries >> >>> return >> >>> switch ($registry) >> >>> >> >>> case "US" >> >>> return >> >>> (# db:enforceindex #) { >> >>> for $usPart in ('US00') >> >>> for $tmUS in db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file >> >>> where $tmUS/case-file-header/mark-identification/text() contains text {$text} using stemming >> >>> return <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> >> >>> } >> >>> >> >>> case "GB" >> >>> return >> >>> (# db:enforceindex #) { >> >>> for $tmGB in db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark >> >>> where $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains text {$text} >> >>> return <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> >> >>> } >> >>> >> >>> default return "" >> >>> >> >>> return >> >>> <result> >> >>> <total>{count($results)}</total> >> >>> <trademarks> >> >>> { >> >>> for $result in $results >> >>> return $result >> >>> } >> >>> </trademarks> >> >>> </result> >> >>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >> >>> >> >>> Regards, >> >>> Sebastian
SG
Hi Christian!
Wow, you are like a Terminator of coding! XD
Is *BaseX933-20200511.231351.exe *( snapshot of 23:14 ) the latest version?
I'm asking because I downloaded it and the error is still there, but now on line 671 instead of the original line 673.
*Unexpected error: Improper use? Potential bug? Your feedback is welcome:* *Contact: basex-talk at mailman.uni-konstanz.de
<basex-talk at mailman.uni-konstanz.de>*
*Version: BaseX 9.3.3 beta*
*Java: Oracle Corporation, 1.8.0_251*
*OS: Windows 10, amd64*
*Stack Trace: *
*java.lang.NullPointerException*
* at org.basex.query.expr.path.Path.index(Path.java:671)*
* at org.basex.query.expr.path.Path.optimize(Path.java:157)*
* at org.basex.query.expr.gflwor.For.addPredicate(For.java:190)*
* at org.basex.query.expr.gflwor.For.toPredicate(For.java:218)*
* at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532)*
* at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109)*
* at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100)*
* at org.basex.query.expr.Extension.compile(Extension.java:45)*
Cheers,
Sebastian.
Quoted text · Christian Grün · 144 lines
On Mon, May 11, 2020 at 6:15 PM Christian Grün <christian.gruen at gmail.com> wrote: > Buenas noticias: The bug is fixed. A new snapshot is waiting for you [1]. > > Cheers, > Christian > > [1] http://files.basex.org/releases/latest/ > > > > On Mon, May 11, 2020 at 9:47 PM Sebastian Guerrero <chapeti at gmail.com> > wrote: > > > > Hi Christian!, thanks for your reply :-) > > > > I've just downloaded the latest snapshot [1] and executed the query [2], > and yes: the problem is still there. > > > > Cheers, > > Sebastian. > > > > [1] https://imgur.com/ahgMg7p > > [2] https://imgur.com/tDCAtCu > > > > On Mon, May 11, 2020 at 3:58 PM Christian Grün < > christian.gruen at gmail.com> wrote: > >>> > >>> Maybe it's a newbie issue, but I would like your comments. > >> > >> > >> …definitely something you shouldn't encounter as a newbie either ;) > Thanks for reporting it. > >> > >> Does the exception also occur with the latest snapshot [1]? > >> > >> Cheers > >> Christian > >> > >> [1] http://files.basex.org/releases/latest/ > >> > >> > >> > >> > >>> > >>> I'm writing a RESTXQ method to search among a couple of databases. ( > >100 databases ) > >>> > >>> Some databases are split into a couple of parts due to the number of > nodes. For example US: it's separated into US00, US01 and US02. > >>> > >>> So, my problem is: > >>> > >>> if I replace "for $usPart in ('US00')" by "for $usPart in > ('US00','US01',''US02)" in QUERY [A], I get this error: > >>> > >>> Improper use? Potential bug? Your feedback is welcome: > >>> Contact: basex-talk at mailman.uni-konstanz.de > >>> Version: BaseX 9.3.2 > >>> Java: Oracle Corporation, 1.8.0_251 > >>> OS: Windows 10, amd64 > >>> Stack Trace: > >>> java.lang.NullPointerException > >>> at org.basex.query.expr.path.Path.index(Path.java:673) > >>> at org.basex.query.expr.path.Path.optimize(Path.java:157) > >>> at org.basex.query.expr.gflwor.For.toPredicate(For.java:220) > >>> at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532) > >>> at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109) > >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100) > >>> at org.basex.query.expr.Extension.compile(Extension.java:45) > >>> at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40) > >>> at org.basex.query.expr.Switch.compile(Switch.java:60) > >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96) > >>> at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43) > >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90) > >>> at org.basex.query.scope.MainModule.comp(MainModule.java:81) > >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114) > >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105) > >>> at org.basex.query.QueryContext.compile(QueryContext.java:312) > >>> at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79) > >>> > >>> > >>> Using "for $usPart in ('US00')" it works without any problem. With one > element there is no problem, with two or more it fails. > >>> > >>> Any ideas about what I'm doing wrong? > >>> > >>> Here is the > >>> QUERY [A] > >>> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > >>> declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; > >>> > >>> let $text:="christian" > >>> let $registries:=('GB','US') > >>> > >>> let $results := > >>> for $registry in $registries > >>> return > >>> switch ($registry) > >>> > >>> case "US" > >>> return > >>> (# db:enforceindex #) { > >>> for $usPart in ('US00') > >>> for $tmUS in > db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file > >>> where > $tmUS/case-file-header/mark-identification/text() contains text {$text} > using stemming > >>> return > <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> > >>> } > >>> > >>> case "GB" > >>> return > >>> (# db:enforceindex #) { > >>> for $tmGB in > db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark > >>> where > $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains > text {$text} > >>> return > <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> > >>> } > >>> > >>> default return "" > >>> > >>> return > >>> <result> > >>> <total>{count($results)}</total> > >>> <trademarks> > >>> { > >>> for $result in $results > >>> return $result > >>> } > >>> </trademarks> > >>> </result> > >>> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > >>> > >>> Regards, > >>> Sebastian >
SG
Yes!, you were right!
I've bought a new 2TB M.2 disk to play with BaseX and I've got confused: instead of install in *A:* I installed the new snapshot on the old *C:*
Now it works like a charm !! [1]
Thank you very very much, Christian, by your time.
Best regards!
Sebastian.
[1] https://imgur.com/DQi5aNP
Quoted text · Christian Grün · 186 lines
On Mon, May 11, 2020 at 6:48 PM Christian Grün <christian.gruen at gmail.com> wrote: > > I'm asking because I downloaded it and the error is still there, but now > on line 671 instead of the original line 673. > > Hm, maybe it was the previous 9.3.3 snapshot you launched? > > Feel free to provide me with a minimized query that allows me to > reproduce the bug if it persists. On GitHub, I have referenced a query > that I used for testing [1]. > > Best, > Christian > > [1] https://github.com/BaseXdb/basex/issues/1860 > > > > > > Unexpected error: Improper use? Potential bug? Your feedback is welcome: > > Contact: basex-talk at mailman.uni-konstanz.de > > Version: BaseX 9.3.3 beta > > Java: Oracle Corporation, 1.8.0_251 > > OS: Windows 10, amd64 > > Stack Trace: > > java.lang.NullPointerException > > at org.basex.query.expr.path.Path.index(Path.java:671) > > at org.basex.query.expr.path.Path.optimize(Path.java:157) > > at org.basex.query.expr.gflwor.For.addPredicate(For.java:190) > > at org.basex.query.expr.gflwor.For.toPredicate(For.java:218) > > at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532) > > at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109) > > at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100) > > at org.basex.query.expr.Extension.compile(Extension.java:45) > > > > > > Cheers, > > Sebastian. > > > > > > On Mon, May 11, 2020 at 6:15 PM Christian Grün < > christian.gruen at gmail.com> wrote: > >> > >> Buenas noticias: The bug is fixed. A new snapshot is waiting for you > [1]. > >> > >> Cheers, > >> Christian > >> > >> [1] http://files.basex.org/releases/latest/ > >> > >> > >> > >> On Mon, May 11, 2020 at 9:47 PM Sebastian Guerrero <chapeti at gmail.com> > wrote: > >> > > >> > Hi Christian!, thanks for your reply :-) > >> > > >> > I've just downloaded the latest snapshot [1] and executed the query > [2], and yes: the problem is still there. > >> > > >> > Cheers, > >> > Sebastian. > >> > > >> > [1] https://imgur.com/ahgMg7p > >> > [2] https://imgur.com/tDCAtCu > >> > > >> > On Mon, May 11, 2020 at 3:58 PM Christian Grün < > christian.gruen at gmail.com> wrote: > >> >>> > >> >>> Maybe it's a newbie issue, but I would like your comments. > >> >> > >> >> > >> >> …definitely something you shouldn't encounter as a newbie either ;) > Thanks for reporting it. > >> >> > >> >> Does the exception also occur with the latest snapshot [1]? > >> >> > >> >> Cheers > >> >> Christian > >> >> > >> >> [1] http://files.basex.org/releases/latest/ > >> >> > >> >> > >> >> > >> >> > >> >>> > >> >>> I'm writing a RESTXQ method to search among a couple of databases. > ( >100 databases ) > >> >>> > >> >>> Some databases are split into a couple of parts due to the number > of nodes. For example US: it's separated into US00, US01 and US02. > >> >>> > >> >>> So, my problem is: > >> >>> > >> >>> if I replace "for $usPart in ('US00')" by "for $usPart in > ('US00','US01',''US02)" in QUERY [A], I get this error: > >> >>> > >> >>> Improper use? Potential bug? Your feedback is welcome: > >> >>> Contact: basex-talk at mailman.uni-konstanz.de > >> >>> Version: BaseX 9.3.2 > >> >>> Java: Oracle Corporation, 1.8.0_251 > >> >>> OS: Windows 10, amd64 > >> >>> Stack Trace: > >> >>> java.lang.NullPointerException > >> >>> at org.basex.query.expr.path.Path.index(Path.java:673) > >> >>> at org.basex.query.expr.path.Path.optimize(Path.java:157) > >> >>> at org.basex.query.expr.gflwor.For.toPredicate(For.java:220) > >> >>> at org.basex.query.expr.gflwor.GFLWOR.optimizeWhere(GFLWOR.java:532) > >> >>> at org.basex.query.expr.gflwor.GFLWOR.optimize(GFLWOR.java:109) > >> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:100) > >> >>> at org.basex.query.expr.Extension.compile(Extension.java:45) > >> >>> at org.basex.query.expr.SwitchGroup.compile(SwitchGroup.java:40) > >> >>> at org.basex.query.expr.Switch.compile(Switch.java:60) > >> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:96) > >> >>> at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43) > >> >>> at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:90) > >> >>> at org.basex.query.scope.MainModule.comp(MainModule.java:81) > >> >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:114) > >> >>> at org.basex.query.QueryCompiler.compile(QueryCompiler.java:105) > >> >>> at org.basex.query.QueryContext.compile(QueryContext.java:312) > >> >>> at org.basex.query.QueryProcessor.compile(QueryProcessor.java:79) > >> >>> > >> >>> > >> >>> Using "for $usPart in ('US00')" it works without any problem. With > one element there is no problem, with two or more it fails. > >> >>> > >> >>> Any ideas about what I'm doing wrong? > >> >>> > >> >>> Here is the > >> >>> QUERY [A] > >> >>> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > >> >>> declare namespace gb="http://www.ipo.gov.uk/schemas/tm"; > >> >>> > >> >>> let $text:="christian" > >> >>> let $registries:=('GB','US') > >> >>> > >> >>> let $results := > >> >>> for $registry in $registries > >> >>> return > >> >>> switch ($registry) > >> >>> > >> >>> case "US" > >> >>> return > >> >>> (# db:enforceindex #) { > >> >>> for $usPart in ('US00') > >> >>> for $tmUS in > db:open($usPart)/trademark-applications-daily/application-information/file-segments/action-keys/case-file > >> >>> where > $tmUS/case-file-header/mark-identification/text() contains text {$text} > using stemming > >> >>> return > <trademark><ipo>US</ipo><text>{$tmUS/case-file-header/mark-identification/text()}</text></trademark> > >> >>> } > >> >>> > >> >>> case "GB" > >> >>> return > >> >>> (# db:enforceindex #) { > >> >>> for $tmGB in > db:open('GB')/gb:MarkLicenceeExportList/gb:TradeMark > >> >>> where > $tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text() contains > text {$text} > >> >>> return > <trademark><ipo>GB</ipo><text>{$tmGB/gb:WordMarkSpecification/gb:MarkVerbalElementText/text()}</text></trademark> > >> >>> } > >> >>> > >> >>> default return "" > >> >>> > >> >>> return > >> >>> <result> > >> >>> <total>{count($results)}</total> > >> >>> <trademarks> > >> >>> { > >> >>> for $result in $results > >> >>> return $result > >> >>> } > >> >>> </trademarks> > >> >>> </result> > >> >>> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > >> >>> > >> >>> Regards, > >> >>> Sebastian >
Written for BaseX 9.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery