uml1 eer vs. uml terminology eer diagram entity type entity attribute domain composite attribute ~...

26
UML 1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance Cardinality & Participation UML Class Diagram • Class • Object • Attribute • Domain Structured Domain • Operation • Association • Link • Multiplicities

Upload: ann-hunt

Post on 24-Dec-2015

240 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 1

EER vs. UMLTerminology

EER DiagramEntity Type

EntityAttributeDomain

Composite Attribute~ [Derived Attribute]

Relationship TypeRelationship Instance

Cardinality & Participation

• UML Class Diagram• Class• Object• Attribute• Domain• Structured Domain• Operation• Association• Link• Multiplicities

Page 2: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 2

EER Example

Project

AssignedTo

Employee

Department

IsIn

%TIME

N

1

M

N

D#

DNAME

P#

E#

FNAME LNAME

PNAME

NAME

Page 3: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 3

DiagramsEER vs. UML

Employee

E#

FNAME LNAME

NAME

EmployeeE#NAME: NameDom

FNAMELNAME

Entity Type vs. ClassAttributeComposite Attribute vs. Structured Domain

Attributes

Methods

Class

StructuredDomain

Page 4: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 4

EER vs. UMLComplete Diagram

Project

AssignedTo

Department

IsIn

%TIME

N

1

M

N

D#

DNAME

P#

PNAME

Employee

E#

FNAME LNAME

NAME

EmployeeE#NAME: NameDom

FNAMELNAME

ProjectP#PNAME

DepartmentD#DNAME

…1..1

0..*

0..*

0..*AssignedTo%TIME

Min participation (0 or some int n: n>0)

Max Cardinality

Page 5: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 5

EER Derived Attributes - Include in Department the average salary of the

employees in the department.

Employee Department

Salary AvgSal

MemberOf

DepartmentD#DNAME

AvgSal

ClassMethod

Page 6: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 6

EER Multi-valued as Entity

EERMulti-valued

Attributes

Student Major_ProgramStudent HasMajor

N 3Major

Major

0..*Student……

Major_ProgramMajor…

0..3

UML

Page 7: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 7

Weak Entities

Name

Employee DependentsOf

Dependent

NameSSN

1 N

EER Weak Entity

DependentName

Employee SSNName…

Dependent……

UMLQualified Association

Page 8: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 8

Aggregations

NameNo

Project

No

ProjectNameNo…

Location

NameNo

Location

DepartmentNameNo……

LocationName

Department

0..*1..*1..10..*

Page 9: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 9

• Superclasses & Subclasses• Generalization & Specialization• Inheritance

Example: University Database

Person

Employee

Student

Grad Student

Undergrad Student

SSN

Salary

Name

Class

EmpID

DegreeProgram

MajorDept

d

o

U

UU

U

d disjoint

o overlap

total

partial

Usuperclass subclass

Superclass instance must always exist.

Page 10: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 10

EER UML

disjoint

overlapping

UML Superclass/SubclassInheritance

o

d

PersonSSNName…

EmployeeEmpIDSalary…

StudentMajorDept…

GradStudentDegreeProgram…

UndergradStudentClass…

Page 11: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 11

Object-Oriented Approach Motivation

• Object-Oriented Databases (OODB)– Add persistence to

object-oriented programming languages

• Object Relational Databases (ORDBMS)– Add user-defined

methods to relational databases

– Allow grouping of relations into more complex “objects”

Page 12: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 12

Relational is Good For

• Fixed format data• Transaction processing:

simple short transactions• Concurrency control• Recovery from crashes• Query processing and Query optimization

– relational algebra and mathematical logic operations.

Page 13: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 13

Problems

• The relational model has no notion of a single object.

• Context with the real world

e.g., spatial context.

• Aggregation functions may be desired

• The notion of re-use cannot be exploited• There may also be versions or variant

configurationsi.e variations of the same design.

Page 14: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 14

Problems With the Relational Model - 1

• Nonhomogeneous collection of design objects.

• Data Types: images, matrices, vectors; variable length.

• Temporal and/or spatial data.

• Many data types; few instances of each type.

Page 15: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 15

Problems With the Relational Model - 2

• Schemas evolve during design.

• Long running transactions: "checkout a design".

• Versions; design log.

Page 16: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 16

Problems With the Relational Model - 3

• Functions needed:

– Making a design permanent,

– Releasing design to production,

– Archiving design,

– etc.

• Library of design objects:

– minimize redundancy.

Page 17: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 17

Object-Oriented Concepts - 1

• Complex Objects:

– sets,

– bags,

– lists,

– arrays,

– tuples.

Page 18: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 18

Object-Oriented Concepts - 2

• Object Identity: identify by object id (oid) rather than by an attribute value, never changes.

• Encapsulation: Operations and Data available to user.

• Implementation hidden. No other operations available.

Page 19: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 19

Object-Oriented Concepts - 3

• Types and/or Classes:

– Type:

• Interface and Implementation.

• Types declared, checked at compile-time

– Class:

• Instances created at run-time

Page 20: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 20

Object-Oriented Concepts - 4

• Class or Type Hierarchies:

– Inheritance: both data and function

example: student: undergraduate, graduate

• Overriding, overloading, and late binding:

– Polymorphism

Page 21: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 21

Object-Oriented Concepts - 5

• Computational Completeness:

• Extensibility:

– Means to define new types.

– User types not distinguished from system types.

• Persistence:

– Not present in OO programming languages.

– Should be implicit not explicit.

Page 22: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 22

Object-Oriented Concepts - 6

• Secondary Storage Management:

• Concurrency:

• Recovery:

• Ad Hoc Query Facility:

Page 23: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 23

Review: Object

• State (value)

• Behavior (operations)– Signature or interface: operation name and

arguments – Method or body: implementation

• Identified by unique Object Identifier (OID)

Page 24: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 24

Class

• Group of similar objects

• Class hierarchies– Inheritance

• Persistence must be specified explicitly– Via entry point– Via reachability

Page 25: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 25

Type Hierarchies and Inheritance(EER – superclass/subclass relationship)

PERSON: Name, Address, Birthdate, Age, SSN

EMPLOYEE: subtype-of PERSON: Salary, HireDate, SenioritySTUDENT: subtype-of PERSON: Major, GPA

EMPLOYEE: Name, Address, Birthdate, Age, SSN, Salary, HireDate, Seniority

STUDENT: Name, Address, Birthdate, Age, SSN, Major, GPA

Page 26: UML1 EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~ [Derived Attribute] Relationship Type Relationship Instance

UML 26

Object Data Management Group (ODMG)

• Object Model

• Object Definition Language (ODL)

• Object Query Language (OQL)

• Bindings to object-oriented programming languages– C++, Java, Smalltalk