04.06.2015 Views

Database Modeling and Design

Database Modeling and Design

Database Modeling and Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

42 CHAPTER 3 The Unified <strong>Modeling</strong> Language (UML)<br />

Student<br />

enrollee<br />

class<br />

Course<br />

location<br />

scheduled<br />

day<br />

meeting<br />

time<br />

Room<br />

Day<br />

Time<br />

Figure 3.5 UML n-ary relationship (parallel to Figure 2.7)<br />

Figure 3.5 illustrates another example of a n-ary relationship. The n-<br />

ary relationship may be clarified by specifying roles next to the participating<br />

classes. A Student is an enrollee in a class, associated with a given<br />

Room location, scheduled Day, <strong>and</strong> meeting Time.<br />

The concept of a primary key arises in the context of database<br />

design. Often, each row of a table is uniquely identified by the values<br />

contained in one or more columns designated as the primary key.<br />

Objects in software are not typically identified in this fashion. As a<br />

result, UML does not have an icon representing a primary key. However,<br />

UML is extensible. The meaning of an element in UML may be extended<br />

Primary key as a stereotype<br />

Composition example<br />

with primary keys<br />

Car<br />

«pk» vin<br />

mileage<br />

color<br />

Invoice<br />

«pk» inv_num<br />

customer_id<br />

inv_date<br />

1 .. *<br />

LineItem<br />

«pk» inv_num<br />

«pk» line_num<br />

description<br />

amount<br />

Figure 3.6<br />

UML constructs illustrating primary keys

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

Saved successfully!

Ooh no, something went wrong!