RE: What good is Restriction?

XML Schema's implementation of derivation by restriction of complex types
was a real challenge for the OAGI when developing OAGIS 8. As you point out,
derivation by restriction requires the replication (and thus duplicate
maintenance) for all things derived. 

In the case of OAGIS, we may have at least a half-dozen different uses of a
particular "Noun" (e.g., PurchaseOrder), each differing only by the minimum
occurrence constraints of it parts (some uses of PurchaseOrder require at
least one LineItem, while others do not). To achieve this, we need a
half-dozen "replicants" of the Noun, each with nearly identical content.
Then, any change to the core/base definition must be replayed on each of the
replicants. Very labor-intensive, very error-prone. 

Furthermore, derivation by restriction creates a nearly impossible situation
when crossing namespace boundaries. When the content is replicated across
namespace boundaries, the new content takes on a different namespace and
thus is no longer recognized as being derived. So if I have an
oa:DateOfBirth as a child element of oa:Person and I restrict oa:Person in
myns:Person, replication of the child would require that oa:DateOfBirth
would become myns:DateOfBirth. With "different names," schema validators
don't recognize these as being related in any way. They all see this as
having removed oa:DateOfBirth (a legal restriction only if the minOccurs of
oa:DateOfBirth is 0) and having added a myns:DateOfBirth element (an
extension, which is illegal in a derivation by restriction). 

For these reasons (and others) we opted not to use derivation by
restriction. Instead, we have had to incorporate other means to check the
correct cardinalities of each Noun's parts.

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: 	Gary Cramblitt [mailto:garycramblitt@comcast.net] 
Sent:	Monday, July 08, 2002 5: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...

Thanks

--
Gary Cramblitt
garycramblitt@comcast.net

Received on Tuesday, 9 July 2002 14:54:15 UTC