[Bug 6804] assertions example doubt

http://www.w3.org/Bugs/Public/show_bug.cgi?id=6804





--- Comment #1 from C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com>  2009-04-13 16:04:10 ---
[Speaking only for myself, not on behalf of the WG]

Thank you for your comment.  Every reader of the draft
spec is appreciated.

Interesting that you should raise this issue.  In designing
the assertions construct, the WG spent a lot of energy
debating whether it was desirable, highly desirable,
essential, or desirable but not essential for the content and
attributes of elements to be typed in the data model instance
used to check assertions.  Your comment provides empirical 
evidence that the proposition "all users will expect the 
attributes to have their typed values, not untyped values, 
and will not understand what is going on if they are 
untyped" is false; there is at least one exception.

However, the WG concluded that it would be convenient if, for
assertions checked on an element, the attributes and
descendant elements were typed, and so we looked for,
and found, a way to specify that behavior without logical 
contradiction.

The rules for constructing the data model instance and
evaluating the XPath expression, which are given in section
3.13.4, arrange things so that in the example you cite

  @min le @max

the 'min' and 'max' attribute have already been validated
as instances of xs:int and the data model instance contains
their typed values.  So the cast you propose

  xs:int(@min) le xs:int(@max)

is unnecessary (although probably harmless).

If you want chapter and verse, it is clauses 1.2 and 1.3 of
Validation Rule: Assertion Satisfied which cause the
attributes to be typed in the XDM instance.

If it wasn't clear to you as a reader that the attributes in
your example would be typed as int, then as editor I
apologize: the text isn't doing its job perfectly if readers
are surprised in this way.  I would suggest adding some
explicit statement on the topic to the description of
assertions earlier in the section, except that I do not know
how to say it more clearly than it is already said in the
paragraph before last of section 3.13.1, which begins:

    To check an assertion, an instance of the XPath 2.0 data
    model ([XDM]) is constructed, in which the element
    information item being ·assessed· is the root element, and
    elements and attributes are assigned types and values
    according to XPath 2.0 data model construction rules, with
    some exceptions.

Perhaps the prose following the example you refer to could be
changed from

    The value of the min attribute must be less than or equal
    to that of the max attribute.

to 

    The value of the min attribute must be less than or equal
    to that of the max attribute.  Note that the attributes
    are validated before the assertion on the parent element
    is checked, so the typed values of the attributes are
    available for comparison; it is not necessary to cast the
    values to int or some other numeric type before comparing
    them.

Would that help?


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Monday, 13 April 2009 16:04:18 UTC