W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2000

Multiple inheritance

From: David Skogan <dskogan@cs.keele.ac.uk>
Date: Thu, 02 Mar 2000 09:49:48 -0800
Message-ID: <38BEA9BB.3F9E58BD@cs.keele.ac.uk>
To: www-xml-schema-comments@w3.org
I'm working on an ISO standard for encoding of geographic information
(ISO/CD 19118 Encoding). The idea is that the user defines his
application schema in OMG's UML (Unified Modeling Language) and encode
the data in XML. XML Schema looks so much better than DTD. 

The new type concept in XML Schema seems to map directly to the class
concept in UML. But the problem is that UML allows multiple inheritance
and XML Schema seems to ignore multiple inheritance. 

Here is an example of three class declarations, where class C inherits
from both S1 and S2: 

class S1 {
	elem1
	elem2
}

class S2 {
	elemA
	attrB
}

class C : S1, S2 {
	elemX
	attrY
}

I can create a type for S1 and S2, but how do I create a type for C?

XML doesn't allow more than one occurrence of the attributes in start
tags. So the ideal solution would be something like:

<type name="S1">
	<element name="elem1" type="C"/>
	<element name="elem2" type="string"/>
</type>

<type name="S2">
	<element name="elemX" type="S1"/>
	<attribute name="attrY" type="string"/>
</type>

<type name="C">
	<supertype source="S1" derivedBy="extension"/>
	<supertype source="S2" derivedBy="extension"/>

	<element name="elemX" type="SomeType"/>
	<attribute name="attrX" type="string"/>
</type>

Since XML Schema does not allow multiple inheritance (at least I've not
been able to find out how) I am stuck with defining element and
attribute groups for each of the supertypes and then referring them in
the subtype. This I could do with paramterised entities in DTDs as well. 

<type name="S1">
   <group name="S1_ELEMENTS">
	<element name="elem1" type="C"/>
	<element name="elem2" type="string"/>
   </group>
</type>

<type name="S2">
   <group name="S2_ELEMENTS">
	<element name="elemX" type="S1"/>
   </group>
   <attributeGroup name="S2_ATTRIBUTES">
	<attribute name="attrY" type="string"/>
   </attributeGroup>
</type>

<type name="C">
	<group ref="S1_ELEMENTS"/>
	<group ref="S2_ELEMENTS"/>
	<element name="elemX" type="SomeType"/>
	<attributeGroup ref="S2_ATTRIBUTES"/>
	<attribute name="attrX" type="string"/>
</type>

or alternatively derive from S1 and copy down S2's elements.

<type name="C2" source="S1" deriveBy="extension">
	<group ref="S2_ELEMENTS"/>
	<element name="elemX" type="SomeType"/>
	<attributeGroup ref="S2_ATTRIBUTES"/>
	<attribute name="attrX" type="string"/>
</type>


Questions:

1) Will XML Schema support multiple inheritance?
2) Does anyone have any ideas on how to represent multiple inheritance
without the support for it?

Thanks

David Skogan 


-- 
David Skogan
Computer Science Dep., Keele University, Staffordshire, ST5 5BG, United
Kingdom
dskogan@cs.keele.ac.uk, http://www.ifi.uio.no/~davids/
(phone) +44 1782 584270
Received on Thursday, 2 March 2000 04:53:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT