- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 13 Sep 2000 09:34:46 +0100
- To: Hoylen Sue <h.sue@dstc.edu.au>
- Cc: www-xml-schema-comments@w3.org
Without look in great detail at your example, I think you can do what
you want with equivalence classes. I'll give a general example, see
if it fits for your particular case.
<?xml version='1.0'?>
<!DOCTYPE schema SYSTEM "http://www.w3.org/1999/XMLSchema.dtd" >
<schema>
<complexType name="vehicle" abstract="true">
<sequence>
<element ref="wheels" minOccurs="0"/>
. . .
</sequence>
<attribute name="powerSource">
<simpleType>
<enumeration value="mechanical"/>
<enumeration value="animate"/>
</simpleType>
</attribute>
<attribute name="medium">
<simpleType>
<enumeration value="land"/>
<enumeration value="sea"/>
<enumeration value="air"/>
</simpleType>
</attribute>
</complexType>
<element name="vehicle" type="vehicle" abstract="true"/>
<complexType name="ALVehicle" abstract="true" base="vehicle"
derivedBy="restriction">
<sequence>
<element ref="wheels" minOccurs="0"/>
</sequence>
<attribute name="powerSource">
<simpleType>
<enumeration value="animate"/>
</simpleType>
</attribute>
<attribute name="medium">
<simpleType>
<enumeration value="land"/>
</simpleType>
</attribute>
</complexType>
<element name="simpleLandVehicle" abstract="true"
type="ALVehicle" equivClass="vehicle"/>
<element name="bicycle" equivClass="simpleLandVehicle"/>
<element name="scooter" equivClass="simpleLandVehicle"/>
<element name="schoolRun">
<complexType>
<sequence>
<element name="transport">
<complexType>
<sequence>
<element ref="simpleLandVehicle"/>
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>
We have a type hierarchy with several levels vehicle:ALVehicle:...
There obviously could be other restricted types derived from vehicle.
Parallel to this are abstract elements, forming a parallel hierarchy.
When we put one of those abstract elements in a content model, the
result is to allow only the leaves of the relevant part of the
hierarchy, with their restricted types, in the instance, so in this
case the <transport> for a <schoolRun> would have to be either
<bicycle> or <scooter>.
Hope this helps.
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 Wednesday, 13 September 2000 04:34:50 UTC