Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enhanced/Extended Relationship-Diagram

Similar presentations


Presentation on theme: "Enhanced/Extended Relationship-Diagram"— Presentation transcript:

1 Enhanced/Extended Relationship-Diagram
Indra Budi

2 Enhanced-ER (EER) Model Concepts
Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses, specialization/generalization, categories, attribute inheritance The resulting model is called the enhanced-ER or Extended ER (E2R or EER) model It is used to model applications more completely and accurately if needed It includes some object-oriented concepts, such as inheritance 2

3 Subclass Entity type describes: Example: ‘EMPLOYEE’
Type of entity The entity set Example: ‘EMPLOYEE’ Employee can be sub-grouped into: Secretary Engineer Technician Manager These are called the subclass of EMPLOYEE entity type. 3

4 Super-class EMPLOYEE entity type is the super class of engineer, secretary & technician class. Subclass represent the same mini-world entity of the superclass, but in a distinct specific role. These are also called IS-A relationships (SECRETARY IS-A EMPLOYEE, TECHNICIAN IS-A EMPLOYEE, …). Entity in a subclass must be a member of a superclass, but not vice-versa! Example…? 4

5 Type inheritance An entity that is member of a subclass inherits all attributes of the entity as a member of the superclass It also inherits all relationships 5

6 Specialization Is a process of defining a set of subclasses of an entity type (the superclass) Secretary, engineers, & technician are specialization of EMPLOYEE based on job type attribute 6

7 Cont’d May have several specialization based on different characteristics Example, EMPLOYEE can be subclass-ed into Salaried_Employee and Hourly_Employee 7

8 Fig 4.1 8

9 Notations from the EER diagram
Subset symbol ⊂ Specific attributes, or local attributes Specific relationships Superclass/subclass EMPLOYEE/Secretary resembles 1:1 relationship at the instance level, of one entity. 9

10 Fig 4.2 10

11 Benefit of Specialization
Define a set of subclasses of an entity type Establish additional specific attributes with each subclass Establish additional specific relationship types between each subclass and other entity types or other subclasses Refer to the EER diagram…! 11

12 Generalization Identify common features (attributes), and generalize into a superclass Example: truck & car can be generalized into VEHICLE Inverse of the specialization process 12

13 13

14 Constraints Constraints in Specialization Hierarchies & Lattices
Specialization in conceptual data modeling 14

15 Predicate defined subclasses
Also called condition-defined subclasses Conditioned by a defining predicate at the superclass Example, JobType = ‘Secretary’ Place attribute name on the arc 15

16 16

17 User defined subclass Membership is specified individually for each entity by the user Not by any condition that may be evaluated automatically Example: Manager subclass 17

18 Disjointness constraints
Subclasses of a specialization must be disjoint An entity can only be at most one of the subclass Look at the EER diagram Use (d) 18

19 Overlap The same entity may be a member of more than one subclass of the specialization Use the (o) Example, a person can be: A student A faculty member An alumni 19

20 20

21 Completeness constraints
Total specialization: Every entity in the superclass must be a member of some subclass Example, the Salaried_Employee and Hourly_Employee Shown using double line 21

22 Partial specialization:
Allows an entity not to belong to any subclass Example: Manager Job type Use single line 22

23 Rules Deleting entity from a superclass  deletes it also from the subclasses Inserting in a superclass, when attribute defined is filled  must insert to the proper subclass as well Inserting in superclass of total specialization  must insert into at least one subclass 23

24 Hierarchy & Lattice Hierarchy: a subclass only participates in one class/subclass relationship Example: Vehicle with Car and Trucks Lattice: a subclass can participate in more than one class/subclass relationship Example: an Engineering Manager, must be an Engineer, and also a Manager! The concept of multiple inheritance 24

25 25

26 Figure 4.7 26

27 More Explanation of the EER Diagram
Leaf node: class that has no subclasses An entity may exist in several leaves Example, a student as Graduate_Student and a Teaching_Assistant Multiple inheritance: Student_assistant But the ‘Person’ attribute is only inherited once 27

28 UNION Types Using Categories
Engineering_Manager has 3 distinct relation, each relation has 1 superclass In our new case, a subclass has a single relationship with 3 distinct superclass. The subclass represent collection of objects, which we call union type or category 28

29 Figure 4.8 29

30 Explanation A category OWNER is a union subclass of COMPANY, BANK and PERSON Use the (U) symbol Registered_Vehicle is a union subclass of Car & Truck 30

