Geog495: GIS Database Design

10/20/05

 

Creating Class Diagram with Visio

 

From the lab,

actually there are some more (e.g. generalization, data type)

 

 

Open UML Diagram

Under the Drawing Types, choose Category\Software\UML Model Diagram

(UML is in the category of software because it’s mainly used for software engineering)

 

Choose a specific type of UML Diagram

Under the Shapes, choose UML Static Structure (this is the Class Diagram!)

 

Defining Class

Click Class element in the left and drag and drop it to grid

Right-mouse click while selecting Class, and choose Properties

Class: Type in name

Attributes: Type in name, choose data type (choose VB), and choose visibility

 

Operations: type in name getDescription with return type String

Click OK

 

This time, you create the class Section

Set up attributes and operation as shown in the diagram at page 1

Where is data type Time?

In OO, you can create your own data type.

To create data type, in the Model Explorer (lower left) right-click VB Data Types – New – Datatype, then type in Time in the Name input box

 

Now go back to properties of attribute. You will see VB: Time show up in the drop-down list.

 

Create the class CourseSchedule

Set up attribute and operation

This time, you notice that operation enroll()of CourseSchedule requires input parameter named c whose data type is Course

To set up input parameter, click Properties button while operation is selected in the categories

In the Operation Properties dialog box, choose Parameter in the left; type c in the Parameter, then choose Top Package::Course from Type drop-down list (this is how you allow method called within CourseSchedule get the value from Course)

 

 

Click OK (if you exit without clicking OK, your edit will be gone)

Click OK

 

Create class Student with attributes {name, major} and operation {planSemester} in the similar way

 

You can create Coop first and then Company

But be careful

Coop is dependent on Company

As you can see at page 1, method getCompany() returns value from Company

To allow Company to show up in the drop-down list of data type (to be set to return value of operation getCompany()), Company can be created before Coop is created

So we create Company first, and then Coop

 

The figure below shows how to set up return type of operation getDescription().

 

 

Also create class GraduateStudent and UndergraduateStudent

 

By now, you should get this (classes without relationships)

Defining Relationships

 

Relationship type between Course and Section is aggregation. Section is a part of Course.

In general, aggregation/composition can be seen as a type of association (there are options for adding such a semantic to association)

 

Click Binary Association

Drag and drop Binary Association between Section and Course

You should drag the edge of line to one hand until you see red outline for both of classes

Click the Association line

In the Association End:, you can choose type of aggregation (none becomes association, shared becomes aggregation, and composite become composition)

Also choose multiplicity

 

 

 

 

You can change display option of association line. For example, I don’t want role name (e.g. End1) not to show. While selecting association line, right-click, then choose Shape Display Options. Uncheck First end name and Second end name in the middle of the Shape Display Options dialog box. (end name = role name)

 

 

 

 

Create relationship between Section and CourseSchedule

Create relationship between CourseSchedule and Student

Create relationship between Student and Coop

in the similar way

 

Create relationship between GraduateStudent and Student

Relationship between GraduateStudent and Student is generalization

Click Generalization in the left

Make sure Triangle points to Student (superclass).

Notation indicates that GraduateStudent is generalized into Student

Do the same for UndergraduateStudent

 

Create relationship between Coop and Compnay

Relationship between Coop and Compnay is dependency

Click Dependency in the left

Make sure Arrow points to Company

Notation indicates that Coop is dependent on Company

 

 

-- The End --