[basex-talk] BaseX schema aware

2017-02-23 Thread Leo Studer
Hello

I am wondering whether there are plans to make BaseX schema aware?

Thanks for considering

Always
Leo



Re: [basex-talk] value compare in namespace

2017-08-18 Thread Leo Studer
Hello Radim

Your WHERE clause is either true or false depending whether “Failed” is in 
$FailedTests sequence or not. 
With ‘=‘ you compare sequences and not values. If one item matches it is true.

let $FailedTests:=…
return count($FailedTests[. eq ‘Failed’])

Cheers
Leo

> On 18 Aug 2017, at 10:49, radim-havli...@post.cz wrote:
> 
> Hello,
> I want to count failed reports in DB, it means where outcome value of report 
> is "Failed".
> 
> declare namespace TestResults='urn:IEEE-1671:2009.04:TestResults';
> declare namespace Common='urn:IEEE-1671:2010:Common';
> 
> let $DocumentNames := (db:list("ASC", "Report"))
> for $DocumentName in $DocumentNames
> let $Document := db:open('ASC',$DocumentName)
> 
> let $FailedTests := 
> $Document/TestResults:TestResults/TestResults:ResultSet/TestResults:TestGroup/TestResults:TestGroup/TestResults:TestGroup/TestResults:TestGroup/TestResults:Test/TestResults:Outcome/data(@value)
> where $FailedTests="Failed"
> return count($FailedTests)
> 
> However, it counts all reports, no matter if the value is "Passed" or 
> "Failed". If I change the end to: return $FailedTests, it displays both 
> "Failed" and "Passed" values. If I change it to: where $FailedTests="Test", 
> it displays correctly 0 reports. What am I doing wrong?
> 
> Thank you in advance for your reply.
> 
> Radim Havlicek



Re: [basex-talk] -math:log10(1)

2018-05-27 Thread Leo Studer
Giuseppe

this is the floating point representation IEEE 754 that allows -0 and 0 both 
being the same. 

Yours 
Leo



> On 26 May 2018, at 17:01, Giuseppe Celano  
> wrote:
> 
> -  math:log10(1) returns -0 but -0 returns 0: is there a reason for that?
> 
> Thanks!
> Giuseppe
> 



[basex-talk] BaseX not running

2018-02-21 Thread Leo Studer
Hello

I try desperately getting baseX 8.6.7 to run on MacOS X 10.13.3 where I have 
Java 9 installed
Here the error message:

BaseX installed with homebrew today:

MBP-2015:~ leo$ basexgui
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.basex.gui.GUIMacOSX 
(file:/usr/local/Cellar/basex/8.6.7/libexec/BaseX.jar) to method 
com.apple.eawt.Application.getApplication()
WARNING: Please consider reporting this to the maintainers of 
org.basex.gui.GUIMacOSX
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Failed to initialize native Mac OS X interface
MBP-2015:~ leo$ 

and the same error with the Jar file

Last login: Wed Feb 21 18:16:27 on ttys001
MBP-2015:~ leo$ java -jar ~/Downloads/BaseX867.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.basex.gui.GUIMacOSX 
(file:/Users/leo/Downloads/BaseX867.jar) to method 
com.apple.eawt.Application.getApplication()
WARNING: Please consider reporting this to the maintainers of 
org.basex.gui.GUIMacOSX
WARNING: Use --illegal-access=warn to enable warnings of further illegal 
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Failed to initialize native Mac OS X interface
MBP-2015:~ leo$ 

Any suggestions?

Thanks for caring
Always
Leo






Re: [basex-talk] BaseX 9.0: The Spring Edition!

2018-03-24 Thread Leo Studer
Congratulations, I am looking forward to dave into it ;-)
Thanks for the ongoing good work
Yours
Leo

