Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
75
Добавлен:
22.03.2015
Размер:
468.74 Кб
Скачать

3

ERwin Methods Guide

 

 

Rolenames

When foreign keys migrate from the parent entity in a relationship to the child entity, they are serving double-duty in the model in terms of stated business rules. To understand both roles, it is sometimes helpful to rename the migrated key to show the role it plays in the child entity. This name assigned to a foreign key attribute is called a rolename. In effect, a rolename declares a new attribute, whose name is intended to describe the business statement embodied by the relationship that contributes the foreign key.

Rolename Example

The foreign key attribute of PLAYER, “player-team-id.team-id,” shows us the syntax for defining and displaying a rolename. The first half (before the period) is the rolename. The second half is the original name of the foreign key, sometimes called the base name.

Note: Rolenames are also used to model compatibility with legacy data models, where the foreign key was often named differently than the primary key.

Rolenames migrate across relationships just like any other attributes. For example, suppose that we extend the example to show which PLAYERs have scored in various games throughout the season. The “player-team-id” rolename migrates to the SCORING PLAY entity (along with any other primary key attributes in the parent entity), as shown below.

Diagram Showing Migration of a Rolenamed FK Attribute

36 The Key-Based Model

Соседние файлы в папке Базы данных