31 The difference? Engineering_Manager must exist in all three superclass: Manager, Engineer, Salaried_Employee Owner, must exist in only one superclasses Engineering_Manager: inherited all superclasses attributes Owner, selective attribute inheritance, depending on the superclass 31

32 Partial Category Partial category, may or may not participate in the relation 32

33 Total Category Must be one of the superclasses
Example: A building and a lot must be a member of PROPERTY May be represented as a generalization (d), especially when the similarity is numerous 33

34 Fig 4.10 34

35 Formal Definitions of EER Model (1)
Class C: A set of entities; could be entity type, subclass, superclass, category. Subclass S: A class whose entities must always be subset of the entities in another class, called the superclass C of the superclass/subclass (or IS-A) relationship S/C: S ⊆ C Specialization Z: Z = {S1, S2,…, Sn} a set of subclasses with same superclass G; hence, G/Si a superclass relationship for i = 1, …., n. G is called a generalization of the subclasses {S1, S2,…, Sn} Z is total if we always have: S1 ∪ S2 ∪ … ∪ Sn = G; Otherwise, Z is partial. Z is disjoint if we always have: Si ∩ S2 empty-set for i ≠ j; Otherwise, Z is overlapping. 35

36 Formal Definitions of EER Model (2)
Subclass S of C is predicate defined if predicate p on attributes of C is used to specify membership in S; that is, S = C[p], where C[p] is the set of entities in C that satisfy p A subclass not defined by a predicate is called user-defined Attribute-defined specialization: if a predicate A = ci (where A is an attribute of G and ci is a constant value from the domain of A) is used to specify membership in each subclass Si in Z Note: If ci ≠ cj for i ≠ j, and A is single-valued, then the attribute-defined specialization will be disjoint. Category or UNION type T A class that is a subset of the union of n defining superclasses D1, D2,…Dn, n>1: T ⊆ (D1 ∪ D2 ∪ … ∪ Dn) A predicate pi on the attributes of T. If a predicate pi on the attributes of Di can specify entities of Di that are members of T. If a predicate is specified on every Di: T = (D1[p1] ∪ D2[p2] ∪…∪ Dn[pn] Note: The definition of relationship type should have 'entity type' replaced with 'class'. 36

37 Alternative Diagrammatic Notations
Symbols for entity type / class, attribute and relationship Displaying attributes Notations for displaying specialization / generalization Various (min, max) notations Displaying cardinality ratios 37

38 Exercise Domain Entity Relationship Entity set
a property or description of an entity a set of possible values for an attribute. an object in the real world that is distinguishable from other objects such as the green dragon toy. an association among two or more entities. a collection of similar entities such as all of the toys in the toy department. a collection of similar relationships a key constraint that indicates that one entity can be associated with many of another entity. a key constraint that indicates that many of one entity can be associated with many of another entity. an entity that cannot be identi.ed uniquely without considering some primary key attributes of another identifying owner entity. maximum number of instances of an entity that can participate in an instance of a relationship is the least number of instances of an entity that can participate in an instance of a relationship Domain Entity Relationship Entity set One-to-many relationship Relationship set Attribute Minimum cardinality Weak entity Maximum cardinality Many-to-many relationship 38

39 Exercise (cont.) 39

40 Exercise (cont.) Develop ER-Diagram based on following facts !
Manufacturers have a name, which we may assume is unique, an address, and a phone number Product have a model number and a type (e.g., television set). Each product is made by one manufacturer, and different manufacturers may have different products with the same model number. However, you may assume that no manufacturer would have two products with the same model number. Customers are identified by their unique social security number. They have addresses, and physical addresses. Several customers may live at the same (physical) address, but we assume that no two customers have the same address. An order has a unique order number, and a date. An order is placed by one customer. For each order, there are one or more products ordered, and there is a quantity for each product on the order. 40

41 Exercise (cont.) A company database needs to store information about employees (identifed by ssn, with salary and phone as attributes), departments (identifed by dno, with dname and budget as attributes), and children of employees (with name and age as attributes). Employees work in departments; each department is managed by an employee; a child must be identi.ed uniquely by name when the parent (who is an employee; assume that only one parent works for the company) is known. We are not interested in information about a child once the parent leaves the company. Draw an ER diagram that captures that information. 41


Download ppt "Enhanced/Extended Relationship-Diagram"

Similar presentations


Ads by Google