RE: What good is Restriction?

How about some kind of restriction mechanism that makes use of XPath
expressions to disambiguate? Something whereby the specific element is
identified using the expression and then restrictions applied to that
element. 

Certainly a departure from how things are currently represented in Schema,
but at least it allows for targeted adjustments rather than requiring full
replication of content.

Mark


Mark Feblowitz                                   	
XML Architect
       [t]   617.715.7231                                     	
       [f]   617.495.0188
Frictionless Commerce Incorporated 	
       [e]  mfeblowitz@frictionless.com
       [w] http://www.frictionless.com
       [m] 400 Technology Square, 9th Floor
             Cambridge, MA 02139 
Open Applications Group Incorporated
       [e]  mfeblowitz@openapplications.org
       [w] http://www.openapplications.org 

 -----Original Message-----
From: 	Biron,Paul V [mailto:Paul.V.Biron@kp.org] 
Sent:	Wednesday, July 10, 2002 12:34 PM
To:	'Gary Cramblitt'; xmlschema-dev@w3.org
Subject:	RE: What good is Restriction?


> -----Original Message-----
> From:	Gary Cramblitt [SMTP:garycramblitt@comcast.net]
> Sent:	Monday, July 08, 2002 2:41 PM
> To:	xmlschema-dev@w3.org
> Subject:	What good is Restriction?
> 
> Quoting from the XML-Schema Primer, when deriving a new type 
> by restricting a base complex type...
> ---
> Notice that types derived by restriction must repeat all the 
> components of the base type definition that are to be included 
> in the derived type
> ---
> So if I must repeat everything in the base type as well as the 
> restrictions, what good is it?  Why not just create a new type 
> and be done with it?  My conclusion is that while XSD claims 
> to be object oriented, it doesn't support full inheritance, at least 
> not in this instance.  Maybe this is similar to Microsoft's  
> "Interface Inheritance"?  Anybody know why this requirement 
> was put in the spec?  Just wondering...
> 
Others have attempted to address the 'why use restriction' question...I'll
see if I can address the 'why do you have to replicate everything in a
restriction' question.

Believe me, if the WG had come up with an alternative we would put that in
the spec...non of us like it either.  Here's a real simple case (artificial,
as it may be...I'm sure that given a few moments we could all come up with a
"useful" example) that illustrates the difficulty:

	<xs:complexType name='base'>
		<xs:sequence>
			<xs:element name='a' minOccurs='0'>
				<xs:complexType>
					...
				</xs:complexType>
			</xs:element>
			<xs:element name='b'>
				<xs:complexType>
					<xs:sequence>
						<xs:element name='a'
minOccurs='0'>
							<xs:complexType>
								...
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

If I write a restriction of 'base' that only mentions the element
'a'...which model does it refer to?

With locally declared elements it is possible to have more than one element
of a given "name" in a content model and the WG couldn't figure out how to
handle restriction in the face of this without requiring the relevent
portions of the content model to be "duplicated".  We explored several
alternatives but none panned out.

If you (or anyone, for that matter) has a viable solution, by all means,
post it to www-xml-schema-comments@w3.org and we will certainly consider it
for a future version of the spec.

pvb
Schema WG member (speaking for myself and not the WG)

Received on Wednesday, 10 July 2002 13:31:41 UTC