- From: <bugzilla@jessica.w3.org>
- Date: Wed, 10 Sep 2014 10:44:27 +0000
- To: public-qt-comments@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26752
--- Comment #2 from Michael Kay <mike@saxonica.com> ---
Agreed, this needs fixing.
I don't think we can contemplate allowing streamed nodes to be bound to
variables for this case; it's too difficult to predict all the consequences. We
simply don't have the language or conceptual machinery to talk about an
expression being (eg.) consuming "with respect to" a variable.
Although the rules end up being restrictive, a workaround using predicates is
often possible.
Suggested rewrite:
Writing the expression as some|every $v in S satisfies C, the two operand roles
are S and C.
The general streamability rules apply. The operand roles are:
* The in expression (S). This has usage navigation.
* The satisfies expression (R). This is a higher-order operand with usage
inspection.
Note:
Expressions of the form some $i in 1 to 3 satisfies $i lt 2, where there is no
reference to a streamed node, are clearly streamable.
The in expression can also be consuming, so long as it is grounded: for example
some $e in copy-of(emp) satisifies $e/salary gt 10000.
The rule that S has usage navigation prevents the variable being bound to a
node in a streamed document. This disallows expressions of the form some $x in
child::section satisfies has-children($x), because this requires data flow
analysis (tracing from the binding of a variable to its usages), rather than
purely syntactic analysis. Some implementations may be able to stream such
constructs.
The fact that the return clause is a higher-order operand prevents it from
being a consuming expression, for example some $i in 1 to 3 satisifes grade =
$i. Use of a motionless expression that accesses streamed nodes is however
allowed, for example some $i in 1 to 3 satisfies @grade = $i.
Quantified expressions that fail the streamability rules can often be rewritten
as filter expresions. For example, the expression some $x in child::section
satisfies has-children($x) can be rewritten as
exists(child::section[has-children(.)]), which is grounded and consuming.
ASIDE: in this rewrite there is no equivalent to rule 1 of "for" expressions
("If R is not grounded, then roaming and free-ranging"). I don't believe the
rule is needed for "for" expressions either.
--
You are receiving this mail because:
You are the QA Contact for the bug.
Received on Wednesday, 10 September 2014 10:44:28 UTC