Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Marco Lettere
Ok, I see. Thanks a lot for the great help again! M. On 28/08/2018 16:05, Christian Grün wrote: You can use the fn:sort function for that: for tumbling window $w in sort( db:open("adatabase")[every $f in $filters satisfies $f(.)], (), function($doc) { db:path($doc) } )

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Christian Grün
You can use the fn:sort function for that: for tumbling window $w in sort( db:open("adatabase")[every $f in $filters satisfies $f(.)], (), function($doc) { db:path($doc) } ) ... Sorting is a blocking operator, though: All documents will need to be checked first in order to tell

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Marco Lettere
and what if, a pervert I know, would like to have the docs also globally ordered by any sort criteria? Any chance of squeezing the order by into this elegant FLOWR? Thanks again. M. On 28/08/2018 15:41, Christian Grün wrote: Hi Marco, Here is a minimized representation of your last

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Marco Lettere
Wow! Works ... of course :-D And I'd say rather fast! Thanks a lot Christian and Martin! Auf bald! On 28/08/2018 15:41, Christian Grün wrote: Hi Marco, Here is a minimized representation of your last query: for tumbling window $w in db:open("adatabase")[every $f in $filters satisfies

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Christian Grün
Hi Marco, Here is a minimized representation of your last query: for tumbling window $w in db:open("adatabase")[every $f in $filters satisfies $f(.)] start $first at $s when ($s = 1 + ($page - 1) * $count) end $last at $e when $e - $s = $count - 1 return $w Cheers, Christian On

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Marco Lettere
Oh, yes. Thank you Martin. That is obviously a good point. The input is a database with several thousands of documents stored in it. The filters are a dynamic sequence of xpath expressions to be applied on the documents expressed as function references. I need to check whether I can compress all

Re: [basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Martin Honnen
On 28.08.2018 11:04, Marco Lettere wrote: here's a question related to XQuery, sorry for being slightly off-topic. I'm struggling to find a way to combine the windowing clause and FLOWR in order to get a paged result of a subset of items which respect a given filter. Of course I'm able to

[basex-talk] [XQUERY] Filter and paging with window clause

2018-08-28 Thread Marco Lettere
Hi all, here's a question related to XQuery, sorry for being slightly off-topic. I'm struggling to find a way to combine the windowing clause and FLOWR in order to get a paged result of a subset of items which respect a given filter. Of course I'm able to get this by first applying the