Lesson 1.4: Propagate foreign key roles and enter role names
Propagate foreign key roles from the parent entity to the child entity using the hotel dictionary. Enter roles to differentiate from an attribute with the same name.
Propagate foreign keys
In System Architect, you have complete control over when foreign keys will be propagated from the parent to the child entity.
At any time, without deleting relationship lines, you can remove foreign keys.
To remove all foreign keys
1 In the Tutorial encyclopedia, select Dictionary > Update FKs. System Architect will examine the data model, and establish foreign keys in child entities based on the relationship types between entities. This process is also referred to as "propagating foreign keys."
2 Select Dictionary > Remove FKs. System Architect will examine the data model, and remove all foreign keys in child entities based on the relationship types between entities. Foreign keys that are primary in the child entity will be changed from PK/FK back to PK.
3 Select Dictionary > Update FKs again.
After you propagate the foreign keys, the logical data model should look like the one pictured below.
Where is information about the relationship between parent and child stored?
1 Open the definition dialog for the belongs to identifying relationship line between Guest and Room (double-click it or right-click it and select Edit).
In the definition dialog that opens, notice that on the Parent Entity side of the relationship, the Parent identifies child box is toggled on. This is an identifying relationship. The primary key of the parent entity (Number) is migrated through this relationship into the child entity.
Similarly, the relationship between Guest and Vehicle is identifying. The primary key of Guest, Guest# and the migrated primary key, Number from Room, will be 'foreign' keys in the child entity Vehicle.
2 Click OK to close the belongs to relationship definition dialog.
Enter role names
Role names are used to make the function of the foreign key in the child entity/table clearer, or to differentiate it from a same-named attribute or column in the child entity.
Roles or role names are given to name a foreign key in the child entity (or table) when it is differentiated from the name of the related primary key.
To enter a role name
1 Right-click the relationship line owns between Guest and Vehicle. Select Edit.
2 Click the Foreign Keys tab.
3 In the grid, enter Guest_ID in the cell labeled Role Name, enter Guest in the cell labeled FK Column Name, and enter Guest-to-Vehicle in the text box labeled FK Constraint Name.
4 Click OK.
5 From the Dictionary menu, click Update FKs.
Notice that the PK/FK in Vehicle from Guest is notated as Guest_ID.Guest#. This nomenclature is your clue that the primary key is a role name (Guest_ID) from the attribute (Guest#).
When you create the physical data model, you will see that the constraint between the tables Guest and Vehicle is not named owns, but Guest-to-Vehicle. The foreign key in the table Vehicle is named Guest, not Guest_Number.