ER/Studio - Embarcadero Technologies Product Documentation

ER/Studio - Embarcadero Technologies Product Documentation ER/Studio - Embarcadero Technologies Product Documentation

docs.embarcadero.com
from docs.embarcadero.com More from this publisher
24.12.2012 Views

USING ER/STUDIO > DEVELOPING THE LOGICAL MODEL Creating and Editing Relationships Creating and Editing Recursive Relationships A recursive relationship associates an object with itself; the object is both the parent and child. For example, you can have an employee who manages many employees and each employee is managed by one employee. The employee entity has a recursive relationship to itself. If you have a recursive relationship, you must assign rolenames to the relationship. Use the Recursive Relationship dialog to specify rolenames for a foreign key that is inherited more than once within the same entity. For example, if a recursive relationship is created where one entity is designated as both the parent and child entity, then the primary key is propagated within the entity. ER/Studio automatically opens the Recursive Relationship dialog box when it detects overlapping foreign keys in an entity. The steps for adding recursive relationships are slightly different from adding regular relationships; however, you can for edit and delete recursive relationships in the same manner as for regular relationships. 1 Click Insert > Insert Relationship, and then select a non-identifying relationship type. 2 On the Data Model Window, click the object to which you want to apply the recursive relationship, and then click it again. 3 Complete the Recursive Relationship or Recursive Relationship for Multiple Keys dialog box, and then click OK. 4 Right click anywhere on the Data Model to revert to the Selection tool. Notes • If you have a recursive relationship, the Recursive Relationship editor appears where you must assign a rolename to the primary key or to at least one attribute of the primary key. The rolename cannot be the same as the attribute or column name. In order for the foreign key to appear in the child, it must be assigned a rolename so it can be differentiated it from the native key. • If you have a recursive relationship where multiple foreign keys that are inherited more than once within the same entity, the Recursive Relationship for Multiple Keys dialog display where you specify rolenames for each foreign keys. For example, if a recursive relationship is created, where one entity is designated as both the parent and child entity, then the primary keys are propagated within the entity. • Edit the rolenames associated with the relationship by right-clicking the relationship in the Data Model Window, and then selecting Edit Rolenames. • Navigate between the parent and child object by right-clicking the object and then selecting Navigate to Parent or Navigate to Child from the shortcut menu. Creating View Relationships The steps to adding and deleting view relationships are the same as those of regular relationships. However, view relationships are a special type of relationship used to propagate attributes from an entity or a view to a view. When adding a view relationship, the end point of the relationship must be a view. View relationships cannot be edited, but they can be deleted. To determine which attributes of an entity can be propagated from the parent entity or view to the child view, use the View Editor - Column Tab. NOTE: In order for view relationships to display, you must enable the options to display views and view relationships on the View tab of the Diagram and Object Display Options dialog. Click View > Diagram and Object Display Options. EMBARCADERO TECHNOLOGIES > ER/STUDIO® 8.0.3 USER GUIDE 136

USING ER/STUDIO > DEVELOPING THE LOGICAL MODEL See Also Creating and Editing Data Base Views Creating Subtype Cluster Relationships NOTE: Subtype cluster relationships can only be represented in the logical model. When the physical model is generated from a logical model, the subtype relationship is converted to identifying relationship. A subtype cluster refers to a group of entities sharing similar characteristics that form a generalization hierarchy. In each subtype cluster, there is one parent entity, known as a supertype, and one or more subtype entities. The supertype generalizes a set of subtypes; the common characteristics of subtype entities are assigned to the supertype while the subtype entities have more specific attributes. The subtypes, also known as category entities, represent homogeneous subsets of the supertype. The attributes and relationships of the supertype entity are propagated to all of its subtypes. Discriminators, an attribute of the subtype, distinguish the entities in the subtype from each other. Other than recognizing a generalization hierarchy, an important issue with subtyping is to decide how to implement a subtype cluster in the physical model. Sometimes it is best to project subtypes into the supertype, representing the entire cluster as a single, generalized entity. Other times, you may need the granularity of separate subtype entities, choosing to implement the subtypes and supertype one-for-one or rolling the supertype down into the subtypes. During the logical model phase, you should search for hierarchies that can reveal a more general approach to aggregating attributes into entities. By addressing the general case, you can design a more flexible and extensible approach to storing data. The use of subtyping is a powerful tool in identifying and portraying such generalizations. EMBARCADERO TECHNOLOGIES > ER/STUDIO® 8.0.3 USER GUIDE 137

USING <strong>ER</strong>/STUDIO > DEVELOPING THE LOGICAL MODEL<br />

Creating and Editing Relationships<br />

Creating and Editing Recursive Relationships<br />

A recursive relationship associates an object with itself; the object is both the parent and child. For example, you can<br />

have an employee who manages many employees and each employee is managed by one employee. The employee<br />

entity has a recursive relationship to itself.<br />

If you have a recursive relationship, you must assign rolenames to the relationship. Use the Recursive Relationship<br />

dialog to specify rolenames for a foreign key that is inherited more than once within the same entity. For example, if a<br />

recursive relationship is created where one entity is designated as both the parent and child entity, then the primary<br />

key is propagated within the entity. <strong>ER</strong>/<strong>Studio</strong> automatically opens the Recursive Relationship dialog box when it<br />

detects overlapping foreign keys in an entity.<br />

The steps for adding recursive relationships are slightly different from adding regular relationships; however, you can<br />

for edit and delete recursive relationships in the same manner as for regular relationships.<br />

1 Click Insert > Insert Relationship, and then select a non-identifying relationship type.<br />

2 On the Data Model Window, click the object to which you want to apply the recursive relationship, and then click<br />

it again.<br />

3 Complete the Recursive Relationship or Recursive Relationship for Multiple Keys dialog box, and then click<br />

OK.<br />

4 Right click anywhere on the Data Model to revert to the Selection tool.<br />

Notes<br />

• If you have a recursive relationship, the Recursive Relationship editor appears where you must assign a<br />

rolename to the primary key or to at least one attribute of the primary key. The rolename cannot be the same as<br />

the attribute or column name. In order for the foreign key to appear in the child, it must be assigned a rolename<br />

so it can be differentiated it from the native key.<br />

• If you have a recursive relationship where multiple foreign keys that are inherited more than once within the same<br />

entity, the Recursive Relationship for Multiple Keys dialog display where you specify rolenames for each foreign<br />

keys. For example, if a recursive relationship is created, where one entity is designated as both the parent and<br />

child entity, then the primary keys are propagated within the entity.<br />

• Edit the rolenames associated with the relationship by right-clicking the relationship in the Data Model Window,<br />

and then selecting Edit Rolenames.<br />

• Navigate between the parent and child object by right-clicking the object and then selecting Navigate to Parent or<br />

Navigate to Child from the shortcut menu.<br />

Creating View Relationships<br />

The steps to adding and deleting view relationships are the same as those of regular relationships. However, view<br />

relationships are a special type of relationship used to propagate attributes from an entity or a view to a view. When<br />

adding a view relationship, the end point of the relationship must be a view. View relationships cannot be edited, but<br />

they can be deleted. To determine which attributes of an entity can be propagated from the parent entity or view to the<br />

child view, use the View Editor - Column Tab.<br />

NOTE: In order for view relationships to display, you must enable the options to display views and view<br />

relationships on the View tab of the Diagram and Object Display Options dialog. Click View ><br />

Diagram and Object Display Options.<br />

EMBARCAD<strong>ER</strong>O TECHNOLOGIES > <strong>ER</strong>/STUDIO® 8.0.3 US<strong>ER</strong> GUIDE 136

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!