Buon giorno,

there as is a “previous” clause in a window, which binds to the previous value. With this you can simply express what you verbalized in XQuery:

for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".")
start  $a when fn:true() 
end $b previous $prev next $r when ($b = "]" and $prev = ".") or ($b = "." and $r != "]")
return
<s>{$s}</s>

Hope that helps
Dirk


Senacor Technologies Aktiengesellschaft - Sitz: Eschborn - Amtsgericht Frankfurt am Main - Reg.-Nr.: HRB 110482
Vorstand: Matthias Tomann (Vorsitzender), Marcus Purzer - Aufsichtsratsvorsitzender: Daniel Grözinger

On 3. Apr 2019, at 10:51, Giuseppe G. A. Celano <celano@informatik.uni-leipzig.de> wrote:

I have written the following code:

for tumbling window $s in ("this", "is", "an", "example", "." , "this", "is", "another", "[", "example", ".", "]", "Another", "example", ".")
start  $a when fn:true()
end $b next $r when ($b = "." and $r = "]") or $b = "."
return
<s>{$s}</s>

which returns:

<s>this is an example .</s>
<s>this is another [ example .</s>
<s>] Another example .</s>

but I am looking for

<s>this is an example .</s>
<s>this is another [ example . ]</s>
<s>Another example .</s>

I am playing around with if-clauses, but I am wondering whether there is a more direct way to force the end of a sentence at "]" when it is preceded by "." or at "." when there is no following "]". Thanks.

Ciao,
Giuseppe