Tamino is an XML-based information server that can manage all types of data. For data storage, Tamino offers its own internal XML store; in addition, Tamino offers the X-Node interface to Software AG's Adabas.
A Tamino schema:
Enables the datatype and structural aspects of an XML instance to be validated as it is stored in Tamino. A schema ensures that every instance stored in a doctype defined in that schema is valid with respect to that schema.
Defines document types ("doctypes") belonging to a given collection with their respective names and specifies whether they allow the storing of XML or non-XML documents.
Associates e.g. indexing or collation options with elements and attributes defined in the schema. These options are important for performance and sorting issues.
Associates mapping information with elements and attributes. This specifies whether they are stored natively in Tamino or (via X-Tension) in an external data store, e.g. Adabas or an SQL database. At query time, these elements and attributes are retrieved from the external database.
Allows you to specify trigger functions that are invoked when a document is inserted into or deleted from the Tamino data store.
This introduction gives an overview of the issues involved in defining a Tamino schema. It is organized under the following headings:
In general, a schema is a description of the structure of XML data. As stated above, a schema is necessary for much of Tamino's functionality, because in many situations Tamino needs to know how or where data is stored in order to perform its tasks optimally.
To express a schema, we need a schema definition language that embraces all the rules necessary for schema definition. For XML, several schema definition languages exist. The most commonly used schema definition languages are:
Document Type Definition (DTD);
Although DTDs are still often used to express the structure of an XML document, the newer and more powerful XML Schema standard that was defined by the W3C is the current schema standard.
This section explains the XML Schema standard, which is maintained by the W3C (World Wide Web Consortium). This standard has evolved to be the most important schema standard beside Document Type Definitions (DTD). Because it is more powerful than DTD, it can be considered as the most important standard for schema definition. Therefore Software AG decided to use XML Schema as the basis for the Tamino schema definition language (TSD).
The official XML Schema documentation is divided into three parts:
A non-normative introduction to XML Schema explaining the general concepts of XML Schema. It is recommended that you read this document first if you are completely new to XML Schema. It is easier to understand than the other two.
The part of the normative documents that describes structures. It explains the facilities that the XML Schema standard offers for describing the structure and constraining the contents of XML 1.0 documents. The schema language considerably extends the capabilities found in DTD.
The part of the normative documents that describe the facilities for defining datatypes for XML schemas. It explains the facilities for defining datatypes to be used in XML schemas as well as other XML specifications that exceed the possibilities provided by DTDs by far.
The following are some non-W3C resources on XML Schema:
An important source for information and news on XML Schema is Robin Cover's index of XML Schema materials at http://xml.coverpages.org/schemas.html
Roger L. Costello's XML Schema Tutorial can be found at http://www.xfront.com/
The schema language that is implemented in Tamino has been progressively developed, so that it now almost completely covers the XML Schema language as defined by the W3C, with Tamino-specific extensions. This special subset of XML Schema has been customized for Tamino to express (nearly) all DTD capabilities in XML Schema syntax plus the most important features for storing XML data.
In Tamino, you define a schema by the following two-step procedure:
To define a schema
Specify the structural information of the schema using the XML Schema language. This can, for example, be done with the Tamino Schema Editor. If you already have a DTD describing your doctype, the Tamino Schema Editor can convert it into a TSD Schema. Otherwise, you must write the XML Schema from scratch.
This is done using the logical part of TSD.
The appropriate elements of the logical part of the TSD are described in the sections The Logical Schema, Tamino-Specific Extensions to the Logical Schema and TSD Logical: Definitions.
Specify physical storage information (for example, for mapping and indexing) using the Tamino-specific extensions to XML Schema.
This is done using the physical part of TSD.
The appropriate elements of the physical part of the TSD are described in the sections Tamino-Specific Extensions to the Physical Schema and Tamino Extensions to XML Schema: List of Elements and Attributes.
For more information, see the section Creating a Schema.
For an overview of the Tamino schema elements and attributes, see the Tamino XML Schema Reference Guide.
TSD implements all features of the W3C XML Schema with the following exceptions:
<xs:redefine>
is not implemented.
The so-called "chameleon include" is not supported. A
chameleon include occurs when a schema without a target namespace is included,
via <xs:include>
, by a schema with a
non-absent target namespace, thus inheriting the including schema's target
namespace.
The instance attributes xsi:schemaLocation
and
xsi:noNamespaceSchemaLocation
are ignored by Tamino.
See also the section Features of the W3C XML Schema that are Not Supported by Tamino.
The following figure illustrates the schema of a patient record (doctype "patient") in a hospital database:
This tree structure can be represented by the following XML schema, which contains only structural information:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <!-- Schema for patient data. This could be a fragment of a larger DTD modeling hospital data --> <xs:element xs:name='patient'> <xs:complexType> <xs:sequence> <xs:element xs:ref='name' xs:minOccurs='0' /> <xs:element xs:ref='address' xs:minOccurs='0' /> </xs:sequence> <xs:attribute xs:name='ID' xs:type='xs:string' xs:use='optional' /> </xs:complexType> </xs:element> <xs:element xs:name='name'> <xs:complexType> <xs:sequence> <xs:element xs:ref='surname' /> <xs:element xs:ref='firstname' /> </xs:sequence> </xs:complexType> </xs:element> <xs:element xs:name='surname' xs:type='xs:string' /> <xs:element xs:name='firstname' xs:type='xs:string' /> <xs:element xs:name='address'> <xs:complexType> <xs:sequence> <xs:element xs:ref='street' xs:minOccurs='0' /> <xs:element xs:ref='housenumber' xs:minOccurs='0' /> <xs:element xs:ref='city' xs:minOccurs='0' /> <xs:element xs:ref='postcode' xs:minOccurs='0' /> <xs:element xs:ref='country' xs:minOccurs='0' /> </xs:sequence> </xs:complexType> </xs:element> <xs:element xs:name='street' xs:type='xs:string' /> <xs:element xs:name='housenumber' xs:type='xs:string' /> <xs:element xs:name='city' xs:type='xs:string' /> <xs:element xs:name='postcode' xs:type='xs:string' /> <xs:element xs:name='country' xs:type='xs:string' /> </xs:schema>
The following prefixes are used for namespaces that occur frequently throughout this documentation:
tsd: http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition
xs: http://www.w3.org/2001/XMLSchema
xsi: http://www.w3.org/2001/XMLSchema-instance
The XML Schema Recommendation allows any schema document to be extended
by arbitrary content in xs:annotation
and
xs:appinfo
elements that are children
of any other element defined by
XML
Schema.
TSD takes advantage of this feature by adding elements
tsd:schemaInfo
,
tsd:elementInfo
and
tsd:attributeInfo
as
children of the xs:schema
,
xs:element
and
xs:attribute
elements
respectively. These extensions belong to the namespace
http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition. Only
one tsd:schemaInfo
,
tsd:elementInfo
or
tsd:attributeInfo
element
is allowed for each schema, element or attribute definition respectively.
The following Tamino schema code snippet
illustrates how this mechanism can be used to incorporate schema-related
information in the xs:schema
element:
<?xml version = "1.0" encoding = "UTF-8"?> <xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema" xmlns:tsd = "http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition"> <xs:annotation> <xs:appinfo> <tsd:schemaInfo name = "patient"> <tsd:collection name = "hospital"/> </tsd:schemaInfo> </xs:appinfo> </xs:annotation> . . . </xs:schema>
Tamino-related extensions attached to a single element are specified as illustrated in the following example:
<xs:element name="surname"> <xs:annotation> <xs:appinfo> <tsd:elementInfo> . . . </tsd:elementInfo> </xs:appinfo> </xs:annotation> . . . </xs:element>
Tamino-related extensions attached to a single attribute are specified as illustrated in the following example:
<xs:attribute name="value"> <xs:annotation> <xs:appinfo> <tsd:attributeInfo> . . . </tsd:attributeInfo> </xs:appinfo> </xs:annotation> . . . </xs:attribute>
For more information concerning this topic, please refer to the following:
The section Tamino Annotations in XML Schema of the Advanced Concepts manual;
The description of the
xs:annotation
element;
The description of the
xs:appinfo
element.
The Tamino Schema Definition Language is defined by a meta schema, or schema of schemas, which is based on a subset of the W3C XML Schema standard. The TSD meta schema, i.e. the schema of schemas, can itself be expressed in terms of XML Schema.
The following applies:
The names of collections and doctypes are of type
xs:NMTOKEN
.
The names of elements and attributes are of type
xs:NCName
.
The following restriction on the lengths of names apply:
The name of a collection, doctype, element or attribute can have up to 240 bytes when encoded as UTF-8. (In practice, this corresponds to at least 80 characters.)
Defining a schema for storing data in Tamino means choosing the kind of storage (for example, native or non-XML storage or mapping to Adabas, Server Extension) and determining the kind of indexing to be performed on the data. Additionally, triggers and unique constraints can be defined. Normally, you should choose native storage to take advantage of the full power of Tamino.
However, there is more than one way to store an XML object in Tamino's XML store. You can:
Store a well-formed XML object without defining a schema.
Tamino stores it either in a special area, namely
the collection ino:etc
, or
in a user-defined collection that has been enabled especially for schemaless
data storage. Tamino applies default indexing that
allows full text retrieval.
Note:
For more information, see the section Instances Without a Defined
Schema and especially the subsection
Using User-Defined Collections
for Storing Instances Without a Defined Schema.
Directly edit the Tamino schema of which the XML object is an instance using the Tamino Schema Editor.
Directly edit the XML schema with XML schema tools, as long as you keep to the XML schema subset defined by TSD.
Read the DTD of which the XML object is an instance into the Tamino Schema Editor or any another schema conversion tool (third party software) and generate a schema based on the DTD. You can define indices in order to optimize certain types of retrieval operations. When you store an instance of the DTD in Tamino, indexing as defined in the schema is applied.
Write a schema using a text editor. This route is error-prone because of the relative complexity of the schema syntax. The instance must conform to the schema, otherwise it cannot be stored.
See also the section Tools for the Creation of Tamino Schemas.
The documentation of the TSD language comprises the section you are currently reading and the Tamino XML Schema Reference Guide, which describes each element of the language.