Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Defining relationships in a CDM [Table of Contents] Defining inheritances in a CDM

PowerDesigner Conceptual Data Model User's Guide

[-] Chapter 4: Building Conceptual Data Models
[-] Defining associations in a CDM

Defining associations in a CDM

An association is a connection between entities. In the Merise modeling methodology an association is used to connect several entities that each represents clearly defined objects, but are linked by an event, which may not be so clearly represented by another entity.

Each instance of an association corresponds to an instance of each entity linked to the association.

Example

Three entities VIDEOK7, CLIENT, and STORE contain video cassette, client, and store information. They are linked by an association which represents a video cassette rental (K7RENTAL). The K7RENTAL association also contains the attributes DATE and STAFF_ID, which give the date of the rental, and the identity of the staff member who rented out the video cassette.

raster

When you generate a PDM, K7RENTED is generated as a table with five columns, STORE_ID,K7_ID, CLIENT_ID, DATE, and STAFF_ID.

raster

In PowerDesigner you can use associations exclusively in your CDM, or use both associations and relationships in the same model.

Association links

An association is connected to an entity by an association link. An Association Link symbolizes the role and the cardinality between an association and an entity.

Association properties in CDM

You can double-click any association symbol in the diagram to display its properties:

Property

Description

Name

Name of the association

Code

Reference code for the association. On the physical level, this code is generated in database scripts

Comment

Descriptive label for the association

Number

Estimated number of occurrences in the physical database for the association (the number of records)

Generate

Indicates if the association will generate a table in a PDM

Attributes

Data item attached to an association

Rules

Business rules associated with the association

Association link properties

You can double-click any association link symbol in the diagram to display its properties:

Property

Description

Entity

Entity connected by the association link

Association

Association connected by the association link

Role

Label indicating the role of the association link

Identifier

Indicates if the entity is dependent on the other entity

Cardinality

Number of occurrences (one or many) of one entity to another entity

Creating an association in a CDM

There are several ways to create an association:

At creation, an association has a default name including a number. This number is assigned in the order of creation of objects.

For more information on the different ways to create an association, see section Creating an object in chapter Managing objects in the General Features Guide.

To create an association from a diagram:

Click the Association Link tool in the Palette.

Click inside the first entity and while continuing to hold down the mouse button, drag the cursor to a second entity. Release the mouse button.

An association symbol is created between the two entities.

raster

Double-click the new association symbol in the diagram to display the association property sheet.

Type an association name and an association code.

raster

Click OK.

Creating an association link

There are several ways to create an association link between an entity and an association:

Creating an association link from a diagram:To create an association link from a diagram:

Click the Association Link tool in the Palette.

Click inside the first entity and while continuing to hold down the mouse button, drag the cursor to a second entity. Release the mouse button.

An association symbol with two associations links is created between the two entities.

raster

Double-click one of the two associations links symbols in the diagram to open the association link property sheet.

It displays the definition of the selected association link.

Type or select association link properties as required.

raster

Click OK.

Creating an association link from the list of associations linksTo create an association link from the list of associations links:

Select Model-->Links to display the list of associations links.

Click a blank line in the list.

or

Click the Add a Row tool.

An arrow appears at the beginning of the line. <None> is displayed by default in the Entity and Association columns.

raster

Click the down arrowhead in the Entity column and select an entity from the dropdown listbox.

Click the Association column to display the down arrowhead and select an association from the dropdown listbox.

Click the Cardinality of role column to display the down arrowhead and select a cardinality from the dropdown listbox.

Click OK.

A symbol for this association link is created between the entity and the association in the current diagram.

raster

Creating a reflexive association in a CDM

A reflexive association is a relationship between an entity and itself.

Example

The reflexive association Manager expresses that an employee (Manager) can manage other employees.

rasterTo create a reflexive association:

Click the Association Link tool in the Palette.

Click inside the entity and while continuing to hold down the mouse button, drag the cursor to a space next to the entity.

Click the entity.

An association symbol loops back to the same entity.

raster

Defining cardinality for an association link

Cardinality indicates the number of occurrences (one or many) that one entity has relative to another. You define the cardinality for each association link between the association and the entity.

The cardinality of an association link can have the following values:

Cardinality

Description

0,1

There can be zero or one occurrence of the entity relative to the other entity. The association is not mandatory

0,n

There can be zero or many occurrences of the entity relative to the other entity. The association is not mandatory

1,1

One occurrence of the entity has one occurrence relative to another entity. The association is mandatory

1,n

One occurrence of the entity can have many occurrences relative to another entity. The association is mandatory

You can change the default format of cardinalities from the registry:

HKEY_CURRENT_USER\Software\Sybase\PowerDesigner 9\ModelOptions\Conceptual Options
CardinalityNotation=1 (0..1) or 2 (0,1)

