Tamino X-Plorer Version 9.7
 —  Tamino X-Plorer  —

Working with Schemas

This document covers the following topics:

See General Commands for Managing Different Types of Objects for information on how to open, update and save schemas.


Defining a Schema

A schema is created outside the Tamino X-Plorer, using an external tool such as the Tamino Schema Editor. After a schema has been created, you can use the file containing the schema to define the schema in the Tamino database. You can also define a schema by copying an existing schema from another database.

A schema is always defined in the collection that is currently selected.

For non-XML objects, you only need to define a simple doctype in a schema. For example:

<?xml version="1.0" encoding="UTF-8"?>
<tsd:nonXML name="gif-file"/>

Start of instruction setTo define a schema

  1. In the navigation tree, select the collection that is to contain the schema.

  2. From the Schema menu, choose Define Schema.

    Or:
    Choose the following toolbar button:

    Define schema

    Or:
    From the context menu, select Define Schema.

    The Define Schema dialog box appears.

    Using the different pages, you can define a schema in one of the following ways:

  3. Select the desired page and specify all required information as described below under the corresponding heading.

  4. Choose the Define button.

Caution:
Do not specify information on different pages. When you choose the Define button, only the information on the currently shown page is used.

Define a Schema from a File

This page is used to specify the name of a file containing a schema.

Dialog box

Either specify the path and file name in the text box or choose the Select button to select the file from a dialog box.

Defining a Schema from a Database

This page is used to copy an existing schema from another database.

Dialog box

When you have previously connected to a server and database, you can select their names from the corresponding drop-down list boxes. If you want to connect to another server and database, enter the required names in the drop-down list boxes.

When the specified database is currently not connected, a dialog box appears asking whether you want to connect. Choose the Yes button to invoke the Connect dialog box. See Connecting to a Tamino Database.

When a database has been specified and is connected, the names of all of its collections are available in the Collection drop-down list box. Select the collection containing the desired schema.

When a collection has been selected, the names of all of its schemas are available in the Schema drop-down list box. Select the schema to be copied.

Top of page

Undefining a Schema

When you undefine a schema, it is deleted permanently from a collection in the database.

Warning:
All instances of all doctypes belonging to this schema will also be deleted.

Note:
If you want to undefine a schema or delete a collection, you need exclusive access to the collection. Otherwise, these commands result in an error. The error message indicates that the documents could not be locked. No user is allowed to access this collection while an "undefine schema" or "delete collection" is about to be executed. This error will also occur if you are the user who is accessing a group of instances of that collection, for example, in an XQuery result. If this error occurs, the problem will persist until the database is disconnected and connected once again. Workaround: Disconnect the database, connect it once again and then execute the command without previously accessing instances of this collection.

Start of instruction setTo undefine a schema

  1. In the navigation tree, select the schema you want to undefine.

  2. From the Schema menu, choose Undefine.

    Or:
    Choose the following toolbar button:

    Undefine

Top of page

Specifying an Instance Descriptor

An instance descriptor can be defined for each doctype which defines XML instances. It defines the information, including the sorting sequence, that is to be shown for the corresponding instances in the navigation tree. This information may be, for example, a surname, city and phone number.

An instance descriptor consists of one or more items. Each item is an X-Query expression. See X-Query User Guide and X-Query Reference Guide in the Tamino XML Server documentation for detailed information on X-Query expressions.

For non-XML instances only the ino:docname is shown in the navigation tree. If the ino:docname is not defined, the ino:id is shown instead.

Note:
The instance descriptor applies to both the main application window and the X-Query windows (it does not apply to the XQuery tool). The sorting sequence, however, is only applied in the main application window. In an X-Query window, you can specify your own sorting sequence in the query expression (for example, with the sortby clause).

Example

The following instance descriptor has been defined:

/patient/name/firstname
/patient/name/surname
/patient/therapy/medication/type/@brand

This displays the following instances in the navigation tree:

graphics/descriptor_patient_in_tree.gif

First name and surname have been found for both instances.

A medication was only found for one instance containing the following information:

<therapy>
  <medication>
     <type brand="Gallopamil" form="tablet">Beta-blocker</type>
       <dosage>Twice daily</dosage>
  </medication>
</therapy>

When an instance does not contain a value for an item defined in the instance descriptor, "<not_defined>" is shown in the navigation tree. In the above example, "<not_defined>" is shown because an "other" therapy has been used instead of a "medication" therapy:

<therapy>
  <other>
    <description>Decompression chamber</description>
    <amount>18 hrs</amount>    
  </other>
</therapy>

Start of instruction setTo specify an instance descriptor

  1. In the navigation tree, select the desired doctype.

  2. From the Schema menu, choose Instance Descriptor.

    Or:
    Choose the following toolbar button:

    Instance descriptor

    Or:
    Choose Instance Descriptor from the context menu of the instance group.

    The Specify Instance Descriptor dialog box appears, which includes the following panel:

    Dialog box

    When you are modifying an existing instance descriptor, the dialog box shows the X-Query expressions that are currently defined. The sequence of the X-Query expressions determines the sequence in which the information for an instance is shown.

  3. Edit the existing X-Query expressions or use the following buttons:

    Add

    Add a new item. You can then specify an X-Query expression (case-sensitive) in a new line.

    Delete

    Delete the selected X-Query expression.

    Up arrow

    Move the selected X-Query expression up one position.

    Down arrow

    Move the selected X-Query expression down one position.
  4. Optionally: select a cell in the Sort column and from the resulting drop-down list box, choose either ascending (A-Z) or descending (Z-A) sorting sequence for the corresponding item.

  5. Choose the OK button to save the instance descriptor.

Top of page

Specifying the Instance Fetch Options

The instance fetch options limit the number of instances that can be shown in a specific group of instances at the same time. They are always defined for a doctype.

When you expand the node for a group of instances in the navigation tree, the first pack of instances in this group is shown. You can define the number of instances that are to be fetched with each pack.

Each pack that you fetch (see Handling Very Large Amounts of Data) remains visible in the navigation tree until the maximum number of kept instances is reached. You can also define this number.

Example: when the number of instances per pack is 50 and the maximum number of kept instances is 4000, you can fetch 80 packs where each pack has 50 instances. All of these instances will be shown in the navigation tree. However, when you fetch the 81st pack, the first pack is removed from the tree to make room for the new pack.

The default values are defined in the Options dialog box. See Setting the Tamino X-Plorer and X-Query Options for further information.

Start of instruction setTo specify the instance fetch options

  1. In the navigation tree, select the group of instances for the desired doctype.

  2. From the Schema menu, choose Instance Fetch Options.

    Or:
    Choose the following toolbar button:

    Instance fetch options

    Or:
    In the context menu of the doctype, choose Instance Fetch Options.

    The Specify Instance Fetch Options dialog box appears showing the values for the currently defined fetch options.

    Dialog box

  3. Specify the following information:

    Number of instances per pack

    The number of instances that are to be fetched with each pack.

    Maximum number of kept instances

    The maximum number of instances that can be shown in a group of instances at the same time.

  4. Optionally: if you want to reset the values that are currently defined in this dialog box to the default values, choose the Reset to Default button.

  5. Choose the OK button to save the new instance fetch options.

Top of page