Relationships

Associations represent relationships of the form:

Object X is related to Object Y

An association has a name and two endpoints.

Each endpoint has (at least) four properties:

name (optional)

aggregation: none, shared (by reference), composite (by value)

multiplicity: 1, 1..3, *, etc.

visibility: public package, protected, private

navigability: true or false

We determine the multiplicity of the relationship by fixing X and asking how many values can be substituted for Y and vice versa.

The visibility is usually private.

Set aggregation to none if you're not sure.

If one endpoint of an association is navigable, then an arrowhead appears at that endpoint and implies a client-provider relationship between the two classes with the non-navigable end being the client and the navigable end being the provider.

For example, consider the relationship:

Person X owns posession Y.

This might be modeled by the following association:

Here's the property dialog for the owns association:

Organizations

Person X is a member of Organization Y

An organization has the following attributes:

name
address
telephone
type (US Federal Government, US State Government, Foreign Government, Private Sector, other)

Hint: This might be a good place to use aggregation.

How would the following fact be represented in UML?

Smith is a member of the Masons.

Kinship

Person X is related to Person Y

Here's a problem: We might like to know the type of the relationship, where

relationship type = parent | child | spouse | sibling

But where would this information be stored?

Hint: Use an association class. (Unfortunately, this is awkward in Visio.)

What would a Java implementation look like?

Ownership

Person X possesses Posession Y

A vehicle is a posession.

A weapon is a posession.

A pet is a posession.

A vehicle has the following attributes:

VIN,
make,
model,
year,
color,
license plate (state, number, expiration),
type (auto, motorcycle, truck, bicycle, etc.)

A weapon has the following attributes:

type (bow, rifle, pistol, knife, etc.),
manufacturer,
serial number.

A pet has the following attributes:

name
type (cat, dog, bird, ...)
color
breed

Location

Person X is in area Y

Posession X is in area Y

Only authorized persons and posessions may be in an area.

Hint: represent these last statement as a constraint.

How would the following statement be represented in UML?

Smith and his dog are in the Pentagon.