To define cardinality for an association link:

Double-click the association link between an association and an entity to display the association link property sheet.

raster

Select a cardinality from the Cardinality dropdown listbox.

Click OK.

You can repeat the procedure for each association link.

Defining a dependent association in a CDM

In a dependent association, one entity is partially identified by another. Each entity must have an identifier. In some cases, however, the attributes of an entity are not sufficient to identify an occurrence of the entity. For these entities, their identifiers incorporate the identifier of another entity with which they have a dependent association.

Example

An entity named Task has two entity attributes, TASK NAME and TASK COST. A task may be performed in many different projects and the task cost will vary with each project. To identify each occurrence of TASK COST the unique Task entity identifier is the compound of its Task name entity attribute and the Project number identifier from the Project entity.

raster

When you generate a PDM, the TASK table contains the PROJECT NUMBER column as a foreign key, which is also a primary key column. The primary key therefore consists of both PROJECT NUMBER and TASK NAME columns.

raster

Association link identifiers and associations

The same association can not have two identifier association links.

To define a dependent association:

Double-click an association link symbol to display the association link property sheet.

Select the Identifier check box.

Click OK.

The cardinality of the association link is enclosed in parenthesis to indicate that the association link is an identifier.

Changing an association into an associative entity

You can transform an association into an associative entity linked by two associations. The associative entity gets the name and code of the association. The two new associations handle cardinality properties.

Example

Two entities PROJECT MANAGER and CONTRACTOR are linked by the association WORKS ON PROJECT WITH:

raster

You can represent this association with an associative entity:

raster

The two new associations can be represented as follows:

rasterTo change an association into an associative entity:

Right-click an association symbol.

The association contextual menu appears.

Select Change to Entity from the contextual menu.

An associative entity that is linked to two associations replaces the original association. The associative entity takes the name of the original association.

Creating an association attribute

There are several ways to create an association attribute:

At creation, an association attribute has a default name including a number. This number is assigned in the order of creation of objects.

Using a data item as an association attribute

You can use a data item defined in the model as an attribute for an association.

Allow Reuse

If the model option Allow Reuse is not selected, you can not create an association attribute by reusing an existing data item. In this case the Add Data Items tool is not available.

To use a data item as an association attribute:

Double-click the association in the diagram to display the association property sheet.

Click the Attributes tab to display the corresponding page.

It lists attributes associated with the association.

raster

Click the Add Data items tool.

A Selection box appears listing all of the available data items.

Select one or more data items.

raster

Click OK.

The selected data items are added to the list of attributes for the association.

Click OK in each of the dialog boxes.

Creating an association attribute from the list of association attributes

You can create an association attribute directly in the list of attributes for an association. When you create an association attribute, it is automatically added to the list of data items. If you select Allow Reuse as a model option, the new data item can be used as an attribute for other associations or entities.

To create an association attribute from the list of association attributes:

Double-click the association to display the association property sheet.

Click the Attributes tab to display the corresponding page.

It lists association attributes associated with the association.

Click a blank line in the list.

or

Click the Add a Row tool.

An arrow appears at the beginning of the line.

Type an association attribute name and an association attribute code.

Automatically reuse a data item

If you select the data item model options Allow Reuse and Unique Code and you type the name of a data item that is already in use, you automatically reuse the data item.

Click OK.

Modifying the association display preferences in a CDM

You can modify the following display preferences of an association using the Tools-->Display Preferences command:

Group box

Preference

Display description

Association

Attributes

Name or code of the association*

Display Limit

Maximum number of attributes displayed in symbol

Association attributes

Data types

Data type of association attribute

Replace by domains

Domain for each association attribute. You can only display domains when the Data types check box is selected

Domains

Domain of each association attribute

Mandatory

Letter M beside each mandatory association attribute

*Displayed text depends on whether the Name or Code radio button is selected.

Display domain and data type

You can display the domain and data types in the symbol of an association. There are four display options available:

Selected checkbox

Result

Symbol

Show data types

Displays only the data type, if it exists

raster

Show domains

Displays only the domain, if it exists

raster

Show data types

Show domains

Displays both data type and domain, if they exist

raster

Show data types

Replace by domains

If domain exists and data type does not exist, then displays domain.

If domain does not exist and data type exists, then displays data type.

raster

Moving text on a relationship symbol

When a relationship symbol displays text, the text position is based on the position of handles. You can add a handle on the relationship symbol by pressing CTRL while you click the symbol.

Modifying the association link display preferences

You can modify the following display preferences of an association link using the Tools-->Display Preferences command:

Preference

Description

Cardinality

Displays the cardinality of the association link

Role

Displays the role of the association link


Defining relationships in a CDM [Table of Contents] Defining inheritances in a CDM