Xinq Search and Browse tool

Database Archive Description Model

This document describes the theoretical approach for archiving a database as an XML respository and the details of the database archive description schema which is used to describe each archive. The Archive Description Model, specified in archive-spec.xsd, is comprised of 5 sections covering:

All xml documents discussed or referred to in this document are available if you wish to run the stylesheet transformations yourself or peruse the documents in more detail.

Administrative Information component outline

Yet to be documented. This component is being developed by the Biblioteque Nationale de France.

Data Model component outline

The data model component <datamodel> specifies the data model for the data contents of this archive as well as metadata that can be used for labeling and semantic information. The contents of this element are also used to derive an XML Schema document for the archived data.

Below is a schema diagram for this component:

Data Model Elements

The Data Model section has the following hierarchy:

<datamodel>
       <item>
              …
            <property>                     …
                     <composition>…</composition>
                     …
                     …
              </property>
              …
              …
       </item>
</datamodel>

The datamodel element is made up of item elements. Item elements represent entities, if thinking in entity-relationship modelling terms, or objects, if thinking in an object-oriented fashion. For example, a database holding information such as details about publications and the people involved with the publications, eg authors, editors and proof readers, could be archived as XML content structured as two separate items. For this example information could be stored in two separate items, publication and person, and described in the datamodel element as follows:

<datamodel>
       <item>
             <name>publication</name>
             <description>This item describes a publication.</description>
             <property>
                    <name>title</name>
                    <composition>simple</composition>
                    …
                    …
                    …
             </property>
             <property>
                    <name>author</name>
                    <composition>reference</composition>
                    …
                    …
                    …
             </property>
             …
             …
             …
       </item>
       <item>
             <name>person</name>
             <description>This item describes a person.</description>
             <property>
                    <name>person_id</name>
                    <composition>identifier</composition>
                    …
                    …
                    …
             </property>
             <property>
                    <name>familyname</name>
                    <composition>simple</composition>
                    <obligation>mandatory</obligation>
                    …
                    …
                    …
             </property>
             …
             …
             …
       </item>
</datamodel>

Items consist of a number of properties. A property is similar to an object attribute, in object-oriented terms, or an entity attribute, in database terms. Properties have an important Composition subelement which defines the role the property plays within the item. The Composition element has one of the following values:

Simple – the property is literal. In the example above, for the publication item there is a title property which has a composition of 'simple'. This element contains a string, being the title of the publication.
Structured – the property has sub-properties. This a a way of grouping together a set of properties. An example is provided in the next section.
Identifier – the property is literal but uniquely identifies an item. In the above example, the person item has a person_id property which has a composition of identifier. This is used to identify person items as they are being referenced from publication items. How multi-item archive description models need to be specified will be explained in more detail a little later.
Reference – the property is a reference to another item. In the above example, the reference is the author property of the publication item, which links to a person item.

The item, property and composition elements together describe (1) the components that form the structure of the archive data model and (2) how the components are linked to each other. The values of these elements hold the information used to build an xml schema which is done through a stylesheet transformation.

Following are examples of archive description documents. Both examples describe publication archives however they differ in how the information to be stored is structured.

Example 1: Single-item Model

This example archive specification document describes a single-item model, the simplest database archive models for single-table databases.

<datamodel>
       <item> <!-- only a single item is specified -->
             <name>publication</name>
             <description>This object describes a publication.</description>
             <property>
                    <name>id</name>
                    <composition>simple</composition>
                    <obligation>mandatory</obligation>
                    <repeatable>false</repeatable>
                    <type>text</type>
             </property>
             <property>
                    <name>reference</name>
                    <composition>simple</composition>
                    <obligation>mandatory</obligation>
                    <repeatable>false</repeatable>
                    <type>text</type>
             </property>
             <property>
                    <name>title</name>
                    <composition>simple</composition>
                    <obligation>mandatory</obligation>
                    <repeatable>false</repeatable>
                    <type>text</type>
             </property>
             …
             …
             …
             <property>
                    <name>person</name>
                    <composition>structured</composition> <!--the person property is made up of a group of properties-->
                    <obligation>mandatory</obligation>
                    <repeatable>true</repeatable>
                    <propertygroup> <!-- begin property group set -->
                           <property>
                                  <name>name</name>
                                  <obligation>mandatory</obligation>
                                  <type>text</type>
                                  <label>Status Date</label>
                           </property>
                           <property>
                                  <name>birthdate</name>
                                  <obligation>optional</obligation>
                                  <type>date</type>
                                  <label>Birth Date</label>
                           </property>
                           …
                           …
                           …
                           <property>
                                  <name>role</name>
                                  <obligation>mandatory</obligation>
                                  <type>enumeration</type>
                                  <label>Role</label>
                                  <valueset>
                                       <value>author</value>
                                       <value>translator</value>
                                       <value>composer</value>
                                       <value>arranger</value>
                                       <value>interpreter</value>
                                       <value>designer</value>
                                       <value>photographer</value>
                                  </valueset>
                           </property>
                    </propertygroup> <!-- ending or property group set-->
             </property>            
             …
             …
             …
       </item>
