Re: Derivation by restriction wrt to type inheritance

Mike Leditschle pointed out that there was a thread "Restriction of complex
types by changing minOccurs" dealing with somewhat the same sort of problem.
Thank you Henry and Mike, I now see that the XML Schema Spec forces the type
of a content particle of a complex type derived by restriction to have
a restricted type of its complex type base type.

Nevertheless I don't see the rationale behind it, as in oo pardigm and many
programming languages it is perfectly valid to derive a type R from a base
type B and to redefine the type of a structural attribute b of the base type
in the subtype.
Actually there wouldn't be any problem, if XML Schema allowed me to redefine
the type of a particle in derivation by extension. However, it is only
possible when I derive by restriction, forcing me to restrict the particle's
type too. Could someone motivate this decision?

Regards, Martin


----- Original Message -----
From: "Henry S. Thompson" <ht@cogsci.ed.ac.uk>
To: "Martin Bernauer" <bernauer@dke.uni-linz.ac.at>
Cc: <xmlschema-dev@w3.org>
Sent: Wednesday, November 21, 2001 12:41 PM
Subject: Re: Derivation by restriction wrt to type inheritance


---snip---

> Ah, but Staff is not a restriction of Person, it's an extension.
>
> To achieve your goal, you need to:
>
> a) Declare <entry> at the top level (you may want to make it
>    abstract);
> b) Declare <xs:element name='staff' type='sam:Staff'
>                       substitutionGroup='sam:entry'/>
> c) change StaffList to have
>     <xs:element ref='sam:staff'/>
>    as its content model.
>
> If the namechange (from <entry> in the general case to <staff> in the
> restricted case) is not acceptable, then you can't derive StaffList
> from PersonList, I'm afraid.
>
> ht
> --
>   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, 23 November 2001 02:40:09 UTC