> On 23 Mar 2018, at 21:32, Christian Grün  wrote:
> 
> Dear BaseX aficionados,
> 
> We are very happy to announce the release of BaseX 9.0!
> 
> The new version of our XML database system and XQuery 3.1 processor
> includes some great new features and a vast number of minor
> improvements and optimizations. It’s both the usage of BaseX in
> productive environments as well as the valuable feedback of our open
> source users that make BaseX better and better, and that allow and
> motivate us to keep going. Thanks to all of you!
> 
> Along with the new release, we invite you to visit our relaunched
> homepage: http://basex.org/.
> 
> Java 8 is now required to run BaseX. The most prominent features of
> Version 9.0 are:
> 
> XQUERY
> - Comprehensive extensions in the internal XQuery optimizer framework
> - Dynamic hash joins rewritings of general comparisons
> - Register query jobs as persistent services
> - Process very large CSV files via the new CSV 'xquery' format
> - Update Module: higher-order functions for performing updates
> - Unified static typing, including maps, arrays and function items
> - COPYNODE: Lightweight copying of XML fragments
> - ENFORCEINDEX: Enforce rewriting for index access
> 
> STORAGE
> - Improved database compression (short strings, whitespaces)
> 
> WEB APPLICATIONS
> - Permissions layer: Unified definition of RESTXQ access patterns
> - RESTXQ: Full support for client- and server-side quality factors
> - REST: Run BaseX command scripts
> - Web server upgrade to Jetty 9
> 
> REPOSITORIES
> - Combined packaging mechanism (XQuery and Java)
> - Java Packaging: Bundling of additional libraries
> 
> DISTRIBUTIONS
> - Revised detection and configuration of BaseX home directory
> - Windows executable: better detection of Java libraries
> 
> DBA: BASEX DATABASE ADMINISTRATION
> - Improved editing and evaluation of XQuery modules
> - Revised file, session and job management
> 
> More details can be found on our homepage. We are looking forward to
> your feedback.
> 
> Enjoy and have fun,
> Christian, BaseX Team



[basex-talk] eq vs =

2018-12-13 Thread Leo Studer
Hello

Could someone explain me why this woks

//country[@population = max(//@population)]/name

Whereas this does not

//country[@population eq max(//@population)]/name


Thanks in advance
Leo

Re: [basex-talk] eq vs =

2018-12-13 Thread Leo Studer
Thank you Christian and Wray

The implicit cast is the problem (as usual). I was expecting it to happen 
equally :(

And I teach my students to use value comparisons when ever possible and to care 
about the cast yourself ;-)

Yours
Leo

> On 13 Dec 2018, at 10:46, Christian Grün  wrote:
> 
> Hi Leo,
> 
> The semantics of value comparisons (eq, ne, …) and general comparisons
> (=, !=, …) are different. As E. Wray indicated, sequences with more
> than one item can be compared with general comparisons; the result
> will always be a boolean (value comparisons will return an empty
> sequence if at least one value is an empty sequence).
> 
> In addition, values of document nodes (in your case, @population) will
> be cast to the type of the other value (in your case, a double,
> resulting from fn:max). This implicit cast doesn’t take place if you
> use value comparisons, you’ll have to do this explicitly:
> 
> Does not work:
>  [@a eq 1]
> Works:
>  [number(@a) eq 1]
> 
> This is why your second query yields an error. See Sections 3.7.1 and
> 3.7.2 of the XQuery spec for all the comprehensive details [1].
> 
> In practice, I would recommend you to always use the general
> comparison operator in BaseX, as it provides more optimizations. In
> many cases, if it’s safe, value comparisons will automatically be
> rewritten to general comparisons by the compiler.
> 
> Best,
> Christian
> 
> [1] https://www.w3.org/TR/xquery-31/#id-value-comparisons
> 
> 
> 
> On Thu, Dec 13, 2018 at 10:17 AM Leo Studer  wrote:
>> 
>> Hello
>> 
>> Could someone explain me why this woks
>> 
>> //country[@population = max(//@population)]/name
>> 
>> Whereas this does not
>> 
>> //country[@population eq max(//@population)]/name
>> 
>> 
>> Thanks in advance
>> Leo



Re: [basex-talk] recursively used variables

2020-10-20 Thread Leo Studer
I think you have to pass the variable to your function 

declare variable $local:test := local:test#2 ;
declare %private function local:test( $i, $test) { if ( $i > 0)  then ($i, 
$test( $i - 1, $test)) else() } ;

local:test( 10, $local:test)



