Re: [RESEND] Derivation by restriction

Hi Simon,

> But we also need to move up one step: we need for circle-container
> and polygon-container to both be geometry-containers.
>
> But the definition of a circle (i.e. a centre and radius) and
> polygon (a list of coordinates) do not have an obvious common
> ancestor from which they can both be derived by restriction. So we
> had defined GeometryType as a (more or less) empty abstract super
> type, and then derived CircleType and PolygonType by extension.
>
> This is where we hit the wall, since using XSD we now cannot define
> circle-container and polygon-container as restrictions of
> geometry-container ... the types of the content particles are not
> restrictions of the type of the content particle in the base type.

The only way I can see of solving this problem is to change the way
that you declare either GeometryType or the geometry-container.

First, you could change the definition of GeometryType so that you can
derive CircleType and PolygonType by restriction. Since you want it to
contain anything, you could use something along the lines of:

<xs:complexType name="GeometryType">
  <xs:sequence>
    <xs:any minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
  <xs:anyAttribute />
</xs:complexType>

You could then derive CircleType and PolygonType from this general
type by restriction.

Alternatively, you could change the definition of geometry-container
so that you can derive both circle-container and polygon-container
from it by extension.

I think that changing your definition of GeometryType is probably the
best option.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Tuesday, 2 April 2002 03:08:03 UTC