uml1 eer vs. uml terminology eer diagram entity type entity attribute domain composite attribute ~...
TRANSCRIPT
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
UML 2
EER Example
Project
AssignedTo
Employee
Department
IsIn
%TIME
N
1
M
N
D#
DNAME
P#
E#
FNAME LNAME
PNAME
NAME
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
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
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
UML 6
EER Multi-valued as Entity
EERMulti-valued
Attributes
Student Major_ProgramStudent HasMajor
N 3Major
Major
0..*Student……
Major_ProgramMajor…
0..3
UML
UML 7
Weak Entities
Name
Employee DependentsOf
Dependent
NameSSN
1 N
EER Weak Entity
DependentName
Employee SSNName…
Dependent……
UMLQualified Association
UML 8
Aggregations
NameNo
Project
No
ProjectNameNo…
Location
NameNo
Location
DepartmentNameNo……
LocationName
Department
0..*1..*1..10..*
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.
UML 10
EER UML
disjoint
overlapping
UML Superclass/SubclassInheritance
o
d
PersonSSNName…
EmployeeEmpIDSalary…
StudentMajorDept…
GradStudentDegreeProgram…
UndergradStudentClass…
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”
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.
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.
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.
UML 15
Problems With the Relational Model - 2
• Schemas evolve during design.
• Long running transactions: "checkout a design".
• Versions; design log.
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.
UML 17
Object-Oriented Concepts - 1
• Complex Objects:
– sets,
– bags,
– lists,
– arrays,
– tuples.
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.
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
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
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.
UML 22
Object-Oriented Concepts - 6
• Secondary Storage Management:
• Concurrency:
• Recovery:
• Ad Hoc Query Facility:
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)
UML 24
Class
• Group of similar objects
• Class hierarchies– Inheritance
• Persistence must be specified explicitly– Via entry point– Via reachability
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
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