</datamodel>

The need to use a second item “person” is averted by the use of a property with a composition of type structured, which is the person property in this example. Properties which have a structured composition contain a propertygroup subelement which groups together a set of properties, as the element name suggests. Propertygroup elements are therefore declared inline, and the resulting XML version of the data will have these properties as children of a sub-element within the item element. In this single-item model, personal details for an author will be repeated in the archive if they are an author of multiple publications.The implications of this will be more evident in the resulting xml schema document which is discusssed in the next section.

Transformation of the single-item Data Model into an XML Schema

The stylesheet archive-spec_to_xsd-schema.xsl has been applied to the example archive description to convert it into an xml schema. Below are the results of this transformation.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="publist">
              <xs:annotation>
                    <xs:documentation>
                           <title>Publication List</title>
                           <description>DB archive specification file for BNF example</description>
                    </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementref="publication" maxOccurs="unbounded"/>
                    </xs:sequence>
              </xs:complexType>
       </xs:element>
       <xs:element name="publication">
              <xs:annotation>
                    <xs:documentation>
                           <label>Publication</label>
                           <description>This object describes a publication.</description>
                    </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementname="id" type="xs:string"/>
                           <xs:elementname="reference" type="xs:string"/>
                           <xs:elementname="title" type="xs:string"/>
                           <xs:elementname="subtitle" type="xs:string" minOccurs="0"/>
                           <xs:elementname="language" type="xs:string" minOccurs="0"/>
                           <xs:elementref="type"/>
                           <xs:elementname="format" type="xs:string"/>
                           <xs:elementname="subject" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
                           <xs:elementref="person" maxOccurs="unbounded"/>
                           <xs:elementname="publisher" type="xs:string"/>
                           <xs:elementname="pubdate" type="xs:string"/>
                           <xs:elementname="isbn" type="xs:string" minOccurs="0"/>
                           <xs:elementname="description" type="xs:string" minOccurs="0"/>
                    </xs:sequence>
              </xs:complexType>
       </xs:element>
       <xs:element name="person">
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementname="name"/>
                           <xs:elementname="birthdate"/>
                           <xs:elementname="deceased"/>
                           <xs:elementname="nationality"/>
                           <xs:elementref="role"/>
                    </xs:sequence>
              </xs:complexType>
       </xs:element>
       <xs:element name="role">
              <xs:simpleType>
                    <xs:restrictionbase="xs:string">
                           <xs:enumerationvalue="author"/>
                           <xs:enumerationvalue="translator"/>
                           <xs:enumerationvalue="composer"/>
                           …
                           …
                           …
                    </xs:restriction>
              </xs:simpleType>
       </xs:element>
       <xs:element name="type">
              <xs:simpleType>
                    <xs:restrictionbase="xs:string">
                           <xs:enumerationvalue="text"/>
                           <xs:enumerationvalue="image"/>
                           <xs:enumerationvalue="video"/>
                           <xs:enumerationvalue="audio"/>
                    </xs:restriction>
              </xs:simpleType>
       </xs:element>
</xs:schema>

The generated schema specifies that archive documents have a publist document root which contains only publication child elements. All information relating to a publication is stored in a publication element. This reflects the single-item model specified in the archive specification file. Person information is contained within the publication element and will be repeated in many publication elements even though the person structure and contents may be identical across multiple publications.

Even though the archive specification data model allows grouping a set of properties within a propertygroup, this information is still not an independent unit of information as it exists inside an item. Database archives using a single-item datamodel are likely to contain redundant data which therefore needs to be a consideration when choosing between a single or multi object model datamodel.

Example 2: Multi-item Model

The second example uses multiple independent items. Here is an extract of an archive specification file for an archive of publications, prescribing the multi-item model. Two items are specified, one for publication information, with item name publication, and another for the people who may be involved with publications, for example an author, with item name person.

<datamodel>     
       <!-- First Item -->
       <item>
              <name>publication</name>
              <label>Publication</label>
              <description>This object describes a publication.</description>
             <property>
                    <name>title</name>
                    <composition>simple</composition>
                    …
                    …
                    …
             </property>
             <property>
                    <name>author</name>
                    <composition>reference</composition>
                    …
                    …
                    …
             </property>
             …
             …
              …
       </item>
       <!-- Second Item -->
       <item>
              <name>person</name>
              <label>Personal Details</label>
             <property>
                    <name>person_id</name>
                    <composition>identifier</composition>
                    …
                    …
                    …
             </property>
             <property>
                    <name>familyname</name>
                    <composition>simple</composition>
                    <obligation>mandatory</obligation>
                    …
                    …
                    …
             </property>
             …
             …
             …
       </item>
