W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 1999

XML Schema Question: understanding equivClass and abstract

From: Roger L. Costello <costello@mitre.org>
Date: Thu, 30 Dec 1999 08:32:19 -0500
Message-ID: <386B5EE3.8511AD91@mitre.org>
To: xml-dev@ic.ac.uk
CC: www-xml-schema-comments@w3c.org, "Schneider,John C." <jcs@mitre.org>, "Costello,Roger L." <costello@mitre.org>, "Cokus,Michael S." <msc@mitre.org>
Hi Folks,

I am not sure that I understand equivClass types and abstract elements. 
If I may, I will describe my understanding, and then you can tell me
where I am mistaken.  As a point of discussion, consider this XML

<?xml version="1.0"?>
<!DOCTYPE schema SYSTEM "xml-schema.dtd"[
<!ATTLIST schema xmlns:cat CDATA #IMPLIED>
<schema xmlns="http://www.w3.org/1999/XMLSchema"
    <type name="Publication">
        <element name="Title" type="string" maxOccurs="*"/>
        <element name="Author" type="string" maxOccurs="*"/>
        <element name="Date" type="date"/>
    <element name="Publication" type="cat:Publication" 
    <element name="Book" equivClass="cat:Publication">
        <type source="cat:Publication" derivedBy="extension">
            <element name="ISBN" type="string"/>
            <element name="Publisher" type="string"/>
    <element name="Magazine" equivClass="cat:Publication">
        <type source="cat:Publication" derivedBy="restriction">
            <element name="Author" type="string" maxOccurs="0"/>
    <element name="Catalogue">
            <element ref="cat:Publication" minOccurs="0" maxOccurs="*"/>

I have defined a Publication type and a Publication element which is of
type Publication.  The Publication element I declared to be abstract by
setting the abstract attribute equal to 'true'.  I then defined a Book
and Magazine element and made them equivalence classes of the
Publication type.  Lastly, I defined a Catalogue element.  It contains
zero or more Publication elements.

My understanding is that by making the Publication element abstract then
whereever it is used (as it is in the Catalogue element) in the XML
instance document it must be replaced by an equivalent element.  What I
mean by this is best explained by showing an XML instance document:

<?xml version="1.0"?>
<Catalogue xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance"
                <Title>Natural Health</Title>
                <Date>December, 1999</Date>
                <Title>Illusions The Adventures of a Reluctant
                <Author>Richard Bach</Author>
                <Publisher>Dell Publishing Co.</Publisher>
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Publisher>Harper &amp; Row</Publisher>

Notice how the Catalogue element contains Magazine and Book elements. 
The abstract Publication element that was defined to be the content of
Catalogue has been replaced by elements that are of an equivalent class
with Publication.  The Magazine and Book elements were declared to be of
an equivalent class, thus they can be used as the replacements for the
abstract Publication element.

Is this a correct understanding of abstract elements and of equivClass
types?  /Roger
Received on Thursday, 30 December 1999 08:31:02 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:45 UTC