Structure inheritance

Build 1501 on 14/Nov/2017  This topic last edited on: 21/Mar/2016, at 18:35

Object types are organized in a hierarchy.

There is a ‘root’ object type (usually called ‘object’), with other types descending from it, and more types descending from them, and so on. When type T1 descends from type T2 it is said that T1 is ‘based on’ T2. Each type descends from only one other type. All the types descend from other types except the one and only root type.

Inheriting structure

This hierarchical system means that objects inherit their structure from other objects.

An object type T2 that descends from T1 will have all of the attributes specified by T2 plus all the attributes specified by T1.

For example, the type Document has attributes Name and Description. The type Image descends from Document and has the attributes Width and Height. Therefore, objects of the type Image will have four attributes: Name, Description, Width and Height.

Another example is the folderObject.

In the default configuration, there are several ‘base’ objects, including the folderObject, which contains a number of attributes such as name, creation date and author.  Other objects, such as stories and images are based on folderObject , which means that they automatically acquire the attribute definitions from the folderObject. (Note that they inherit the ‘structure’ not the ‘values’).

Note that both the folder and folderObject descend from the object type. The folderObject references a folder, but does not descend from it. Objects such as images, stories, etc. descend from folder objects.

object

 folder Object

         ‘Other’ objects – e.g., letter, image, story, video

 

Adding/removing common attributes

The obvious advantage of this system is that it not only eliminates the need to redefine common attributes for every object type, but makes it quite easy to add (or remove) an attribute that is common to all objects.

Let’s say the site decided to attach an attribute named ‘Section’ to every story and image in the database to indicate where the item will run in the print edition. To accomplish this, all that would be required would be to add an attribute to the folderObject.  This process – modify and upload the schema – would literally take minutes to complete.

See also

Root element