</datamodel>

An advantage of a multi-item model over a single-item model is that information that is repeated across multiple items can instead be stored in independent items and then can be referred to from other items. This reduces redundancy, ease of maintenance and the size of the xml file.

Please note that person items do not include role information, like in the single-item example, as a person's role for different publications may vary. If a person was also an editor then the publication element would have an extra element named, say, editor that referred to the same person element. However it was acceptable to have role information included within the person element in the single-item model because person elements were repeated for all publications anyway.

Independent objects have a unique identifier and this identifier is used to reference the object. This mechanism is implemented using the key and keyref xml constructs. The xsl transformation stylesheet, archive-spec_to_xsd-schema.xsl, supports archive description files specifiying both single and multiple-item data models.

To use a multi-item model, items referenced by other items must have:
(1) a property sub-element which
(2) has its composition sub-element contents set to identifier.

The referencing item must have:
(1) a property sub-element which has its composition sub-element set to reference, with (2) a reference sub-element being equal to the name of the item being referred to. Here are some snippets from the multi-item implementation:

Referenced Item:

<item>
                    <name>person</name>
                    <label>Personal Details</label>
                    <property>
                           <name>person_id</name>
                           <composition>identifier</composition> <!-- flags this property as an identifier property -->
                           <obligation>mandatory</obligation>
                           <repeatable>false</repeatable>
                           <type>identifier</type>
                           <label>Unique ID</label>
                    </property>
                    …
</item>

Referencing Item:

<item>
                    <name>publication</name>
                    <label>Publication</label>
                    <description>This object describes a publication.</description>
                    <property>
                           <name>author</name>
                           <composition>reference</composition> <!-- flags this property as a reference property -->
                           <obligation>optional</obligation>
                           <repeatable>true</repeatable>
                           <reference>person</reference> <!-- identifies the item to be referenced-->
                           <label>Author of Publication</label>
                    </property>
                    …
</item>

Transformation of multi-item Data Model into XML Schema

Here is the resulting xml schema after applying the archive-spec_to_xsd-schema.xsl to the multi-item archive specification file.

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by NLA (National Library of Australia) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="publist">
              <xs:annotation>
                    <xs:documentation>
                           <title>Publication List</title>
                           <description>This system maintains a list of items sold by the NLA Bookshop.</description>
                    </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementref="publication" maxOccurs="unbounded"/>
                           <xs:elementref="person" maxOccurs="unbounded"/>
                    </xs:sequence>
              </xs:complexType>
             <xs:key name="person-key"> <!-- the person_id element will be unique across all person elements-->
                    <xs:selector xpath="person"/>
                    <xs:field xpath="person_id"/>
             </xs:key>
       </xs:element>
       <xs:element name="publication">
              <xs:annotation>
                    <xs:documentation>
                           <label>Publication</label>
                           <description>This object describes a publication.</description>
                    </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementname="title" type="xs:string"/>
                           <xs:elementname="author" minOccurs="0" maxOccurs="unbounded"/>
                           <xs:elementref="type"/>
                           <xs:elementref="subject" minOccurs="0" maxOccurs="unbounded"/>
                           <xs:elementname="serialno" type="xs:string" minOccurs="0"/>
                           <xs:elementref="status" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
              </xs:complexType>
             <xs:keyref name="person-ref" refer="person-key"> <!--the author element refers to the person-key-->
                    <xs:selector xpath="author"/>
                    <xs:field xpath="."/>
              </xs:keyref>
       </xs:element>
       <xs:element name="person">
              <xs:annotation>
                    <xs:documentation>
                           <label>Personal Details</label>
                    </xs:documentation>
              </xs:annotation>
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementname="person_id"/>
                           <xs:elementname="familyname" type="xs:string"/>
                           <xs:elementname="givenname" type="xs:string" minOccurs="0"/>
                           <xs:elementname="birthdate" type="xs:date" minOccurs="0"/>
                           <xs:elementname="deceased" type="xs:boolean" minOccurs="0"/>
                           <xs:elementname="deathdate" type="xs:date" minOccurs="0"/>
                           <xs:elementname="bio" type="xs:string" minOccurs="0"/>
                    </xs:sequence>
              </xs:complexType>
       </xs:element>
       <xs:element name="status">
              <xs:complexType>
                    <xs:sequence>
                           <xs:elementname="date"/>
                           <xs:elementname="comment"/>
                           <xs:elementref="statuscode"/>
                    </xs:sequence>
              </xs:complexType>
       </xs:element>
       <xs:element name="statuscode">
              <xs:simpleType>
                    <xs:restrictionbase="xs:string">
                           <xs:enumerationvalue="commissioned"/>
                           <xs:enumerationvalue="draft"/>
                           <xs:enumerationvalue="final"/>
                           <xs:enumerationvalue="prepress"/>
                           <xs:enumerationvalue="published"/>
                           <xs:enumerationvalue="obsolete"/>
                    </xs:restriction>
              </xs:simpleType>
       </xs:element>
       <xs:element name="type">
              <xs:simpleType>
                    <xs:restrictionbase="xs:string">
                           <xs:enumerationvalue="book"/>
                           <xs:enumerationvalue="article"/>
                           <xs:enumerationvalue="magazine"/>
                           <xs:enumerationvalue="CDRom"/>
                           <xs:enumerationvalue="website"/>
                           <xs:enumerationvalue="brochure"/>
                    </xs:restriction>
              </xs:simpleType>
       </xs:element>
       <xs:element name="subject">
              <xs:simpleType>
                    <xs:restrictionbase="xs:string">
                           <xs:enumeration value="crime"/>
                           <xs:enumerationvalue="fiction"/>
                           <xs:enumerationvalue="mystery"/>
                           <xs:enumerationvalue="romance"/>
                           <xs:enumerationvalue="history"/>
                           <xs:enumerationvalue="XML"/>
                           <xs:enumerationvalue="publicity"/>
                           <xs:enumerationvalue="technical"/>
                           <xs:enumerationvalue="entertainment"/>
                    </xs:restriction>
              </xs:simpleType>
       </xs:element>
