W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2001

RE: Extensions of Enumerations

From: Michael Zoratti <m.zoratti@nortelnetworks.com>
Date: Fri, 22 Jun 2001 13:59:19 -0500
Message-ID: <CEDFCAE711ADD4118B030008C7E674A41CA5CA@nbrwd469.ca.nortel.com>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>

Thanks, Scenerio #1 is the better work around to this 
problem. Although as you stated there is no relation to the original
OrderState, it is at least better then the Substitution solution
I proposed earlier. I will go with this as my solution.

Thanks Again
Mike


-----Original Message-----
From: ht@cogsci.ed.ac.uk [mailto:ht@cogsci.ed.ac.uk]
Sent: Friday, June 22, 2001 11:43 AM
To: Zoratti, Michael [ATWL:C01P:EXCH]
Cc: 'xmlschema-dev@w3.org'; 'www-xml-schema-comments@w3.org'
Subject: Re: Extensions of Enumerations


"Michael Zoratti" <m.zoratti@nortelnetworks.com> writes:

> Scenario #1
> 
> 1) Wrap the enumeration declaration in a base complexType. Simply provide
> the
> element name (Value in this example) but do not provide the type
> declaration. 
> 2) In the extension you can declare the Value element and provide the
> declaration of 
> the simple type enumeration
> 3)  Any consequent extension you could declare the Value element of a
> different enumerated type.
> 
> 1)  <complexType name="OrderStateBase" abstract="true">
> 	<sequence>
> 		<element name="Value"/>
> 	</sequence>
>     </complexType>
> 
> 2)  <complexType name="OrderState">
> 	   <complexContent>
> 		<restriction base="en:OrderStateBase">
> 			<sequence>
> 				<element name="Value"
> type="en:OrderStateEnum"/>
> 			</sequence>
> 		</restriction>
> 	   </complexContent>
>     </complexType>
> 
> 3)  <complexType name="OrderStateExtended">
> 	   <complexContent>
> 		<restriction base="en:OrderStateBase">
> 			<sequence>
> 				<element name="Value"
> type="en:OrderStateEnumExtended"/>
> 			</sequence>
> 		</restriction>
> 	   </complexContent>
>     </complexType>

That works, but OrderStateExtended has no relationship to OrderState.

> Scenario #2
> 
> 1)  Wrap the enumeration element declaration in a base complexType.
Provide
> the
> element name (Value in this example) and the simple type enumeration
> declaration. 
> 2) Introduce OrderStateRestricted that does not re-declare the 
> the Value element. 
> 3)Then declare a OrderStateExtended (extended from OrderStateRestricted)
> that declares a Value element of a different simple type enumeration.
> 
> 1)    <complexType name="OrderState">
> 		<sequence>
> 			<element name="Value" type="en:OrderStateEnum"
> nullable="true"/>
> 		</sequence>
> 	</complexType>
> 
> 
> 2)  <complexType name="OrderStateRestricted">
> 		<annotation>
> 		   <documentation>By not re-declaring the original 
>                 element Value, it is in effect Omitted.</documentation>
> 		</annotation>
> 		<complexContent>
> 			<restriction base="en:OrderState">
> 				<sequence/>
> 			</restriction>
> 		</complexContent>
> 	</complexType>
> 
> 3) <complexType name="OrderStateExtended">
> 		<annotation>
> 		<documentation>We extend from OrderStateRestricted, 
>             which has no elements in it but is still extended 
>             from OrderState and therefore allowed to replace any 
>             occurrence of OrderState</documentation>
> 		</annotation>
> 		<complexContent>
> 			<extension base="en:OrderStateRestricted">
> 				<sequence>
> 					<element name="Value"
> type="en:OrderStateEnumExtended"/>
> 				</sequence>
> 			</extension>
> 		</complexContent>
> 	</complexType>

That doesn't work, because there is explicit language (clause 1.5 of 
[1] which forbids you from using extension to put back something you
took away:

  "It must in principle be possible to derive the complex type
  definition in two steps, the first an extension and the second a
  restriction (possibly vacuous), from that type definition among its
  ancestors whose {base type definition} is the ·ur-type definition·."

ht

[1] http://www.w3.org/TR/xmlschema-1/#cos-ct-extends)
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Friday, 22 June 2001 15:00:53 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:50 GMT