> On 20 Oct 2020, at 10:31, Rob Stapper  wrote:
> 
> Hi Leo,
>  
> Thank you for your reply. 
> I’m aware of these kind of solutions, I use them frequently allthough I have 
> to admit that these slipped my mind here. Great solutions by the way.
>  
> But getting the code working is not my problem. What I’m looking for is a 
> generic solution for some sort of inheritance mechanism( see attachment for  
> an example). The code-snippet is just meant to supply the BaseX-team with an 
> basic executable example of the bare issue. I’m not even sure if it is a bug 
> because I don’t know if it is behavior by design. But now the BaseX-team is 
> aware of the situation.
>  
> Probably I should have said that the functions can be activated cyclically in 
> stead of just recursively. Where cyclical can be interpret as indirect 
> recursive. And in that case the solution doesn’t hold.
>  
> Best,
> Rob
>  
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>  
> From: Leo Studer <mailto:leo.stu...@varioweb.ch>
> Sent: Monday, October 19, 2020 7:19 PM
> To: Rob Stapper <mailto:r.stap...@lijbrandt.nl>
> Subject: Re: [basex-talk] recursively used variables
>  
> … and you do not even need the variable
>  
> declare %private function local:test( $i, $test) { if ( $i > 0)  then ($i, 
> $test( $i - 1, $test)) else() } ;
> 
> local:test( 10, local:test#2)
>  
> Cheers
> Leo
>  
>  
> 
> 
> On 8 Oct 2020, at 14:17, Rob Stapper  <mailto:r.stap...@lijbrandt.nl>> wrote:
>  
> Hi,
>  
> The code[1] below and send as attachment generates a error message: “Static 
> variable depends on itself: $Q{http://www.w3.org/2005/xquery-local-functions 
> <http://www.w3.org/2005/xquery-local-functions>}test”.
> I use these variables to refer to my private functions in my modules so I can 
> easyly refer to them in a inheritance situation. 
> It’s not a big problem for me but I was wondering if the error-triggering is 
> justified or that it should work. 
>  
> [1]===
> declare variable $local:test := local:test#1 ;
> declare %private function local:test( $i) { if ( $i > 0)  then $local:test( 
> $i - 1) } ;
>  
> $local:test( 10)
> ===
>  
> Kind regards,
>  
> Rob Stapper
>  
>  
> Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>  
>  
>  
> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=emailclient_term=icon>
>   
> Virus-free. www.avast.com 
> <https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=emailclient_term=link>
> 
>  
>  
> 



Re: [basex-talk] recursively used variables

2020-10-19 Thread Leo Studer

… or a xPath function in a variable

declare %private variable $recursiveFunction:= function( $i, 
$recursiveFunction) { 
if ( $i > 0)  then ($i, $recursiveFunction( $i - 1, $recursiveFunction)) 
else() 
} ;

$recursiveFunction( 10, $recursiveFunction)






> On 8 Oct 2020, at 14:17, Rob Stapper  > wrote:
> 
> Hi,
>  
> The code[1] below and send as attachment generates a error message: “Static 
> variable depends on itself: $Q{http://www.w3.org/2005/xquery-local-functions 
> }test”.
> I use these variables to refer to my private functions in my modules so I can 
> easyly refer to them in a inheritance situation. 
> It’s not a big problem for me but I was wondering if the error-triggering is 
> justified or that it should work. 
>  
> [1]===
> declare variable $local:test := local:test#1 ;
> declare %private function local:test( $i) { if ( $i > 0)  then $local:test( 
> $i - 1) } ;
>  
> $local:test( 10)
> ===
>  
> Kind regards,
>  
> Rob Stapper
>  
>  
> Sent from Mail  for Windows 10
>  
> 
>  
> 
>   Virus-free. www.avast.com 
> 
>  



Re: [basex-talk] recursively used variables

2020-10-19 Thread Leo Studer

Hi all

Here how I call a function recursively


declare %private function local:test( $i, $recursiveFunction) { 
if ( $i > 0)  
then ($i, $recursiveFunction( $i - 1, $recursiveFunction)) 
else() 
} ;

local:test( 10, local:test#2)



Always
Leo




> On 8 Oct 2020, at 14:17, Rob Stapper  wrote:
> 
> Hi,
>  
> The code[1] below and send as attachment generates a error message: “Static 
> variable depends on itself: $Q{http://www.w3.org/2005/xquery-local-functions 
> }test”.
> I use these variables to refer to my private functions in my modules so I can 
> easyly refer to them in a inheritance situation. 
> It’s not a big problem for me but I was wondering if the error-triggering is 
> justified or that it should work. 
>  
> [1]===
> declare variable $local:test := local:test#1 ;
> declare %private function local:test( $i) { if ( $i > 0)  then $local:test( 
> $i - 1) } ;
>  
> $local:test( 10)
> ===
>  
> Kind regards,
>  
> Rob Stapper
>  
>  
> Sent from Mail  for Windows 10
>  
> 
>  
> 
>   Virus-free. www.avast.com 
> 
>  



[basex-talk] Random Numbers from Random.org

2020-06-03 Thread Leo Studer


Hello

I try to use random numbers from random.org. 

Here my xpath

let $urand := 
function(){doc("https://www.random.org/integers/?num=1min=0max=10col=1base=10format=htmlrnd=new;)//*:pre/number()
 div 10}

return
for $i in 1 to 10 return
$urand()

Which brings 10 time the same value, however, every run time a different one. 
What is wrong with this code?

Thanks in advance for your valuable input

Yours
Leo


[basex-talk] bizarre exceptions

2022-02-24 Thread Leo Studer
Hello

I installed BaseX with homebrew on my mac and call basexgui in the terminal. 
The GUI opens and all goes well. 
After quit I get the below exceptions in the terminal.
Anyone an idea what that is about?

Thanks for the good work of the BaseX team 

Cheers
Leo




java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape
java.lang.IllegalArgumentException: Bad escape


Re: [basex-talk] bizarre exceptions

2022-02-24 Thread Leo Studer
Hi Christian

Thanks for your answer. 
Same on my intel MacBook MacOS 12.2.1, openJDK 17.0.2, BaseX 9.6.4
The Exceptions are thrown during startup of the GUI.
The program behaves correctly as far as I can tell.

Best regards,
Leo



> On 24 Feb 2022, at 21:34, Christian Grün  wrote:
> 
> Hi Leo,
> 
> Which JDK version are you using?
> 
> Maybe you get more helpful error output with BaseX in debug mode (basexgui 
> -d).
> 
> Mac support with BaseX 10 will differ slightly from the status quo, as
> JDK 11 comes with improved support for Apple. Do you get the same
> error messages with our snapshot [1]?
> 
> Best,
> Christian
> 
> PS: Maybe there are other Mac users who have spotted these exceptions as well?
> 
> [1] https://files.basex.org/releases/latest-10/
> 
> 
> 
>> I installed BaseX with homebrew on my mac and call basexgui in the terminal.
>> The GUI opens and all goes well.
>> After quit I get the below exceptions in the terminal.
>> Anyone an idea what that is about?
>> 
>> Thanks for the good work of the BaseX team
>> 
>> Cheers
>> Leo
>> 
>> 
>> 
>> 
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape
>> java.lang.IllegalArgumentException: Bad escape


Re: [basex-talk] BaseX 9.7 • Ukraine Edition

2022-03-24 Thread Leo Studer
Dear Mohammed

Reading your message I feel a lot of pain and I am sorry that you feel some 
hurting people excluded with the idea of an Ukraine Edition. To me this feels 
like a beginning to include the humans suffering. I see it as a step to show up 
in these painful areas and I read it as finally we start to care about what is 
going on in the world. And yes, there have not yet been other Editions showing 
sympathy with the humans suffering all over the world. Not even knowing you, I 
feel deep sympathy for you.

Warmly caring
Leo




On Thu, Mar 24, 2022 at 9:41 AM reda chbihi  wrote:
> 
> Hi everybody,
> 
> 
> I hope you're doing well,
> 
> I think that creating an Ukrainian edition will not stoping putin
> 
> 
> I don't know why you never thought about creating a palastinian, irakian, 
> syrian or afghan editions??? These people suffer since years or decades... 
> Creating Ukrainian edition is just hypocrisy!!!
> 
> 
> What i'm saying doesn't mean that i am agree with putin's war against 
> Ukrainian people. But we're all human and nobody deserves what's going on 
> Ukraine, palastine or Afghanistan.
> 
> 
> Regards
> Mohammed Reda CHBIHI



Re: [basex-talk] Scope of a xPath variable

2022-12-20 Thread Leo Studer
Hans-Juergen, thanks for this insight, that sheds even more light for me into 
the grouping with xquery...

> On 20 Dec 2022, at 08:42, Hans-Juergen Rennau  wrote:
> 
> Thank you for your kind words, Gerrit! Until a few weeks ago, my use of 
> grouping was a groping one also in my case - until I learned from the spec 
> that the FLWOR mechanics are only fully understood if we regard the clauses 
> as a pipeline of stations, each one transforming an input tuple stream into 
> an output tuple stream - that's the key. And that's at first weird, as we are 
> used to think in terms of "assignments", "loops", sorting, grouping, 
> filtering, counting devices. But when thinking of the different clauses as 
> just variants of a single idea - "tuple stream transformer" - everything is 
> decomposed into tiny bits - the details of how a particular kind of clause 
> maps its input tuples to output tuples. No interaction whatsoever between the 
> clauses, apart from output tuple streams becoming input tuple streams. 
> Suddenly it is not amazing any more that you can have any number of any kind 
> of clauses, e.g. several where clauses, and that the clauses can occur at any 
> position within the expression (except for the constraint that the first 
> clause must be let or for). And so, for example, I had always kept my fingers 
> crossed when adding an order by after a group by. Now I understand that once 
> the group by has done its thing and produced an output tuple stream according 
> to its rules, you have a tuple stream without any memory of what has happened 
> at earlier clauses.
> 
> Am Montag, 19. Dezember 2022 um 23:48:45 MEZ hat Imsieke, Gerrit, le-tex 
>  Folgendes geschrieben:
> 
> 
> Thank you, Hans-Jürgen, for shedding really insightful light (if there 
> is such a thing) on this aspect of XQuery grouping, which I use 
> gropingly (pun intended) without fully understanding it.
> 
> On 19.12.2022 23:19, Hans-Juergen Rennau wrote:
> > I think the reason is a different one - it is related to the precise 
> > semantics of the group by clause.
> > 
> > The group by clause maps each group of input tuples with equal grouping 
> > key(s) to a single output tuple, in which
> > - the grouping variable(s) is/are bound to the key values (as you would 
> > expect)
> > - all other variables are bound to the concatenated sequence of values 
> > bound to the variable name in the members of the group (which may cause 
> > surprises)
> > 
> > So when a group has, say, 3 members, the variable $organisations is not 
> > any more bound to a single function item, but to a sequence of 3 
> > function items (which are identical). Of course, a sequence of more than 
> > one function item cannot be called - only a single function item can be 
> > called. In order to check that this is the correct interpretation of the 
> > issue, you can remove the second assignment to $organisations, and 
> > append to the invocation the predicate [1] - then it works, as then you 
> > have again a single function item:
> > 
> > {$country/@name, $organizations[1]($country)}
> > 
> > One way to handle this in a more straightforward way is to shift the 
> > function item into an additional, outer FLWOR level at the beginning. 
> > While we are at it, let's shift both function items:
> > 
> > let $organizations := function($country){
> >  $doc//organization[members/@country = $country/@id]/@abbrev/string(.)}
> > let $membershipPotentcy := function($orgs){
> >  if (count($orgs)le 0) then 'none'  else if (count($orgs) le 5) then 
> > 'few' else 'many'}
> > return
> >element Memberships {
> >  for $countries in $doc//country
> >  group by $mp:= $membershipPotentcy($organizations($countries))
> >  order by $mp
> >  return
> >element {$mp} {
> >  for $country in $countries
> >  return
> >{$country/@name, $organizations($country)}
> >}}
> > 
> > 
> > Am Montag, 19. Dezember 2022 um 22:58:30 MEZ hat Graydon 
> > mailto:graydon...@gmail.com>> Folgendes geschrieben:
> > 
> > 
> > On Mon, Dec 19, 2022 at 10:43:25PM +0100, Leo Studer scripsit:
> > 
> >  > In the code below I encounter the problem, that I have to define the 
> > same xPath function variable $organizations twice and I do not 
> > understand why.
> > 
> > 
> > In line 10, you've used a let clause to bind a variable of type function 
> > to the name organizations.  That's in context a specific FLOWR expression.
> > 
> > The expression in t

Re: [basex-talk] some eq versus =

2024-04-10 Thread Leo Studer
Hi Christian Thanks for your answer. I came across this question because I needed to know whether there are city elements twice in the file. For that I wrote version 2 and the result was wrong. Then I wrote version 1 with … satisfies . => deep-equal($city)that gave the correct answer. I noticed that I do not fully understand the cast behavior of the = operator…Blessings,LeoSent from my dish washer On 9 Apr 2024, at 11:28, Christian Grün  wrote:Hi Leo,Yes, they are equivalent. Version 2 is a bit faster because "." will only need to be atomized once.We’ll examine if BaseX can automatically rewrite version 1 to version 2.Best,ChristianOn Mon, Apr 8, 2024 at 11:59 PM Leo Studer <leo.stu...@varioweb.ch> wrote:Helloare the following queries equivalent?1. //city[some $city in following::city satisfies string(.) eq string($city)]2. //city[. = following::city ]Thanks in advance,Leo


[basex-talk] some eq versus =

2024-04-08 Thread Leo Studer
Hello

are the following queries equivalent?

1. //city[some $city in following::city satisfies string(.) eq string($city)]

2. //city[. = following::city ]


Thanks in advance,
Leo




[basex-talk] Item Separator

2024-02-27 Thread Leo Studer
Hello

I am serialising the following expressions on oxygen/saxonEE12.3 as text 
(item-separator=“”) and wonder why the differente outputs

let $xml:=text1text2 return 
$xml/element/text()

gives
text1text2

And

let $xml:=text1text2 return 
$xml/element/string()

text1 text2


When I set the item-separator =“, “ then I get 

text1, text2

Or

text1, , text2


Any explanations???

Thanks,
Leo

Re: [basex-talk] Item Separator

2024-02-27 Thread Leo Studer
Thanks Hans-Jürgen

Indeed, with BaseX I get the same output for text nodes and strings. This is 
also how I understand the serialisation definition. Eventually Saxonica has 
another take on this???

Warmest,
Leo




> On 27 Feb 2024, at 12:16, Hans-Juergen Rennau  wrote:
> 
> Dear Leo,
> 
> it is important to remember that serialization - the transformation of the 
> logical query result, which is an XDM value, into a sequence of octets - is 
> defined by a W3C spec [1], and this definition is extremely detailed and 
> precise.
> 
> The item separator parameter is applied when concatenating strings. It is not 
> applied when concatenating text nodes, the contents of which are concatenated 
> without any separator. In one case of your example the logical query result 
> is a sequence of text nodes, in the other case it is a sequence of strings. 
> By the way, extreme standard conformance is a hallmark of BaseX.
> 
> Kind regards,
> Hans-Jürgen
> 
> [1]  https://www.w3.org/TR/xslt-xquery-serialization-31/
> 
> Am Dienstag, 27. Februar 2024 um 12:03:55 MEZ hat Leo Studer 
>  Folgendes geschrieben:
> 
> 
> Hello
> 
> I am serialising the following expressions on oxygen/saxonEE12.3 as text 
> (item-separator=“”) and wonder why the differente outputs
> 
> let $xml:=text1text2 return 
> $xml/element/text()
> 
> gives
> text1text2
> 
> And
> 
> let $xml:=text1text2 return 
> $xml/element/string()
> 
> text1 text2
> 
> 
> When I set the item-separator =“, “ then I get 
> 
> text1, text2
> 
> Or
> 
> text1, , text2
> 
> 
> Any explanations???
> 
> Thanks,
> Leo



Re: [basex-talk] Item Separator

2024-02-28 Thread Leo Studer

Dear Martin

Thank you for investigating. 
> The "text1,  , text2" I only see if oXygen shows the result as a sequence in 
> its result viewer; I would suggest to ask the oXygen support why you get that 
> result for that case, it seems like some quirk in their result viewer (it 
> shows two xs:string items but for reasons I can't investigate serializes the 
> two items for the result viewer as "text1,  , text2").
> 
This is incredible news. I will get to Oxygen about that. Really troubling …

Blessings,
Leo