This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 4401 - [FS] validate strict expressions and err:XQDY0084
Summary: [FS] validate strict expressions and err:XQDY0084
Status: CLOSED WONTFIX
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Dyck
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-21 08:31 UTC by Tim Mills
Modified: 2009-06-22 20:36 UTC (History)
0 users

See Also:


Attachments

Description Tim Mills 2007-03-21 08:31:43 UTC
Consider a query similar to XQTS test validateexpr-23 in which an attempt is made to validate an element which does not have a top-level schema declaration.


declare default element namespace "http://www.w3.org/XQueryTestOrderBy";

(: name : validateexpr-23 :)
(: description : Evaluation of a validate expression, whose operand node is a ne
wly cosntructed top element :)
(: node for whom there is no declaration.:)

(: insert-start :)
import schema "http://www.w3.org/XQueryTestOrderBy";
declare variable $input-context1 external;
(: insert-end :)


let $var := validate strict { element DataValues1 {element Strings {"data"}}}
return $var

In this situation the error err:XQDY0084 should be flagged.  This condition is detectable at type checking time when attempting to determine Type1 in:

statEnv |-  validate ValidationMode { Expr } : Type1

None of the rules of 8.6.1 Elements in validation mode apply (because there is no top-level element definition and the validation mode is strict).  This individates that the error condition XQDY0084 will occur.

However, XQDY0084 is a dynamic error and should only be raised when the validate expression is executed.  This is illustrated by XQTS test validateexpr-14.

Should a static typing implementation raise a static type checking exception in this case or raise XQDY0084 during typechecking?
Comment 1 Michael Dyck 2007-03-26 12:00:38 UTC
(In reply to comment #0)
> 
> However, XQDY0084 is a dynamic error and should only be raised when the
> validate expression is executed.

No, it can also be raised during static analysis: "if an implementation can determine during the static analysis phase that an expression, if evaluated, would necessarily raise a type error or a dynamic error, the implementation may (but is not required to) report that error during the static analysis phase." [XQuery 2.3.1].

> Should a static typing implementation raise a static type checking exception in
> this case or raise XQDY0084 during typechecking?

I believe it's not obliged to raise any error (for this condition) during static analysis, but if it does, the error must be XQDY0084.

However, since the Formal Semantics document does not specify errors by name, I believe this issue would be more appropriately filed/resolved under the "XQuery" component.
Comment 2 Tim Mills 2007-03-26 12:52:04 UTC
Thanks.  In that case the expected error codes for XQTS test validateexpr-14 need to be updated to include XQDY0084.  Better still would be to have this test rewritten so that the "if" condition is not a constant.
Comment 3 Michael Dyck 2007-03-27 17:09:42 UTC
With respect to the question of an implementation raising XQDY0084 during static analysis, the Working Group has decided to endorse the response I gave in Comment #1, and close the issue with no change to the Formal Semantics.

With respect to the expected outcomes of validateexpr-14, please re-submit the suggestions of Comment #2 as a bug against the XQTS product.
Comment 4 Michael Dyck 2009-06-22 20:36:59 UTC
After over 2 years with no response from the original reporter,
I am marking this issue CLOSED. Please feel free to reopen it
if you disagree with this outcome.