[basex-talk] Shouldn't CHOP = false make xml:space="preserve" the default behavior?

2017-08-06 Thread Ottid Mes
(Sorry for the noise, but because my previous mail was shown under trimmed
content in my Sent Mail, I will resend it without format just in case it
was not shown properly to others as well)

>From the documentation about the CHOP option I assumed that since
xml:space="preserve" sets CHOP = false for that part of the document, that
if I set CHOP = false in my configuration file, that the behavior you get
when you use xml:space="preserve" would be applied to the whole database (I
created the database after setting the option). However the only way I have
ever been able to get this behavior, has been to set xml:space="preserve"
at the root element. Am I missing something, or is this a bug? How could I
get this behavior by default in my databases?

I thought this would not warrent a thorough example given the clear
conditions which cause the above situation, but I was asked for it anyway,
so here it goes:

A little bit of context, although it should not matter, I have had this
issue for years (at least 4) under Arch Linux. At the time I just assumed I
did something wrong and went with xml:space="preserve" workaround
everywhere.

> uname -a
Linux phoenix 4.9.38 #1-NixOS SMP Sat Jul 15 10:17:55 UTC 2017 x86_64
GNU/Linux

The default situation:

No config file (.basex)

> basex
BaseX 8.6.4 [Standalone]

> create db chop-test
Database 'chop-test' created in 123.01 ms.

> open chop-test
Database 'chop-test' was opened in 1.19 ms.

> replace /a foo bar
0 resource(s) replaced in 103.68 ms.

> xquery /root

  
foo
  bar
Query executed in 106.05 ms.

I never use the REPL other than to create and drop databases, so I was a
bit suprised that this did not work:
> replace /a foo bar
"a.xml" (Line 1): Open quote is expected for attribute "xml:space"
associated with an  element type  "root".

While this does:
> replace /a foo bar
1 resource(s) replaced in 4.06 ms.

> xquery /root
foo bar
Query executed in 0.95 ms.

> quit
Have fun.

The resource with xml:space="preserve" is the behavior I want to have
within my database, because all my documents are mixed content.

On the wiki (http://docs.basex.org/wiki/Options#CHOP) this is also
mentioned:

It explicitly states that in my use case I should set CHOP to false:
"The flag should be turned off if a document contains mixed content."

It also states that setting the xml:space="preserve" attribute is the same
as having CHOP = false:
"If the xml:space="preserve" attribute is attached to an element, chopping
will be turned off for all descendant text nodes."

So lets do that:

Let us first confirm that the config file is correctly read:
> echo 'FOO = 0' > /some/path/.basex
> BASEX_JVM='-Dorg.basex.path=/some/path' basex
/some/path/.basex: Unknown option 'FOO'.
/some/path/.basex: writing new configuration file.

Now we set the option CHOP = false in our config:
> echo 'CHOP = false' >> /some/path/.basex

So lets see what this changes in the basex REPL:

> BASEX_JVM='-Dorg.basex.path=/some/path' basex
BaseX 8.6.4 [Standalone]

> drop db chop-test
Database 'chop-test' was dropped.

> create db chop-test
Database 'chop-test' created in 106.42 ms.

> open chop-test
Database 'chop-test' was opened in 0.05 ms.

> replace /a foo bar
0 resource(s) replaced in 39.24 ms.

> xquery /root

  
foo
   bar
Query executed in 97.09 ms.

> quit
Have fun.

This is not what I expect, it should have been:
> xquery /root
foo bar

And hence my question: Shouldn't CHOP = false make xml:space="preserve" the
default behavior?

I even tried this:

> BASEX_JVM='-Dorg.basex.path=/some/path' basex
BaseX 8.6.4 [Standalone]
Try 'help' to get more information.
> open chop-test
Database 'chop-test' was opened in 90.65 ms.
> set chop off
CHOP: false
> replace /a foo bar
1 resource(s) replaced in 45.58 ms.
> xquery /root

  
foo
   bar
Query executed in 96.78 ms.
> quit
See you.

Am I making some mistake in the above?
Is the wiki simply outdated and should this be configured differently?
Is having having mixed content in basex so rare that this bug has gone
unnoticed for years?


Re: [basex-talk] GUI

2017-08-06 Thread Thomas Daly
Many thanks, this makes sense.

Thomas

-Original Message-
From: Liam R. E. Quin [mailto:l...@w3.org] 
Sent: 05 August 2017 21:06
To: Thomas Daly; basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] GUI

On Sat, 2017-08-05 at 16:52 +0100, Thomas Daly wrote:
>  
> 
> a)  It is not possible to log into a BaseX database running on a 
> remote server from a GUI running on a different machine?

You can probably also do it the other way round, setting DISPLAY and running 
BaseX on the server system with its display pointing to your system, e.g, using 
an ssh tunnel so you don't need to expose your system to the raw Internet. See 
e.g. https://askubuntu.com/questions/20
3173/run-application-on-local-machine-and-show-gui-on-remote-display
for using ssh -X or -Y to the server. You have to arrange for your X server to 
listen for remote connections I think.


> b)  Do I need any particular Linux distribution / GUI version to 
> run the BaseX Linux GUI?

No. I use Mageia Linux under Gnome 3, but as Christian said, you just need Java.

Liam

--
Liam Quin, W3C, http://www.w3.org/People/Quin/ Staff contact for Verifiable 
Claims WG, XQuery WG

Web slave for http://www.fromoldbooks.org/



[basex-talk] Web application port

2017-08-06 Thread Thomas Daly
Regarding http://docs.basex.org/wiki/Options#HTTP_Services , I see there's
an option STOPPORT to change the server stop port.

 

I think it should be possible to configure the server listen port (default
8984) there as well.

 

I realise it's possible to do this through command line options, but it
would be nice to be able to do it in the .basex file too.

 

Thanks,

Thomas

 



[basex-talk] jobs:result deadlock

2017-08-06 Thread Kendall Shaw
Can someone elaborate on this sentence in the documentation about jobs:result:

“Please note that this query can easily cause a deadlock if the asynchronously 
executed query will be queued. “

Referring to this example:

let $query := jobs:eval('(1 to 1000)[. = 1]', map{}, map{ 'cache': true() })
return (
  jobs:wait($query),
  jobs:result($query)
)

And this about jobs:wait

“If the function is called with the id of a queued job, or repeatedly executed 
job, it may stall and never terminate.”

Can jobs:eval above be queued before jobs:wait is evaluated within the let 
expression?

Kendall