# Data Model Editor

A repository's data model contains a description of the classes, attributes, and relationships that it uses. The data model editor allows the data model to be modified or viewed. To start the data model editor, click on the Repository Properties tab and then choose Data Model Editor.

The default data model for new repositories created by RIB is the Basic Interoperability Data Model (BIDM). This allows a new repository to interoperate with other repositories already using this data model. Since the BIDM has gone through the IEEE standards process and is used in other types of applications, sticking with it will most likely pay off in the long run. Unless your repository needs a specialized data model, you should try to use the default. See help documentation on Interoperation for more information on how to interoperate.

## How to use the data model editor

The data model editor uses a tree structure to help visualize the repository's data model. Each class in the data model appears in its own folder. A class folder contains three subfolders : Attributes, Relationships, and Subclasses.

- Attributes: these fields contain information about a class that can be represented textually. Right-click on the attributes folder to add a new attribute. Right-click on an attribute to change its properties or to delete it. If the primary attribute is deleted, its value is set to null (see help documentation on Manage Catalog / Primary Attribute).

  Attributes can also use vocabularies. See the discussion on vocabularies below for more information. Attribute properties are as follows:

  - Description: a short (~3 line) description of the attribute. This description appears in the object editor. Its purpose is to help other repositories that interoperate with your repository understand what the attribute means.
  - Alternate name: an alternate name that will appear in the repository catalog. This property can be useful in customizing the appearance of the catalog without affecting interoperability.
  - Status: whether the attribute is required or optional. Required attributes must have a value.
  - Display: whether the attribute should appear in the catalog or not. Like the Alternate name property, this allows customizing the appearance of the catalog without affecting interoperability.
  - Cardinality: whether the attribute can have more than one value
  - Data type: this controls the type of input box that will appear in the object editor when entering a value for the attribute. Also, when an object containing the attribute is displayed in the catalog it will be wrapped in an anchor tag (<A HREF="..."> if its type is URL. The email data type will also wrap the value in a mailto: anchor tag.

  Special Attributes
  If the primary class has an Attribute called "TitleLine", its value will automatically appear in the repository table of contents next to the name of the object. If a class has an Attribute called "DateOfInformation", its value will automatically be set to the current date when an object of that class is edited or created. The field's value can still be changed manually.

- Relationships: these fields contain pointers to other classes which help describe objects from this class. The value of a relationship is a URL where the object can be found on the Internet. Right-click on the relationships folder to add a new relationship. Right-click on a relationship to change its properties or to delete it. The properties of relationships are the same as for attributes except that a relationship does not have a data type property, and it has an additional property for its destination class. The destination class dictates what class of objects the relationship should point at.

- Subclasses: RIB supports subclassing in data models. A subclass contains all of the attributes and relationships of its parent class(es). A subclass can override an attribute or relationship from its parent class(es). Right-click a Subclasses folder to add a new subclass.

The topmost folder in the data model editor, RigObject, is the parent class of all classes. By default, it contains one attribute called "Name" whose properties cannot be changed because it is used internally by RIB. This attribute also cannot be overridden by a subclass - otherwise, its properties could effectively be changed in the subclass. The RigObject node cannot be deleted.

When finished editing the data model, click the "Save" button to save the changes. The data model will be saved on the server. Any objects already present in the repository will be modified if necessary to fit the new data model. For example, if a class is deleted from the data model, all objects of that class in the repository will be deleted. Also, any relationships that pointed at objects of that class will be deleted. Warning changing the status of an attribute or relationship from "optional" to "required" does not automatically create a value for that field for objects already in the repository. This means that each object would need to be manually edited to add a value for the required attribute or relationship to ensure conformance to the data model.

## Vocabularies

A vocabulary is a collection of terms. A term usually contains less than ten words. A term can contain subterms, further refining its value. An attribute that uses a vocabulary can only contain values from that vocabulary. Add a vocabulary to an attribute by right-clicking on the attribute and then selecting "Add a vocabulary term". To delete a vocabulary term, or to add a subterm, right-click on the term.

If the vocabulary for an attribute is modified in any way, all objects in the repository that contain a value for that attribute will be modified as necessary to make sure that the existing value can be found in the new vocabulary. If it cannot be found in the new vocabulary, a depth first search will try to locate the closest match. If this search does not find a match, the value of the attribute will be set to null. The object will then appear in the top level of the catalog, if the attribute is the primary attribute. See help on Manage Catalog / Primary Attribute for information about the primary attribute.

## Importing a data model

Import a data model from another repository by clicking on the "Import" button. You will be prompted for the URL where the data model can be downloaded. When the download has completed, the data model that you were editing will be transformed into the new data model. In some cases, you will want to import the data model from a repository that you plan to interoperate with. (See help documentation on Interoperation). The URL for a repository's data model can be found on the top page of its catalog (unless it was intentionally removed from its catalog template). See help documentation on Manage Catalog / Templates.