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

6

ERwin Methods Guide

 

 

Unification

In the example below, the “employee-id” attribute migrates to the CHILD entity through two relationships – one with EMPLOYEE and the other with SPOUSE. You might expect that the foreign key attribute would appear twice in the CHILD entity as a result. However, because the attribute “employee-id” was already present in the key area of CHILD, it is not repeated in the entity even though it is part of the key of SPOUSE.

Unification of the “Employee-id” Foreign Key Attribute

This combining of two, identical foreign key attributes migrated from the same base attribute through two or more relationships is called unification. In the example, “employee-id” was part of the primary key of CHILD (contributed by the “has” relationship from EMPLOYEE), and was also a nonkey attribute of CHILD (contributed by the “has” relationship from SPOUSE). Because both foreign key attributes are the identifiers of the same EMPLOYEE, it is desirable that the attribute appears only once. Unification is implemented automatically by ERwin when this situation occurs.

The rules that ERwin uses to implement unification include:

1.If the same foreign key is contributed to an entity more than once, without the assignment of rolenames, all occurrences unify.

2.Unification does not occur if the occurrences of the foreign key are given different rolenames.

3.If different foreign keys are assigned the same rolename, and these foreign keys are rolenamed back to the same base attribute, then unification will occur. If they are not rolenamed back to the same base attribute, there is an error in the diagram.

84 Normalization

ERwin Methods Guide

6

 

 

4.If any of the foreign keys that unify are part of the primary key of the entity, the unified attribute will remain as part of the primary key.

5.If none of the foreign keys that unify are part of the primary key, the unified attribute will not be part of the primary key.

Accordingly, you can override the unification of foreign keys when necessary by assigning rolenames. If you want the same foreign key to appear two or more times in a child entity, you can add a rolename to each foreign key attribute.

Normalization 85

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