Christian,

Alternatively, would this be a place one could use a 3.0 window clause?

This raises a related question. I have seen a big boost on performance
when using 'group by' instead of the classic distinct-values-based
grouping. I suppose this is not surprising. Cerstin's question,
similarly, is a grouping question, although the grouping is based on
proximity in document order, not on values. (In XSLT it would be
addressed using xsl:for-each-group[@group-starting-with].)

When doing this (or any) sort of grouping, are we generally better off
using the new 3.0 power features than doing it the old-fashioned way
by hand? (I imagine that given the size of Cerstin's documents it may
not be an issue for her, but what if the sequences were long?)

Cheers, Wendell


On Tue, Mar 12, 2013 at 2:33 PM, Christian Grün
<[email protected]> wrote:
> Hi Cerstin,
>
> the following query may help:
>
>   for $entry in $doc//entry
>   let $next := $entry/following-sibling::entry[1]
>   let $sc := $entry/following-sibling::secondquery
>     [empty($next) or . << $next]
>   return (
>     insert nodes $sc into $entry,
>     delete nodes $sc
>   )
>
> Cheers,
> Christian
> ___________________________
>
> On Tue, Mar 12, 2013 at 5:46 PM, Cerstin Elisabeth Mahlow
> <[email protected]> wrote:
>> Hi,
>>
>> after a lot of data has been gathered, I realized that my update-function 
>> has a bug.  It's not a big deal fixing it, however, I don't know how to 
>> resort the existing data.
>>
>> Essentially, I wanted to create this kind of data:
>>
>> <collection>
>> <entry>
>> <node>123</node>
>> <query>xyz</query>
>> <secondquery>abc_1</secondquery>
>> <secondquery>abc_2</secondquery>
>> </entry>
>> <entry>
>> <node>456</node>
>> <query>xyz</query>
>> <secondquery>abc_1</secondquery>
>> <secondquery>abc_3</secondquery>
>> <secondquery>abc_4</secondquery>
>> </entry>
>> </collection>
>>
>>
>> However, the data looks like this:
>>
>> <collection>
>> <entry>
>> <node>123</node>
>> <query>xyz</query>
>> </entry>
>> <secondquery>abc_1</secondquery>
>> <secondquery>abc_2</secondquery>
>> <entry>
>> <node>456</node>
>> <query>xyz</query>
>> </entry>
>> <secondquery>abc_1</secondquery>
>> <secondquery>abc_3</secondquery>
>> <secondquery>abc_4</secondquery>
>> </collection>
>>
>> So, the secondqueries are stored just after the entry they belong to.  How 
>> would I be able to move these data from "right after a particular node" to 
>> "just inside this particular node" using XQuery Update?
>>
>> Thanks in advance and best regards
>>
>> Cerstin
>> --
>> Dr. phil. Cerstin Mahlow
>>
>> Universität Basel
>> Departement Sprach- und Literaturwissenschaften
>> Fachbereich Deutsche Sprach- und Literaturwissenschaft
>> Nadelberg 4
>> 4051 Basel
>> Schweiz
>>
>> Tel:  +41 61 267 07 65
>> Fax: +41 61 267 34 40
>> Mail: [email protected]
>> Web: http://www.oldphras.net
>>
>> _______________________________________________
>> BaseX-Talk mailing list
>> [email protected]
>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
> _______________________________________________
> BaseX-Talk mailing list
> [email protected]
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk



--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
_______________________________________________
BaseX-Talk mailing list
[email protected]
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to