lt6-EERmodelling
-
Upload
haneesha-muddasani -
Category
Documents
-
view
222 -
download
0
Transcript of lt6-EERmodelling
-
7/29/2019 lt6-EERmodelling
1/30
-
7/29/2019 lt6-EERmodelling
2/30
Database Systems&Applications
Lecture 6EER concepts(cntd.)
-
7/29/2019 lt6-EERmodelling
3/30
EER Modeling
Sub classes, Super classes and Inheritance
Specialization and Generalization
Constraints and Characteristics of Specialization
and Generalization
Modeling of UNION Types Using Categories
-
7/29/2019 lt6-EERmodelling
4/30
4
Specialization
The process of defining a set of subclass of anentity type (the super class of thespecialization).
The set of subclasses that form a specializationis defined on the basis of some distinguishingcharacteristics of the entities in the super
class.{SECRETARY, ENGINEER, TECHNICIAN} is a specialization of
EMPLOYEE based on thejob type of each entity.
-
7/29/2019 lt6-EERmodelling
5/30
5
Specialization (cont.)
The same entity type may have severalspecializations based on different distinguishingcharacteristics.
The EMPLOYEE entity type may have two
specializations: Based on the methods of pay:
{SALARIED_EMPLOYEE, HOURLY_EMPLOYEE}
Based on the type of job:
{SECRETARY, ENGINEER, TECHNICIAN}
A subclass can participate in specificrelationship type
-
7/29/2019 lt6-EERmodelling
6/30
6
Diagrammatically representation ofspecialization in an EER diagram
Esuper
E1
E2
Specificattributes
Specificattributes
-
7/29/2019 lt6-EERmodelling
7/30
7
Example
SECRETARY
d
TECHNICIAN ENGINEER
d
SALARIED_EMP
HOURLY_EMP
MANAGER
EMPLOYEE
MANAGES
PROJECT
BELONGS_TO
TRADE_UNION
-
7/29/2019 lt6-EERmodelling
8/30
8
Specialization
The specialization process allows us to do thefollowing:
Define a set of subclass of an entity type
Establish additional specific attributes witheach subclass
Establish additional specific relationshiptypes between each subclass and otherentity types or other subclasses
-
7/29/2019 lt6-EERmodelling
9/30
9
Generalization
Generalization is the reverse ofspecialization process. It defines a
generalized entity type from the givenentity types.
-
7/29/2019 lt6-EERmodelling
10/30
10
Generalization (cont.)
CAR
LicensePlateNo
PriceMaxSpeed
VehicleID
NoOfPassengers
TRUCK
LicensePlateNo
PriceTonnage
VehicleID
NoOfAxies
VEHICLE
LicensePlateNoPriceVehicleID
d
CARMaxSpeed
NoOfPassengers
TRUCK Tonnage
NoOfAxies
-
7/29/2019 lt6-EERmodelling
11/30
11
Generalization (cont.)
We can view {CAR, TRUCK} as aspecialization of VEHICLE
Alternatively, we can view VEHICLE as ageneralization of CAR and TRUCK
-
7/29/2019 lt6-EERmodelling
12/30
12
Generalization (cont.)
Generalization suppresses the difference amongseveral entity types, identifying their commonfeatures, and generalize them into a single superclass of which the original types are special sub
classes.
The decision as to which process, generalization
or specialization, is more appropriate in aparticular situation is often subjective.
-
7/29/2019 lt6-EERmodelling
13/30
13
Constraints onSpecialization/Generalization
Disjoint vs. Overlap Constraints
A total specialization vs. a partial
specialization
Specialization/Generalization hierarchiesand lattices
Utilizing specialization and generalizationin Conceptual Data Modeling
-
7/29/2019 lt6-EERmodelling
14/30
14
Disjointness Constraint
Disjoint(d) constraint specifies that the subclasses of the specialization must be disjointed(an entity can be a member ofat most one of
the subclasses of the specialization)
In EER diagram, din the circle stands for
disjoint.
-
7/29/2019 lt6-EERmodelling
15/30
15
Example
EMPLOYEE
Name SSN BirthDate Address
SECRETARY
d
TypeSpeed
TECHNICIAN
TGrade
ENGINEER
EngType
d
SALARIED_EMP
Salary
HOURLY_EMP
PayScale
Disjoint subclasses Disjoint subclasses
-
7/29/2019 lt6-EERmodelling
16/30
16
Overlap Constraint
Overlap(o) specifies that the subclasses arenot constrained to be disjoint, i.e., the same(real-world) entity may be a member ofmorethan one subclass of the specialization.
Overlap is the default constraint and displayedby placing an o in the circle.
-
7/29/2019 lt6-EERmodelling
17/30
17
Completeness constraint
Completeness constraint may be total or partial.
A total specialization constraint specifies that everyentity in the super class must be a member of some
subclass in the specialization.
Represented bya double line connecting the superclass to the circle.
-
7/29/2019 lt6-EERmodelling
18/30
18
Completeness constraint(cont.)
A partial specialization allows an entity not tobelong to any of the subclasses, using a single line inEER.
e.g., if some EMPLOYEE entities, for example, sales
representatives, do not belong to any of the subclasses{SECRETARY, ENGINEER, TECHNICIAN}, then thespecialization is partial.
Represented bya single line connecting thesuperclass to the circle.
-
7/29/2019 lt6-EERmodelling
19/30
19
Four Possible Constraints
The disjointness and completenessconstraints are independent.
There are four possible constraints on
specialization: Disjoint, total
Disjoint, partial
Overlapping, total Overlapping, partial
-
7/29/2019 lt6-EERmodelling
20/30
20
Some insertion and deletion rulesapplied to specialization/generalization
Deleting an entity from a super class impliesthat it is automatically deleted from all thesubclasses to which it belongs
Inserting an entity in a super class implies thatthe entity is mandatorily inserted in allapplicable subclasses.
Inserting an entity in a super class of a total
specialization implies that the entity ismandatorily inserted in at least one of thesubclasses of the specialization.
-
7/29/2019 lt6-EERmodelling
21/30
21
The differences between the specializationand generalization
The specialization process corresponds to a top-downconceptual refinement process during conceptualschema design.
we typically start with an entity type and then definesubclasses of the entity type by successivespecialization;
The generalization process corresponds to a bottom-up conceptual synthesis.
we typically start with an entity type of subclassesand then define super classes of the entity type bysuccessive generalization.
Specialization/Generalization hierarchies
-
7/29/2019 lt6-EERmodelling
22/30
Specialization/Generalization hierarchiesand lattices
-
7/29/2019 lt6-EERmodelling
23/30
23
Modeling of UNION Types UsingCategories
It is possible that single super class/subclassrelationship has more than one super classrepresenting different entity types. In this case, thesubclass will represent a collection of objects that is (a
subset of) the UNION of distinct entity types; we callsuch a subclass a union type or a category.
A category has two or more super classes that may
represent distinct entity types, whereas non-categorysuper class/subclass relationships always have a singlesuper class.
-
7/29/2019 lt6-EERmodelling
24/30
24
Modeling of UNION Types Using Categories(cont.)
OWNER
U
PERSON
Address
Name
SSN
DriverLicenseNoBANK
BAddressBName
COMPANY
CAddressCName
OWNS
REGISTERED_VEHICLE
CYear
PurchaseDate
U
CAR TRUCK
LienOrRegular
CModel
CMake
CStyle
VehicelId
TMake TYear
TModel
Tonnage
VehicleId
M
N
-
7/29/2019 lt6-EERmodelling
25/30
25
Modeling of UNION Types Using Categories(cont.)
Two categories in car registration database.
OWNER is a subclass of the union of PERSON, BANK, andCOMPANY
REGISTRERED_VEHICLE is a subclass of the union of CARand TRUCK
An entity that is a member of OWNER must exist inonly one of the super class.
Attribute inheritance works more selectively in the caseof categories.
e.g., each OWNER entity inherits the attributes of aCOMPANY, a PERSON, or a BANK, depending on the super
class to which the entity belongs.
-
7/29/2019 lt6-EERmodelling
26/30
A Category can be total or partial?
-
7/29/2019 lt6-EERmodelling
27/30
The superclass of a category may have different key attributes.
If a category is total (not partial), it may be representedalternatively as a specialization, and the choice of which
representation to use is subjective.
A category Or A Specialization
A t O A S i li ti
-
7/29/2019 lt6-EERmodelling
28/30
28
A category Or A Specialization(cont.)
If the two classes represent the sametype of entities and share numerousattributes, including the same key
attributes, specialization/generalization ispreferred; otherwise, categorization ismore appropriate.
lname
-
7/29/2019 lt6-EERmodelling
29/30
Aggregation
Used when we haveto model arelationshipinvolving (entitysets and) a
relationship set. Aggregation allows
us to treat arelationship set as anentity set for
purposes ofparticipation in(other) relationships.
Aggregation vs. ternary relationship:y Monitors is a distinct relationship,with a descriptive attribute. (i.e., until)y Also, can say that each sponsorshipis monitored by at most one employee.
budgetdidpid
started_on
pbudget
dname
until
DepartmentsProjects Sponsors
Employees
Monitors
lotssn
since
-
7/29/2019 lt6-EERmodelling
30/30