You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

If required, you can extend the SimpleOne data model by adding new columns to existing tables. When doing so it is important to remember that the updated data model will apply to all child tables, since the new columns will be inherited. When it is unwanted, use the following data model extension methods:

  • Inheritance
  • Record extended model

Inheritance


Inheritance (also called table extension) allows to create child data structures which inherit all attributes of the parent structure and supplement them with their own attributes. This allows to avoid big number of duplicate columns and build an hierarchical structure of objects in which each following child element is a narrower subset. The inheritance can be multi-level, i.e. a child table can be a parent table for other tables.

When using inheritance keep in mind that many engines have an option to work within child entities as well. 

The inherited values and logic related to the table can be overridden (ссфлку добавить) on the level of a child table.

The inheritance mechanism works well when there is a small number of child tables that have a lot of common attributes between them. However, as the number of child pages increases and the number of common attributes decreases, managing such data structure becomes difficult.

A data model with an extended, complex structure has the following drawbacks:

  • Too much storage space is required to store the records.
  • The scripts are executed slower.
  • It becomes difficult to configure features related to a table, such as data import, form view configuration, etc.

An example of  Примером такой таблицы является каталог запросов: он состоит из родительской таблицы для каталога и записей в таблице для каждого шаблона запроса с определенными атрибутами.

Расширенная модель записи


При использовании расширенной модели записи (REM) не создаются новые таблицы и колонки, а создаются атрибуты данных, выборочно применяемые к определенным записям таблицы. При применении расширенной модели к той или иной записи, для нее создается вспомогательный набор записей, в котором хранится информация по значениям конкретных атрибутов. Таким образом у записи есть атрибуты, полученные от таблицы и, дополнительно, атрибуты, получаемые из расширенной модели (REM-атрибуты).

Благодаря REM-атрибутам можно обойти ограничения механизма наследования, добавляя к записям атрибуты, которые не будут наследоваться дочерними таблицами. Без REM атрибутов пришлось бы создавать большое количество уровней наследования, на которых родитель отличается от потомка наличием всего одного поля. Кроме того, REM-атрибуты могут объединяться в REM-модели, позволяющие осуществлять категоризацию объектов из одной таблицы. Примером такого использования является каталог услуг.

  • No labels