Re: [basex-talk] java.lang.NullPointerException at org.basex.query.expr.TypeswitchGroup.equals(TypeswitchGroup.java:173)

2019-04-18 Thread Christian Grün
Seems this was a bug fix day ;) Thanks for reporting this, the issue
has been resolved with the new snapshot. Once again it was an
optimization that triggered the bug (the one that eliminates identical
typeswitch cases).



On Thu, Apr 18, 2019 at 11:22 PM Andreas Mixich
 wrote:
>
> Hi,
>
> I found the position, where it goes bonkers:
>
> In the code I have posted, find the function 'local:content#4' and there
> find the 'switch' statement. Replace the beginning of it, up to the
> second 'case' expression, with this:
>
> ,switch ($t)
>case "html" return (
>  attribute type { "html" }
> ,local:atomPlainTextConstruct($content,true())
>)
>
> and the function executes up to the 'error()' halt (which is just some
> useless stuff I did during development, as this code is not yet complete).
>
> --
> Goody Bye, Minden jót, Mit freundlichen Grüßen,
> Andreas Mixich
>


Re: [basex-talk] java.lang.NullPointerException at org.basex.query.expr.TypeswitchGroup.equals(TypeswitchGroup.java:173)

2019-04-18 Thread Andreas Mixich
Hi,

I found the position, where it goes bonkers:

In the code I have posted, find the function 'local:content#4' and there
find the 'switch' statement. Replace the beginning of it, up to the
second 'case' expression, with this:

    ,switch ($t)
   case "html" return (
     attribute type { "html" }
        ,local:atomPlainTextConstruct($content,true())
       )

and the function executes up to the 'error()' halt (which is just some
useless stuff I did during development, as this code is not yet complete).

-- 
Goody Bye, Minden jót, Mit freundlichen Grüßen,
Andreas Mixich



Re: [basex-talk] my first baseX db

2019-04-18 Thread Michael Seiferle
Hi Robert,
are you sure your XML file is valid?
Does it work if you move that particular file out of your google drive 
temporarily?

Best
Michael

Von meinem iPhone gesendet

> Am 18.04.2019 um 21:36 schrieb Robert Kirkpatrick :
> 
> Hello,
> 
> Novice, newbie request: GUI snapshot:
> 
> Command:
> CREATE DB science C:/Users/rober/Google Drive/science/
> Error:
> "Configurations2/accelerator/current.xml" (Line 1): Premature end of file.
> 
> TIA,
> Robert.


[basex-talk] java.lang.NullPointerException at org.basex.query.expr.TypeswitchGroup.equals(TypeswitchGroup.java:173)

2019-04-18 Thread Andreas Mixich
Hello,

I don't really understand what just happened, so I attached the testcase
and stacktrace to circumvent any malformation by the mail software in use.

-- 
Goody Bye, Minden jót, Mit freundlichen Grüßen,
Andreas Mixich



