XML Schema Question: understanding equivClass and abstract

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
Schema:

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

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"
          xsi:schemaLocation=
              "http://www.somewhere.org/Catalogue
              http://www.somewhere.org/Catalogue/Catalogue.xsd">
        <Magazine>
                <Title>Natural Health</Title>
                <Date>December, 1999</Date>
        </Magazine>
        <Book>
                <Title>Illusions The Adventures of a Reluctant
                       Messiah</Title>
                <Author>Richard Bach</Author>
                <Date>1977</Date>
                <ISBN>0-440-34319-4</ISBN>
                <Publisher>Dell Publishing Co.</Publisher>
        </Book>
        <Book>
                <Title>The First and Last Freedom</Title>
                <Author>J. Krishnamurti</Author>
                <Date>1954</Date>
                <ISBN>0-06-064831-7</ISBN>
                <Publisher>Harper &amp; Row</Publisher>
        </Book>
</Catalogue>

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