Re: Validation of an element restriction whose base type has the variety union

On 9 Nov 2003, at 11:49 , Alessandro Triglia wrote:

> Michael Marchegay wrote:
>>
>> Hello,
>>
>> It seems to me that the the following schema should be
>> invalid because the value space of the base type definition
>> of the element "e" in the type "ct-base" is not a super set
>> of the value space of the base type definition of the element
>> "e" in "ct-deriv"; but I cannot find any Schema Component
>> Constraint invalidating it.
>>
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>
>>   <xs:simpleType name="base">
>>     <xs:union memberTypes="xs:boolean xs:integer"/>
>>   </xs:simpleType>
>>
>>   <xs:simpleType name="deriv">
>>     <xs:restriction base="base">
>>       <xs:enumeration value="1"/>
>>       <xs:enumeration value="2"/>
>>     </xs:restriction>
>>   </xs:simpleType>
>>
>>   <xs:complexType name="ct-base">
>>     <xs:sequence>
>>       <xs:element name="e" type="deriv"/>
>>     </xs:sequence>
>>   </xs:complexType>
>>
>>   <xs:complexType name="ct-deriv">
>>     <xs:complexContent>
>>       <xs:restriction base="ct-base">
>>         <xs:sequence>
>>           <xs:element name="e" type="xs:integer"/>
>>         </xs:sequence>
>>       </xs:restriction>
>>     </xs:complexContent>
>>   </xs:complexType>
>>
>> </xs:schema>
>>
>> Using cos-st-derived-ok [1], xs:integer seems to be validly
>> derived given {extension, list, union} from deriv (because
>> the member type definitions property of deriv is the the
>> member type definitions of base). Therefore,
>> rcase_NameAntTypeOK [2] is not violated, and the restriction
>> seems to be valid.
>
>
> The assumption behind clause 2.2.4 of  "Schema Component  
> Constraint: Type
> Derivation OK (Simple)"  is that the value space of every union is a
> superset of the value space of each of its member types, which does  
> not hold
> when a union is a restriction of another union.
>
> For example, if a union type BU has member types A and B, and  
> another union
> type RU is a restriction of BU with an enumeration facet, the value  
> space of
> RU will include only a subset (possibly empty) of the value space  
> of A and a
> subset (possibly empty) of the value space of B.  However, in this  
> case,
> clause 2.2.4 still implies that the whole A and the whole B are valid
> restrictions of RU just because they are members of BU and thus  
> members of
> RU.
>
> I think there is a concept missing here.  Perhaps we need the  
> concept of
> "effective member type definition"  (or something like this) to  
> designate
> the implicit restrictions of the member types that are implied by  
> the facets
> of the restriction union.  In this way, we would be able to say  
> that the
> value space of every union is the union of the value spaces of the
> "effective" member type definitions.
>
> Alessandro Triglia
>
>
>>
>> Have I missed something?
>>
>> [1] http://www.w3.org/TR/xmlschema-1/#cos-ct-derived-ok
>> [2] http://www.w3.org/TR/xmlschema-1/#rcase-NameAndTypeOK
>>
>> Thanks,
>>
>> Michael Marchegay

First, belated thanks to Michael Marchegay for raising this issue,  
and thanks
to Alessandro Triglia for copying www-xml-schema-comments on his
reply.  My apologies for the length of time which has elapsed before  
this
formal response.

The issue raised has been entered into the W3C's public Bugzilla  
instance
as bug 2233 (for XML Schema 1.1) and also as bug 3763 (for 1.0).
The problem is related to that raised in bug 2333, which describes the
loss of union-level facets in unions of unions.

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2233
http://www.w3.org/Bugs/Public/show_bug.cgi?id=3763
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2333

For XML Schema 1.1, this issue should now be resolved by the changes
made to eliminate the 'flattening' of the member type definitions:   
unions
can now be members of unions, and union-level facets are no longer
lost.  When a member type is treated as 'derived from' a union, the
Schema Component Constraint: Type Derivation OK (Simple) now requires
that the union in question (and any 'intervening unions') have no  
facets.
That suffices to make the replacement of

   <xs:element name="e" type="deriv"/>

by

   <xs:element name="e" type="xs:integer"/>

in ct-deriv illegal.

The changes are reflected in the current public working drafts of XML
Schema 1.1: Structures and Datatypes.

I do not know whether either of you (Michael Marchegay or Alessandro
Triglia) still take an interest in this issue you raised three years  
ago.
But if you do, then please let us know whether you believe the changes
made to unions in the current drafts of XML Schema 1.1 successfully
resolve the issue.

If you agree that that the changes do constitute a satisfactory
resolution of the issue, then please let us know, by adding a comment
to the issue record in bug 2233 and changing the Status of the issue to
Closed. Or, if you do not agree with this resolution, please add a  
comment
explaining why. If you wish to appeal the WG's decision to the
Director, then also change the Status of the record to Reopened.
If you wish to record your dissent, but do not wish to appeal the
decision to the Director, then change the Status of the record to
Closed.

Updating the Bugzilla entry will require that you create a Bugzilla
userid.  If that is not convenient, you can of course simply reply to  
this
email.

If we do not hear from you in the next month, we will assume that you
agree with the WG decision.

best regards, and thanks again

--C. M. Sperberg-McQueen
   W3C XML Schema Working Group

Received on Saturday, 23 September 2006 23:07:30 UTC