Dear Alex, Thanks for the stack trace. The bug (which was introduced by a new path rewriting) has just been fixed, and a snapshot is available [1,2]. If you don’t want to wait for BaseX 9.2.1, you can proceed with a slightly modified version of your query: for $hit in //*[name() ="p"] return <out >{$hit}</out> Best, Christian [1] http://files.basex.org/releases/latest/ [2] https://github.com/BaseXdb/basex/commit/7fa89c521a9a659610ac45423d4b14de0260... On Thu, Apr 18, 2019 at 5:21 PM Alexander Witzigmann <alexander.witzigmann@tanner.de> wrote:
the following query
for $hit in //*[./name() ="p"]
return <out >{$hit}</out>
leads to
Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 9.2 Java: Oracle Corporation, 10 OS: Windows 7, amd64 Stack Trace: java.lang.NullPointerException at org.basex.query.expr.SimpleMap.get(SimpleMap.java:43) at org.basex.query.expr.path.Path.optimize(Path.java:202) at org.basex.query.expr.path.Path.compile(Path.java:153) at org.basex.query.expr.Arr.compile(Arr.java:42) at org.basex.query.expr.Preds.compile(Preds.java:46) at org.basex.query.expr.path.Step.compile(Step.java:95) at org.basex.query.expr.path.Path.compile(Path.java:142) at org.basex.query.expr.gflwor.ForLet.compile(ForLet.java:43) at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:88) 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) at org.basex.core.cmd.AQuery.query(AQuery.java:93) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.gui.GUI.exec(GUI.java:422) at org.basex.gui.GUI.lambda$execute$4(GUI.java:365) at java.base/java.lang.Thread.run(Unknown Source) Compiling: - pre-evaluate root to document-node() sequence: root() -> (db:open-pre("publication-toc", 0), ...) Optimized Query: for $hit_0 in (db:open-pre("publication-toc", 0), ...)/descendant-or-self::node()/*[(name() = "p")] return element out { ($hit_0) } Query: for $hit in //*[./name() ="p"] return <out >{$hit}</out>
might be some side effect from latest improvements?
Alex