UML class diagram notation for structure models.
Class diagrams describe the logical structure of a database system.
Specifications for UML maintained by the Object Management Group, a not-for-profit consortium of computer industry members.
UML also includes notation for several other types of diagrams, including several structure diagrams, behavior diagrams, and interaction diagrams.
Classes are separately identifiable collections of things about which the organization wants to collect and store information.
Associations depict the relationship between two classes.
Multiplicities describe the minimum and maximum number of times instances of one class can be associated with instances in another class.
Classes can represent:
Organization resources: trucks, machines, buildings, cash, investments, etc.
Persons: customers, employees, etc.
Events: sales, purchases, cash disbursements, cash receipts, etc.
Abstract structures: accounts, product categories, budgets, etc.
Associations depict the (business) relationship between two classes.
Multiplicities describe the minimum and maximum number of times instances in one class can be associated with instances in another class.
Each Person owns a minimum of 0 and a maximum of many Autos. Each Auto is owned by a minimum of 1 and a maximum of 1 Person.
Attributes are data elements that describe the characteristics of instances in a class (or rows in a table).
The full specification of attributes, that is, a data dictionary, would also include data type, default value (if any), constraints on the value (such as minimum and maximum possible values), and other descriptive information.
Attributes include the primary keys that uniquely define instances of the class, foreign keys that support the links between classes shown in the associations, and other data elements for each class.
Attributes will be specified in a table listing that accompanies each class diagram.
An attribute or combination of attributes that uniquely identifies each instance in a class or row in a table.
A primary key cannot be NULL (blank).
A primary key should be controlled by the organization that assigns it so it will not change over time.
No, since there are legal restrictions and not everyone has a social security number (so the primary key might by NULL).
No, since names are not unique.
No, since a person’s phone number may change over time.
Yes, since it is easier to identify gaps and you control the number.
An attribute or combination of attributes that allows tables to be linked together.
Implements the link between classes (and resulting tables) shown by the associations.
In the following model, the primary key of the PERSON class would become a foreign key in the AUTO class to implement the association.
Customers: [Customer_Number (PK), Customer_Name, Customer_City, Customer_State, Customer_Zip, Customer_Phone]
Orders: [Order_Number (PK), Order_Date, Delivery_Date, Order_Amount, Shipping_Cost, Customer_Number (FK)]
Order_Items: [Order_Number + Product_Number (PK), Quantity_Order, Price]
Inventory: [Product_Number (PK), Product_Description, Quantity_on_Hand (Q Product Description H), Unit_of_Issue, Current_List_Price, Standard_Cost]
UML provides special notation to support other types of relationships:
Generalization.
Aggregation.
Composition.
This special notation is a form of short-hand, but each can also be modeled using the basic notation described earlier.
Generalization relationships allow grouping of things that share common characteristics. It can reduce redundancy since the shared characteristics are in the grouped class. For example, general auto characteristics would be in the Auto class/table and specific characteristics of sports cars, for example, would be in the Sports Car class/table.
Aggregation relationships describe classes that are usually connected, such as players on a team. However, players could exist separately.
Composition relationships describe classes that are connected, such as chapters in a book. In this case, chapters could not exist separately.
Use common terminology in the organization for class names.
Link classes on the diagram only when there is a clear business purpose for the relationship.
Avoid crossing lines where possible.
Use consistently sized class rectangles.
Avoid running association lines close together.
Opt for simplicity.
Focus first on the accuracy of the content, then address appearance.
Use notes to explain more complex situations.