</xs:schema>

The document root element publist has children which can be either publication or person elements. Publication elements reference person elements, which are independent items that sit outside publication elements. This is in contrast to the single-item model where the document root contain only publication elements, and where person information is embedded inside publication elements.

The stylesheet has generated key elements specifiying that the person_id sub-element of the person element has to be unique across all person elements, and has a key name person-key.

The stylesheet has also generated a corresponding keyref element specifiying that the author sub-element of the publication element refers to the person_id-key, and therefore must refer to an existing person-key value, and has a key reference name of person-ref.

An example instance of an xml archive document that conforms to the generated schema is the simplest way to explain the structure of the document we are trying to specify:

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by NLA (National Library of Australia) -->
<publist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="pub_xsd-schema.xsd">
       <publication>
              <title>Transforming XML - Course Notes</title>
              <author>S2341</ author >
             < author >333333</ author >
              <type>article</type>
              <subject>technical</subject>
              <subject>XML</subject>
             <status>
                    <date>2003-05-14</date>
                    <comment>Waiting on comments from reviewers.</comment>
                    <statuscode>draft</statuscode>
             </status>
       </publication>
       <publication>
              <title>Tennis - how to hit a big forehand</title>
             < author >123456</ author >
              <type>article</type>
              <subject>technical</subject>
              <subject>tennis</subject>
             <status>
                    <date>2003-05-14</date>
                    <comment>Waiting on comments from reviewers.</comment>
                    <statuscode>draft</statuscode>
             </status>
       </publication>
       <person>
              <person_id>S2341</person_id>
              <familyname>Berko</familyname>
              <givenname>Monica</givenname>
              <birthdate>1981-03-18</birthdate>
              <deceased>false</deceased>
             <bio>Blah de blak de blah</bio>
       </person>
       <person>
              <person_id>333333</person_id>
              <familyname>Pearce</familyname>
              <givenname>Judith</givenname>
              <birthdate>1995-05-18</birthdate>
              <deceased>false</deceased>
             <bio>Blah de blak de blah</bio>
       </person>
       <person>
              <person_id>123456</person_id>
              <familyname>Grosjean</familyname>
              <givenname>Sebastien</givenname>
              <birthdate>1982-05-18</birthdate>
              <deceased>false</deceased>
             <bio>Blah de blak de blah</bio>
       </person>   
</publist>

Search Rules component outline

Yet to be documented fully. See annotations in archive-spec.xsd

Browse Rules component outline

Yet to be documented fully. See annotations in archive-spec.xsd

Display Rules component outline

Yet to be documented fully. See annotations in archive-spec.xsd

Supporting Documents Index

All xml documents mentioned in this document are available in full:

Schema Document of archive specification

archive-spec.xsd

Single-item Model examples

Specification: pub1_archive-spec.xml

Generated schema: pub1_xsd-schema.xsd

Multi-item Model examples

Specification: pub2_archive-spec.xml

Generated schema: pub2_xsd-schema.xsd

Data file: pub2_data.xml

Stylesheet to generate schema

archive-spec_to_xsd-schema.xsl