Manage Foreign Key MD3
Create foreign key. Edit foreign key. Update foreign key. Remove foreign key.
A frame can have a foreign key to another frame. We name them "source frame" and "target frame". The foreign key consists of one or more source frame variables that "map" one by one to the primary key variables of the target frame. Thus we recognise ordered pairs of variables. The variables of a pair must be of equal domain type and equal detailed domain specs. Developer checks this.
A source frame can have various foreign keys. It can have even have more foreign keys to the same target frame. (This must be implemented.)
Start Creation of Foreign Key
- Open frame properties.
- In Inspector tab Specification section Foreign key do one of the next:
- Right-click and select Add Foreign key.
- click the button with the plus-sign.
- A list with other frames appears. Do one of the next:
- Double-click a frame to become target.
- Select a frame and click button Insert Frame to make it target.
- In the foreign key dialog edit the details.
- Click button Ok to finish creation.
Edit Foreign Key
With the foreign key dialog open you can edit the name. It must be unique among all foreign keys of this source frame. Sections Explanation and Comments accept free text to describe modelling considerations.
Checkbox Unique can be set off or on. When on, all of these foreign keys must differ in values. So two or more frame objects cannot refer the same object in the target frame.
Checkbox Equal set can be set off or on. When on, each object of the target frame must be referred by an object of the source frame (or more of these when Unique is off).
The middle section of the dialog is to define one or more variable pairs. Variables of this source frame must become associated to primary key variables of the target frame. At the right side one or more primary key variables are displayed. To the left of each variable you can enter a source frame variable.
- click the field with the downward arrow head.
- A menu with available variables appears. Choose one by clicking.
The chosen variables are the core of the foreign key. They must be all defined and mutually different.
Update Foreign Key
- Open frame properties.
- In Inspector tab Specification section Foreign key do one of the next:
- Double-click a foreign key name.
- Select a foreign key name. Right-click and select Update Foreign key.
- A foreign key dialog appears. Edit the details.
- Click button Ok to finish the update.
Remove Foreign Key
- Open frame properties.
- In Inspector tab Specification section Foreign key do one of the next:
- Right-click a name and select Remove Foreign key.
- Select a name and click the button with the minus-sign.