Megan Taylor

front-end dev, volunteacher, news & data junkie, bibliophile, Flyers fan, sci-fi geek and kitteh servant

Intro to Databases: UML, UML Data Modeling

Data Modeling
How to represent data for application
Relational Model – with design principles
Database design model
– not implement by system
– translated into model of DBMS

Higher-Level Database Design Models
– Entity-Relationship Model (E/R)
– Unified Modeling Language (UML)
Data modeling subset
Both are graphical
Both can be translated to relations automatically or semi-automatically

UML Data Modeling: 5 Concepts
1. Classes
2. Associations
3. Association Classes
4. Subclasses
5. Composition and Aggregation

1. Classes
Name, attributes, methods
– For data modeling: add “pk”, drop methods
pk: primary key

2. Associations
Relationships between objects of two different classes.

Draw a line between two different classes and give it a name. In the example, relationship between Student and College, named Applied.

To introduce directionality, can add an arrow.

Multiplicity of Associations
Relationships between object of two classes
Each object of class C1 is related to at least m and at most n objects of class C2.
– m..n, m..*, 0..n, 0..*, 1..1 (default)

Example: Students must apply somewhere and may not apply to more than 5 colleges. No college takes more than 20,000 applications.
Student -> College: 1..5
College -> Student: 0..20,000

Types of Relationships
– one-to-one 0..1 on both sides
– many-to-one 0..1 on the right and * on the left
– many-to-many * on both sides
– complete every object must participate in the relationship

3. Association Classes
Relationships between objects of two classes with attributes on relationship

Attach a new class to the association

Cannot describe multiple relationships between the same two objects.

Eliminating Association Classes
Unnecessary if 0..1 or 1..1 multiplicity
Can add objects from Association Class to a Class

Associations between a class and itself
Examples: students who are siblings, Colleges with multiple campuses

4. Subclasses
Have same attributes as superclass + more, can have associations and association classes
– Superclass = generalization
– Subclass = specialization
– Incomplete (Partial) vs. Complete
– Disjoint (Exclusive) vs. Overlapping

5. Composition and Aggregation
– Composition: Objects of one class belong to objects of another class
– Aggregation: Some objects of one class belong to objects of another class

November 17, 2011 | Comments Off on Intro to Databases: UML, UML Data Modeling | Categories: Posts | Permalink

Comments are closed.