[Bug 2746] wd-20: Identity vs. Equality in enumerations and fixed value constraints

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

           Summary: wd-20: Identity vs. Equality in enumerations and fixed
                    value constraints
           Product: XML Schema
           Version: 1.1 only
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Datatypes: XSD Part 2
        AssignedTo: cmsmcq@w3.org
        ReportedBy: holstege@mathling.com
         QAContact: www-xml-schema-comments@w3.org


In the call today we decided to use identity for value constraints, just as we 
do for enumeration, on the logic that a fixed value constraint is like an 
enumeration with a single value.

Noah and I expressed a certain discomfort with identity in both these cases, 
especially with respect to precision decimal. Consider:
<xs:simpleType name="u2numbers"> <xs:restriction base="xs:precisionDecimal"> 
<xs:enumeration value="1.0"/> <xs:enumeration value="2.0"/> <xs:enumeration 
value="3.0"/> <xs:enumeration value="14.0"/> </xs:restriction> </xs:simpleType>

We accepted that "1" and "1.00" would not be valid against this enumeration on 
the grounds that enumerations of decimals were not used in practice, so this 
infelicity was unlikely to bite anyone. The work-around would be to enumerate a 
sufficient range of precisions to cover the most likely cases to turn up in 
practice:
<xs:simpleType name="u2numbers"> <xs:restriction base="xs:precisionDecimal"> 
<xs:enumeration value="1"/> <xs:enumeration value="1.0"/> <xs:enumeration 
value="1.00"/> <xs:enumeration value="2"/> <xs:enumeration value="2.0"/> <xs:
enumeration value="2.00"/> <xs:enumeration value="3"/> <xs:enumeration value="3.
0"/> <xs:enumeration value="3.00"/> <xs:enumeration value="14"/> <xs:enumeration 
value="14.0"/> <xs:enumeration value="14.00"/> </xs:restriction> </xs:
simpleType>

Painful in practice, impossible in the general case (although I suppose you 
could enumerate to the limits of precision supported by your processor, urgh.)

Or you put in a pattern facet instead, which can also be painful.

Consider this definition:
<xs:element name="meterMin" type="xs:precisionDecimal"/>

Somewhere in a content model:
<xs:element ref="meterMin" fixed="1.0"/>

In this case<meterMin>1.00</meterMin> and <meterMin>1</meterMin> would be 
rejected.

Here, however, there is no workaround that allows you the simplicity of using 
the fixed attribute: you have to change the type. If you wanted to have 
different fixed values for different uses of the element meterMin in your 
schema, you have to jump through some rather painful hoops using local 
definitions that have nasty enumerations or patterns in them: the type of each 
use of meterMin would have to be different.I still question the wisdom of using 
identity in either of these cases. Most types do not distinguish identity and 
equality, and in those cases that do, the results are unhelpful, as shown.

Request concerning
Part 1
Transition history

raised on 3 Dec 2004 by Mary Holstege (http://lists.w3.org/Archives/Public/www-
xml-schema-comments/2004OctDec/0026.html)
declined on 3 Dec 2004 (http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/
2004Dec/0002.html)

RESOLVED No consensus to change status quo.

Acknowledgment cycle
announced by group on 3 Nov 2004 (http://lists.w3.org/Archives/Member/w3c-xml-
schema-ig/2004Nov/0002.html)

Received on Friday, 20 January 2006 21:26:30 UTC