work.xq
Description: application/xquery
Error:
Improper use? Potential bug? Your feedback is welcome:
Contact: basex-talk@mailman.uni-konstanz.de
Version: BaseX 9.2
Java: Oracle Corporation, 9.0.1
OS: Windows 10, amd64
Stack Trace: 
java.lang.NullPointerException
at org.basex.query.expr.TypeswitchGroup.equals(TypeswitchGroup.java:173)
at java.base/java.util.Objects.equals(Unknown Source)
at org.basex.util.Array.equals(Array.java:332)
at org.basex.query.expr.Typeswitch.equals(Typeswitch.java:180)
at org.basex.query.expr.gflwor.ForLet.equals(ForLet.java:87)
at org.basex.query.expr.gflwor.Let.equals(Let.java:125)
at java.base/java.util.AbstractList.equals(Unknown Source)
at org.basex.query.expr.gflwor.GFLWOR.equals(GFLWOR.java:917)
at org.basex.query.expr.Single.equals(Single.java:86)
at org.basex.query.expr.TypeCheck.equals(TypeCheck.java:158)
at org.basex.query.expr.Switch.opt(Switch.java:124)
at org.basex.query.expr.Switch.optimize(Switch.java:65)
at org.basex.query.expr.Switch.compile(Switch.java:59)
at org.basex.query.expr.List.compile(List.java:42)
at org.basex.query.expr.Arr.compile(Arr.java:42)
at org.basex.query.expr.constr.CName.compile(CName.java:52)
at org.basex.query.expr.constr.CElem.compile(CElem.java:48)
at org.basex.query.expr.gflwor.GFLWOR.compile(GFLWOR.java:94)
at org.basex.query.func.StaticFunc.comp(StaticFunc.java:69)
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 map: map { "method": "xml" }
- remove type check: xs:string? -> serialize($input_16, map { "method": "xm...
- remove type check: declare function local:is-escaped-markup...
- inline local:is-escaped-markup#1
- inline $string_28 as xs:string
- simplify FLWOR expression: matches(((: xs:string, true :) $input_17...
- rewrite > comparison to range comparison: 
(html:parse($text_9)/*:html/*:body/node(...
- pre-evaluate fn:count(items) to xs:integer item: 
count((html:parse($text_9)/*:html/*:body... -> 1
- rewrite if to fn:error([code[,desc[,object]]]): if(1) then error() else 
serialize($text_... -> error()
- rewrite > comparison to range comparison: (parse-xml($text_9)/node() > 2) -> 
(parse-xml($text_9)/node() >= 2....
- pre-evaluate fn:count(items) to xs:integer item: 
count((parse-xml($text_9)/node() >= 2.00... -> 1
- rewrite if to fn:error([code[,desc[,object]]]): if(1) then error() else 
$text_9 -> error()
- rewrite > comparison to integer range comparison: 
(count($text_9/node()/ancestor-or-self::...
- inline local:escape#1
- inline $input_29
- simplify FLWOR expression: serialize($text_9, map { "method": "xml"...
- remove type check: item()* -> ($atomCommonAttributes_13, attribute typ...
- inline local:test-for-markup#1
- inline $input_30
- simplify FLWOR expression: typeswitch($content_2) case element()* r...
- swap operands: if(not($type_3)) then typeswitch($conten...
- pre-evaluate closure to function item: function($suffix_7, $ns_8) as item()* 
{ ... -> function($suffix_7, $ns_8) as namespace-...
- inline function($suffix_7, $ns_8) as namespace-...
- inline $suffix_40
- inline $ns_41
- simplify FLWOR expression: namespace { $suffix_39 } { ($ns_38) }
- pre-evaluate fn:true() to xs:boolean item: true()
- inline local:atomPlainTextConstruct#2
- remove type check: $html_43 as xs:boolean?
- inline $text_42
- inline $html_43
- simplify FLWOR expression: ((: text(), true :) let $txt_44 := types...
- pre-evaluate fn:false() to xs:boolean item: false()
- inline local:atomPlainTextConstruct#2
- remove type check: $html_46 as xs:boolean?
- inline $text_45
- inline $html_46
- simplify FLWOR expression: ((: text(), true :) let $txt_47 := types...
- inline local:atomXHTMLTextConstruct#2
- remove type check: $atomCommonAttributes_49 as attribute()*
- inline $text_48
- inline $atomCommonAttributes_49
- remove () from expression list
- simplify FLWOR expression: (attribute type { ("xhtml") }, element d...
- inline local:atomXHTMLTextConstruct#2
- remove type check: $atomCommonAttributes_51 as attribute()

Re: [basex-talk] my first baseX db

2019-04-18 Thread Robert Kirkpatrick
PS: BaseX 9.2 on Windows10

On Thu, Apr 18, 2019 at 9:36 PM Robert Kirkpatrick 
wrote:

> Hello,
>
> Novice, newbie request: GUI snapshot:
>
> Command:
> CREATE DB science C:/Users/rober/Google Drive/science/
> Error:
> "Configurations2/accelerator/current.xml" (Line 1): Premature end of file.
>
> TIA,
> Robert.
>


[basex-talk] my first baseX db

2019-04-18 Thread Robert Kirkpatrick
Hello,

Novice, newbie request: GUI snapshot:

Command:
CREATE DB science C:/Users/rober/Google Drive/science/
Error:
"Configurations2/accelerator/current.xml" (Line 1): Premature end of file.

TIA,
Robert.


Re: [basex-talk] BaseX/GUI v9.1.2 memory use

2019-04-18 Thread Christian Grün
Hi all,

I have revised the cache management of the project view in the latest
9.2.1 snapshot:

• The maximum number of cached file paths is now limited to 50,000.
• If a symbolic link is found in the directory structure, it will only
be traversed once.

Cheers,
Christian



On Wed, Jan 23, 2019 at 3:56 PM Bridger Dyson-Smith
 wrote:
>
> Mea culpa! I may have steered the train of conversation in a non-productive 
> direction: my home is parsed due to how I launch the GUI. In any event, I 
> haven't had any issues with parsing project files or symbolic links, either.
>
> Apologies,
> Bridger
>
> On Wed, Jan 23, 2019 at 8:30 AM Johannes Echterhoff 
>  wrote:
>>
>> For what it’s worth: in our developments we had a directory as part of the 
>> project files where we stored all queries that were executed during 
>> development and testing (these queries were dynamically created by other 
>> queries). Saving these queries is just part of our process. However, after a 
>> while that resulted in hundreds to thousands of query files. That resulted 
>> in a massive memory demand, and we noticed increased CPU usage, both of 
>> which we could not explain at first. Eventually we found out that the BaseX 
>> GUI automatically parsed all these queries, each time initializing a custom 
>> module we wrote, where the initialization of that module created a temporary 
>> directory with a number of files. The solution for us was to simply move the 
>> directory where we save the executed queries somewhere outside of the 
>> project files opened in the BaseX GUI.
>>
>>
>>
>> Best regards,
>>
>> Johannes
>>
>>
>>
>>
>>
>> Von: BaseX-Talk [mailto:basex-talk-boun...@mailman.uni-konstanz.de] Im 
>> Auftrag von Graydon Saunders
>> Gesendet: Mittwoch, 23. Januar 2019 14:19
>> An: Christian Grün 
>> Cc: BaseX 
>> Betreff: Re: [basex-talk] BaseX/GUI v9.1.2 memory use
>>
>>
>>
>> Never had a problem with the GUI parsing project files.  No issues with 
>> symbolic links.
>>
>>
>>
>> I have generally found basex very reliable but never try to update the 
>> installed version; it's always move the old, unpack the new.
>>
>> On Wed, Jan 23, 2019, 08:09 Christian Grün  wrote:
>>
>> Thanks for your assessments. So maybe we should ensure that every file and 
>> directory will only be parsed once.
>>
>>
>>
>> Did anyone of you have problems with the automatic parsing of project files 
>> in the BaseX GUI, or with symbolic links in particular?
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Am Mi., 23. Jan. 2019, 09:12 hat Marco Lettere  
>> geschrieben:
>>
>> Same for us over here. The ability to follow symlinks is a very powerful 
>> feature that we use to externalize folders (data, restxq for instance). So 
>> please don't remove it altogether!
>>
>> M.
>>
>>
>>
>> On 22/01/19 23:50, Graydon Saunders wrote:
>>
>> I've been handling updates by making data/ a symbolic link to a data 
>> directory that's a sibling of the basex directory.  (Move the old, unpack 
>> the new, go into new and replace data/ with a symbolic link up and over.)
>>
>>
>>
>> Would hate to see that stop working.
>>
>> On Tue, Jan 22, 2019, 17:36 Christian Grün  wrote:
>>
>> Good to hear that! I can’t recollect that something particular has changed 
>> in version 9.1.2, regarding the scanning of project files, but I’ll have 
>> some thoughts how we can trace and interrupt such loops (or ignore symbolic 
>> links instead).
>>
>>
>>
>>
>>
>> Am Di., 22. Jan. 2019, 23:22 hat Bridger Dyson-Smith  
>> geschrieben:
>>
>> Glad that helped :)
>>
>>
>>
>> I see this when I start from a fresh install vs expanding the ZIP into the 
>> same directory.
>>
>>
>>
>> On Tue, Jan 22, 2019, 5:17 PM Rick Graham >
>> Thanks Bridger!
>>
>>
>>
>> Indeed, I quit basexgui and manually edited .basexgui to set the project 
>> directory to a newly created empty directory.  basexgui seems normal/stable 
>> after that.
>>
>>
>>
>> I rarely, as in almost never, use wine but I didn't have this issue with 
>> previous versions of BaseX.  Something seems unexpected here.
>>
>>
>>
>>
>>
>> On Tue, Jan 22, 2019 at 11:04 PM Bridger Dyson-Smith  
>> wrote:
>>
>> Hi Rick, et al,
>>
>> I think (but am not 100% sure) that the GUI defaults to looking through your 
>> home directory on startup. So, somewhere in `~/rick/.wine/dosdevices/...` 
>> you have symbolic links that are looped.
>>
>>
>>
>> I think you might be able to circumvent this problem by finding `.basexgui` 
>> - it would probably be close to wherever you started the GUI from on your 
>> filesystem. I think you can edit some of the PATHS there and that may help?
>>
>>
>>
>> Again, I'm not sure. HTH!
>>
>> Best,
>>
>> Bridger
>>
>>
>>
>> On Tue, Jan 22, 2019 at 4:56 PM Rick Graham  wrote:
>>
>> The command-line seemed to be operating normally.
>>
>>
>>
>> What exactly is/are my project directories?
>>
>>
>>
>> I attached to the running GUI instance `strace -f -e trace=stat -p 13368` 
>> and it has infinite repetitions of:
>>
>>
>>
>> [pid 13436] 
>> stat("/home/

Re: [basex-talk] name condition in predicates

2019-04-18 Thread Christian Grün
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 {$hit}

Best,
Christian

[1] http://files.basex.org/releases/latest/
[2] 
https://github.com/BaseXdb/basex/commit/7fa89c521a9a659610ac45423d4b14de026034df




On Thu, Apr 18, 2019 at 5:21 PM Alexander Witzigmann
 wrote:
>
> the following query
>
> for $hit in //*[./name() ="p"]
>
> return
> {$hit}
>
> 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 {$hit}
>
> might be some side effect from latest improvements?
>
> Alex
>


[basex-talk] name condition in predicates

2019-04-18 Thread Alexander Witzigmann

the following query


for $hit in //*[./name() ="p"]

return
{$hit}

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 {$hit}

might be some side effect from latest improvements?

Alex