EER vs UML Terminology EER Diagram Entity Type

  • Slides: 26
Download presentation
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute Domain Composite Attribute ~

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

EER Example E# N Is In 1 D# Department DNAME Employee N NAME FNAME

EER Example E# N Is In 1 D# Department DNAME Employee N NAME FNAME Assigned To M Project LNAME %TIME UML P# PNAME 2

Diagrams EER vs. UML Class E# Employee NAME FNAME Structured Domain E# NAME: Name.

Diagrams EER vs. UML Class E# Employee NAME FNAME Structured Domain E# NAME: Name. Dom FNAME LNAME Attributes Methods … LNAME Entity Type vs. Class Attribute Composite Attribute vs. Structured Domain UML 3

Department EER vs. UML Complete Diagram D# DNAME … 1. . 1 Min participation

Department EER vs. UML Complete Diagram D# DNAME … 1. . 1 Min participation (0 or some int n: n>0) D# E# N Employee Department 1 Is In Employee NAME DNAME Max Cardinality N P# Assigned To LNAME %TIME PNAME UML E# NAME: Name. Dom FNAME LNAME … 0. . * M Project FNAME 0. . * Assigned. To %TIME Project P# PNAME … 4

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

EER Derived Attributes - Include in Department the average salary of the employees in the department. Employee Member Of Salary Class Method Department Avg. Sal Department D# DNAME Avg. Sal UML 5

EER Multi-valued Attributes Student Major EER Multi-valued as Entity Major Student N Has Major

EER Multi-valued Attributes Student Major EER Multi-valued as Entity Major Student N Has Major 3 Major_Program UML Student … … UML 0. . * Major_Program 0. . 3 Major … 6

Weak Entities EER Weak Entity Employee Name 1 Dependent Name SSN Employee SSN Name

Weak Entities EER Weak Entity Employee Name 1 Dependent Name SSN Employee SSN Name … Dependent Name UML Dependents Of N UML Qualified Association Dependent … … 7

Aggregations Location Department Project Name 0. . * No … UML No No No

Aggregations Location Department Project Name 0. . * No … UML No No No Name 1. . 1 Location Name 1. . * 0. . * Department Name No … … 8

Example: University Database Emp. ID SSN Salary d disjoint o overlap superclass Employee partial

Example: University Database Emp. ID SSN Salary d disjoint o overlap superclass Employee partial subclass U Degree Program o U Name Grad Student U Person total U • Superclasses & Subclasses • Generalization & Specialization • Inheritance Superclass instance must always exist. d U Student Major Dept Undergrad Student Class UML 9

UML Superclass/Subclass Inheritance Employee Emp. ID Salary … Person SSN Name … UML Student

UML Superclass/Subclass Inheritance Employee Emp. ID Salary … Person SSN Name … UML Student Major. Dept … EER UML disjoint d overlapping o Grad. Student Degree. Program … Undergrad. Student Class … 10

Object-Oriented Approach Motivation • Object-Oriented Databases (OODB) – Add persistence to object-oriented programming languages

Object-Oriented Approach Motivation • Object-Oriented Databases (OODB) – Add persistence to object-oriented programming languages UML • Object Relational Databases (ORDBMS) – Add user-defined methods to relational databases – Allow grouping of relations into more complex “objects” 11

Relational is Good For • Fixed format data • Transaction processing: simple short transactions

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. UML 12

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

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 configurations UML i. e variations of the same design. 13

Problems With the Relational Model - 1 • Nonhomogeneous collection of design objects. •

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. UML 14

Problems With the Relational Model - 2 • Schemas evolve during design. • Long

Problems With the Relational Model - 2 • Schemas evolve during design. • Long running transactions: "checkout a design". • Versions; design log. UML 15

Problems With the Relational Model - 3 • Functions needed: – Making a design

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. UML 16

Object-Oriented Concepts - 1 • Complex Objects: – sets, – bags, – lists, –

Object-Oriented Concepts - 1 • Complex Objects: – sets, – bags, – lists, – arrays, – tuples. UML 17

Object-Oriented Concepts - 2 • Object Identity: identify by object id (oid) rather than

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. UML 18

Object-Oriented Concepts - 3 • Types and/or Classes: – Type: • Interface and Implementation.

Object-Oriented Concepts - 3 • Types and/or Classes: – Type: • Interface and Implementation. • Types declared, checked at compile-time – Class: • Instances created at run-time UML 19

Object-Oriented Concepts - 4 • Class or Type Hierarchies: – Inheritance: both data and

Object-Oriented Concepts - 4 • Class or Type Hierarchies: – Inheritance: both data and function example: student: undergraduate, graduate • Overriding, overloading, and late binding: – Polymorphism UML 20

Object-Oriented Concepts - 5 • Computational Completeness: • Extensibility: – Means to define new

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. UML 21

Object-Oriented Concepts - 6 • Secondary Storage Management: • Concurrency: • Recovery: • Ad

Object-Oriented Concepts - 6 • Secondary Storage Management: • Concurrency: • Recovery: • Ad Hoc Query Facility: UML 22

Review: Object • State (value) • Behavior (operations) – Signature or interface: operation name

Review: Object • State (value) • Behavior (operations) – Signature or interface: operation name and arguments – Method or body: implementation • Identified by unique Object Identifier (OID) UML 23

Class • Group of similar objects • Class hierarchies – Inheritance • Persistence must

Class • Group of similar objects • Class hierarchies – Inheritance • Persistence must be specified explicitly – Via entry point – Via reachability UML 24

Type Hierarchies and Inheritance (EER – superclass/subclass relationship) PERSON: Name, Address, Birthdate, Age, SSN

Type Hierarchies and Inheritance (EER – superclass/subclass relationship) PERSON: Name, Address, Birthdate, Age, SSN EMPLOYEE: subtype-of PERSON: Salary, Hire. Date, Seniority STUDENT: subtype-of PERSON: Major, GPA EMPLOYEE: Name, Address, Birthdate, Age, SSN, Salary, Hire. Date, Seniority STUDENT: Name, Address, Birthdate, Age, SSN, Major, GPA UML 25

Object Data Management Group (ODMG) • • Object Model Object Definition Language (ODL) Object

Object Data Management Group (ODMG) • • Object Model Object Definition Language (ODL) Object Query Language (OQL) Bindings to object-oriented programming languages – C++, Java, Smalltalk UML 26