Modeling of custom data types - Databases: design

Modeling Custom Data Types

When modeling a database, developers sometimes have to create their own data types (domains) that will be applied to certain attributes. To do this, the IBM InfoSphere Data Architect tool has the ability to create new data types at the level of a logical database model or to separate data types (domains) into a separate model, thereby identifying a separate repository and a physical file that is focused only on storing information about user-defined data types .

Creating a model of data types is realized through the context menu of the folder "Data Models". (Data Models) by selecting the item "New/Domain Model (New/Domain Model). As a result, the developer, similar to creating a logical model, must determine the location and template of the model to be created and specify this model by additional properties that determine the authorship and model owner.

The set of user-defined data types assumes the implementation of three types:

• Atomic Domain (atomic data type) - type is determined by setting additional constraints on the pre-defined simple data type;

• List Domain (type data type) specifies, in addition to the standard constraints, a simple data type, a list of possible values ​​that should be monitored when entering information in the fields of tables of this type;

• Union Domain - A type is the union of several simple data types into a single structure, forming an aggregate representation of data with attributes of this type.

The properties of each user-defined data type are described through the Properties (properties), where the property groups are separated vertically by tabs. To create a new data type (Domain), the developer needs to be in the domain model area Package ... through the context menu, using the menu item Add Data Object (add data object), select the type of domain to be created (data type).

After selecting the domain to be created, the developer determines the main characteristics of the domain (Figure 3.45), indicating:

- Name - the name of the domain by which it will be used when it is specified to describe the attribute of the entity;

- Base Ture (base data type) is a data type whose properties are used as predefined ones;

- Length is a characteristic used primarily for character data types and determines the number of characters in the data string defined by the corresponding data type.


Defining these basic properties generates basic information but a new type of data and is specified for any kind of data type. However, a new type of data requires specifying additional characteristics that determine, for example, data limitations in the form of specifying the minimum and maximum dimensions of data, fixed values ​​of stored data, and the properties of the stored values.

If Constraint is specified for the data type, depending on the underlying data type, the developer is asked to determine the maximum and minimum values. So, for character data types, you need to specify limitations on the dimension of text strings in the form of an exact size (Length) or a minimum and a maximum value. For numerical data and the date, the developer specifies the ranges to which the stored values ​​should fall. This may include ranges that do not include and include boundaries. This allows you to build fairly accurate limits on possible values, taking into account the maximum number of options. Also, the developer can define fixed values ​​that should be used when applying the attribute of the appropriate type. The definition of these values ​​is implemented in the Constraints within the Enumeration Values ​​ area.

The Data Privacy tab gives the developer the opportunity to formalize certain values ​​(Figure 3.46) in accordance with different data formats and usage rules.


Puc. 3.46. The domain of the formalization of values ​​

Among the parameters of the formalization of values ​​can be identified as follows:

• Enforcement - the ability to apply null values ​​for an attribute specified by this data type;

• Privacy Policy The (private type of policy) is a kind of data subject area for which the usage rules are defined;

• Privacy Policy - rules of value formation.

Specifying a policy of values ​​allows the developer to determine in advance the possible values ​​and features of the constraints imposed on them. For example, for e-mail (e-mail) it is determined that a random address with variants of representation should be indicated with uppercase or lowercase characters. The same applies to other variants of formalization and presentation of values.

Similarly, a list type of data is created, for which there is no need to specify many characteristics. This is because this data type assumes the use of explicitly specified values ​​that can be represented for an attribute of this type of data. For such data types, only constraints on the possible values ​​are defined, which is also rarely used.

The combined data type is specially distinguished, which forms a set of data types that form a possible data representation (Figure 3.47). To specify this type of data, the developer determines not one basic data type, but many types, which is realized by moving selected data types from the "Available" area. (available) in the Current (selected) block of characteristics "Member Types". In this case, the Constraints (restrictions), no additional characteristics, except for specifying explicitly defined possible values, by the developer can not be specified.

Fig. 3.47. Basic properties of the combined data type


Given that there can be a fairly large number of constraints on the values ​​of the data types, the tool through the context menu of the defined data type makes it possible to create and specify them. Depending on the selected basic data type, the developer is given the opportunity to specify certain characteristics. So, for example, if you select the basic data type Date (date) and create a limit for the minimum value, the developer will be asked to indicate, in addition to the name of the constraint, its value in the appropriate date format (Figure 3.48).

Fig. 3.48. Determining the minimum value for a date


As a result, a developer can define a sufficiently large number of data types that are often used in the projected database and are not described by predefined simple data types.

thematic pictures

Ошибка в функции вывода объектов.