[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Does the count() function require access to the wh

Subject: Re: Does the count() function require access to the whole subtree?
From: John Lumley <john@xxxxxxxxxxxx>
Date: Mon, 13 Jan 2014 18:19:08 +0000
Re:  Does the count() function require access to the wh
On 13/01/2014 12:53, Michael Kay wrote:
No. Counter-example: count(following-sibling::x) is not streamable.

More specifically, count(X) is streamable (more specifically, its posture is grounded) if the posture of X is grounded, climbing, striding, or crawling, but not if it is roaming.

Sorry - I know that's a lot of new jargon to absorb on a Monday morning!

To clarify (or muddy) the situation a little more ..... whilst:


   count(//h)
   on its own would be streamable (it has grounded posture, and returns
   NO nodes from the context subtree),

   count(//h) + count(//j)
   is not streamable, since though each separately is grounded, BOTH
   have consuming sweep, i.e. they each consume the entirety of the
   context subtree and the posture becomes roaming - there has to be
   some form of buffering to be able to satisfy the second operand's
   sweep over its data.

   If both were members of a choice group (i.e. only one of them can
   actually operate in any execution) then streamability may be
   restored - such a case would be      if($h) then count(//h) else
   count(//j).

Of course clever understanding of the deeper semantics could cause a rewrite, such as count(//*[self::h|self::j]) to have grounded posture and be streamable on its own, but that requires knowledge of a distribution rule for count() and + and rewrites for (//h|//j).

Actually that's a pretty simple case, so perhaps we need machines to at least help check.... I hope to have something we can show at XMLPrague.

John

--
*John Lumley* MA PhD CEng FIEE
john@xxxxxxxxxxxx <mailto:john@xxxxxxxxxxxx>
on behalf of Saxonica Ltd

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.