Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enhanced/Extended Relationship-Diagram Indra Budi

Similar presentations

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

1 Enhanced/Extended Relationship-Diagram Indra Budi

2 Fakultas Ilmu Komputer UI 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

3 Fakultas Ilmu Komputer UI 3 Subclass Entity type describes: 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.

4 Fakultas Ilmu Komputer UI 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…?

5 Fakultas Ilmu Komputer UI 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

6 Fakultas Ilmu Komputer UI 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

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

8 Fakultas Ilmu Komputer UI 8 Fig 4.1

9 Fakultas Ilmu Komputer UI 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.

10 Fakultas Ilmu Komputer UI 10 Fig 4.2

11 Fakultas Ilmu Komputer UI 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…!

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

13 Fakultas Ilmu Komputer UI 13

14 Fakultas Ilmu Komputer UI 14 Constraints Constraints in Specialization Hierarchies & Lattices Specialization in conceptual data modeling

15 Fakultas Ilmu Komputer UI 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

16 Fakultas Ilmu Komputer UI 16

17 Fakultas Ilmu Komputer UI 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

18 Fakultas Ilmu Komputer UI 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)

19 Fakultas Ilmu Komputer UI 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

20 Fakultas Ilmu Komputer UI 20

21 Fakultas Ilmu Komputer UI 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

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

23 Fakultas Ilmu Komputer UI 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

24 Fakultas Ilmu Komputer UI 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

25 Fakultas Ilmu Komputer UI 25

26 Fakultas Ilmu Komputer UI 26 Figure 4.7

27 Fakultas Ilmu Komputer UI 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

28 Fakultas Ilmu Komputer UI 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

29 Fakultas Ilmu Komputer UI 29 Figure 4.8

30 Fakultas Ilmu Komputer UI 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

31 Fakultas Ilmu Komputer UI 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

32 Fakultas Ilmu Komputer UI 32 Partial Category Partial category, may or may not participate in the relation

33 Fakultas Ilmu Komputer UI 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

34 Fakultas Ilmu Komputer UI 34 Fig 4.10

35 Fakultas Ilmu Komputer UI 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.

36 Fakultas Ilmu Komputer UI 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'.

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

38 Fakultas Ilmu Komputer UI 38 Exercise  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. 10. maximum number of instances of an entity that can participate in an instance of a relationship 11. is the least number of instances of an entity that can participate in an instance of a relationship a. Domain b. Entity c. Relationship d. Entity set e. One-to-many relationship f. Relationship set g. Attribute h. Minimum cardinality i. Weak entity j. Maximum cardinality k. Many-to-many relationship

39 Fakultas Ilmu Komputer UI 39 Exercise (cont.)

40 Fakultas Ilmu Komputer UI 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 email addresses, and physical addresses. Several customers may live at the same (physical) address, but we assume that no two customers have the same email 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.

41 Fakultas Ilmu Komputer UI 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.

Download ppt "Enhanced/Extended Relationship-Diagram Indra Budi"

Similar presentations

Ads by Google