280 likes | 879 Views
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
E N D
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
D# DNAME Is In E# NAME FNAME LNAME P# %TIME PNAME EER Example Participation Department 1 N Cardinality Employee N Assigned To M Project
E# Employee E# NAME: NameDom FNAME LNAME … FNAME NAME Employee LNAME DiagramsEER vs. UML Class Attributes Methods Structured Domain Entity Type vs. Class Attribute Composite Attribute vs. Structured Domain
D# DNAME E# Employee E# NAME: NameDom FNAME LNAME … NAME FNAME Department D# DNAME … Employee LNAME P# Project P# PNAME … AssignedTo %TIME %TIME PNAME EER vs. UMLComplete Diagram 1..1 Min participation (0 or some int n: n>0) 0..* Department 1 Is In N Max Cardinality N 0..* Assigned To M 0..* Project
Department D# DNAME AvgSal Member Of AvgSal Salary EER Derived Attributes - Include in Department the average salary of the employees in the department. Employee Department Class Method
Student … … Major Major_Program Major … Has Major EERMulti-valuedAttributes EER Multi-valued as Entity N 3 Student Student Major_Program Major UML 0..* 0..3
1 N Employee Name Name SSN Employee SSN Name … UML Qualified Association Dependent Name Dependent Dependent … … Dependents Of Weak Entities EER Weak Entity
Department Name No … … Aggregations Location Location Department Project No No Name No Name Project Name No … 0..* 1..1 1..* 0..* Location Name
total disjoint overlap partial U superclass subclass d o o d Name Class SSN Salary Major Dept Degree Program EmpID Example: University Database • Superclasses & Subclasses • Generalization & Specialization • Inheritance Employee U Person U Grad Student U Student U Superclass instance must always exist. Undergrad Student
Person SSN Name … Employee EmpID Salary … GradStudent DegreeProgram … Student MajorDept … UndergradStudent Class … o d UML Superclass/SubclassInheritance EER UML disjoint overlapping
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” Object-Oriented Approach Motivation
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.
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 i.e variations of the same design.
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.
Problems With the Relational Model - 2 • Schemas evolve during design. • Long running transactions: "checkout a design". • Versions; design log.
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.
Object-Oriented Concepts - 1 • Complex Objects: • sets, • bags, • lists, • arrays, • tuples.
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.
Object-Oriented Concepts - 3 • Types and/or Classes: • Type: • Interface and Implementation. • Types declared, checked at compile-time • Class: • Instances created at run-time
Object-Oriented Concepts - 4 • Class or Type Hierarchies: • Inheritance: both data and function example: student: undergraduate, graduate • Overriding, overloading, and late binding: • Polymorphism
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.
Object-Oriented Concepts - 6 • Secondary Storage Management: • Concurrency: • Recovery: • Ad Hoc Query Facility:
Review: Object • State (value) • Behavior (operations) • Signature or interface: operation name and arguments • Method or body: implementation • Identified by unique Object Identifier (OID)
Class • Group of similar objects • Class hierarchies • Inheritance • Persistence must be specified explicitly • Via entry point • Via reachability
Type Hierarchies and Inheritance(EER – superclass/subclass relationship) PERSON: Name, Address, Birthdate, Age, SSN EMPLOYEE: subtype-of PERSON: Salary, HireDate, Seniority STUDENT: subtype-of PERSON: Major, GPA EMPLOYEE: Name, Address, Birthdate, Age, SSN, Salary, HireDate, Seniority STUDENT: Name, Address, Birthdate, Age, SSN, Major, GPA
Object Data Management Group (ODMG) • Object Model • Object Definition Language (ODL) • Object Query Language (OQL) • Bindings to object-oriented programming languages • C++, Java, Smalltalk