Objectives of Inheritance

Arnold, Curt Curt.Arnold at hyprotech.com
Tue Jul 28 19:01:02 BST 1998


> First of all, I've been working with the January XML-Data DTD and
> haven't had a chance to really get my mind around XSchema, so any XML
> fragments in here will be XML-Data like instead of XSchema like.  
> 
> I've been building a fairly complex Schema using an XML-Data
> definition converted to a DTD.  I've been making extensive use of
> inheritance, and have observed that I'm using inheritance to
> accomplish three objectives.  If XSchema provides or could provides
> methods to readily accomplish these objectives, then we might be able
> to sidestep poorly defined or difficult to implement constructs (For
> example, I've avoided attempting to merge the child's content model
> with the parent's content model)
> 
> For the discussion, lets assume that I am building a Schema to contain
> mathematical correlations.  I have a generic CORRELATION element that
> has CLASSID and CODE attributes to specify the COM or Java object that
> implements the correlation, plus RANGE and PARAM elements that contain
> the range that the correlation is valid and any parameters needed for
> the implementation.  I also want to define a POLYNOMIAL element that
> is a specific type of CORRELATION that I anticipate that the
> application would implement internally.
> 
> Objective 1: Membership in a group
> 
> The first objective is to define a group that contains CORRELATION and
> any "derived" elements, so that I can use POLYNOMIAL anywhere that I
> could use CORRELATION.  This is roughly equivalent to being able to
> cast a Polynomial class pointer down to a Correlation class pointer.
> 
> Objective 2: Reusing content model
> 
> The next objective is replicate all or part of the content model of
> the parent.  If CORRELATION allows a RANGE, then I would like it to be
> natural for POLYNOMIAL to have a range.  This (and the next) objective
> are frequently accomplished in DTDs using parameter entities.
> 
> Objective 3: Reusing attributes
> 
> The next objective is replicate all or part of the attribute list of
> the parent.  If CORRELATION allows a NAME attribute, then I would like
> it to be natural for POLYNOMIAL to have a NAME.
> 
> Without really looking at what is in XSchema, it would seem that these
> could be accomplished relatively simply.  The following pseudo-XML
> demonstrates what I was thinking.
> 
> <SCHEMA>
>      <GROUP ID="CORR-DERIVED" NAME="CORRELATION and related elements">
> 	<ELEMENTTYPE ID="CORRELATION">
> 		<GROUP ID="CORR-CONTENT" OCCURS="OPTIONAL">
> 			<ELEMENTTYPE HREF="#RANGE" OCCURS="STAR"/>
> 			<ELEMENTTYPE HREF="#PARAM" OCCURS="STAR"/>
> 		</GROUP>
> 		<!--    would be necessary to have some concept of
> attribute group so you can replicate a whole
>                                           bunch of attributes     -->
> 		<ATTRIB-GROUP ID="CORR-ATTRIBS">
> 			<ATTRIBUTE ID="NAME"/>
> 			<ATTRIBUTE ID="CLASSID"/>
> 			<ATTRIBUTE ID="CODE"/>
> 			<ATTRIBUTE ID="CODEBASE"/>
> 		</ATTRIB-GROUP>
> 	<ELEMENTTYPE>
> 
> 	<ELEMENTTYPE ID="POLYNOMIAL">
> 		<!--   just borrow the content model of CORRELATION -->
> 		<GROUP HREF="#CORR-CONTENT"/>
> 		<!--     add a few new attributes to those defined by
> CORRELATION   -->
> 		<ATTRIB-GROUP ID="POLY-ATTRIB">
> 			<ATTRIB-GROUP HREF="#CORR-ATTRIBS"/>
> 			<ATTRIBUTE NAME="A"/>
> 			<ATTRIBUTE NAME="B"/>
> 			<ATTRIBUTE NAME="C"/>
> 		</ATTRIB-GROUP>
> 	</ELEMENTTYPE>
>      </GROUP>
> 
>      <ELEMENT ID="OTHER">		
>             <GROUP ID="OTHER-CONTENT">
>                <GROUP HREF="#CORR-DERIVED"/>
> 	</GROUP>
>      </ELEMENT>
> </SCHEMA>
> 
> Questions:
> 
> Are there any objectives of inheritance that I overlooked?
> 
> How readily does XSchema accomplish each of the objectives? 
> 
> Are there any minor enhancements to XSchema that would make these
> objectives more achievable?

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list