Database Development Supertype, Subtype, and Business Rules Powered by DeSiaMore 1.

Slides:



Advertisements
Similar presentations
1 © Prentice Hall, 2002 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Advertisements

Chapter 4: The Enhanced ER Model and Business Rules
Enhanced E-R Models and Business Rules
1 Chapter 4 The Enhanced ER Model and Business Rules.
Chapter 3: The Enhanced E-R Model
Basic notation for supertype/subtype relationships
Enhanced Entity-Relationship Modeling. Strong and Weak Entity Types Strong entity: Each object is uniquely identifiable using primary key of that entity.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: The Enhanced E-R Model Modern Database Management 10 th Edition Jeffrey A. Hoffer,
Chapter 3  Define terms  Understand use of supertype/subtype relationships  Understand use of specialization and generalization techniques  Specify.
1 © Prentice Hall, 2002 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 CHAPTER 4: THE ENHANCED E-R MODEL Modern Database Management 11 th Edition Jeffrey.
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
1 © Prentice Hall, 2002 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Chapter 4 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Use of supertype/subtype relationships Use of supertype/subtype.
Chapter 3: Modeling Data in the Organization
Chapter 4: The Enhanced ER Model and Business Rules
Enhanced Entity-Relationship Modeling
Chapter 3: Modeling Data in the Organization
CHAPTER 2: MODELING DATA IN THE ORGANIZATION © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey.
The Enhanced E-R (EER) Model
IS 4420 Database Fundamentals Chapter 4: The Enhanced ER Model and Business Rules Leon Chen.
Chapter 3 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Importance of data modeling Importance of data modeling Write good.
Chapter 4: The Enhanced E-R Model and Business Rules
Chapter 4 1 Chapter 4: The Enhanced ER Model and Business Rules.
1 Chapter 4 Enhanced E-R Model. 2 Supertypes and Subtypes Subtype: A subgrouping of the entities in an entity type which has attributes that are distinct.
Chapter 3: The Enhanced E-R Model
1 Chapter 4: The Enhanced ER Model and Business Rules.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: The Enhanced E-R Model Modern Database Management 10 th Edition Jeffrey A. Hoffer,
© 2007 by Prentice Hall (Hoffer, Prescott & McFadden) 1 The Enhanced Entity Relationship Diagrams (E-ERDs)
Chapter 2: Modeling Data in the Organization
Chapter 4: The Enhanced ER Model and Business Rules
Database Systems: Enhanced Entity-Relationship Modeling Dr. Taysir Hassan Abdel Hamid.
Chapter 4 1 Chapter 4: The Enhanced ER Model and Business Rules Modern Database Management Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Modeling Data in the Organization Chapters 3 + 4: Modern Database Management 9 th Edition.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 The Enhanced Entity Relationship Diagrams (E-ERDs)
Enhanced Entity-Relationship and Object Modeling Chapter 4
Chapter 3: The Enhanced E-R Model
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
© 2011 Pearson Education 1 Chapter 3: Advanced Database Analysis Modern Database Management 10 th Edition, International Edition Jeffrey A. Hoffer, V.
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
Database Systems Supertypes and Subtypes Lecture # 10.
Database Management System Prepared by Dr. Ahmed El-Ragal Reviewed & Presented By Mr. Mahmoud Rafeek Alfarra College Of Science & Technology- Khan younis.
Entity Relationship Modeling
Enhanced Entity-Relationship Modeling
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 9 th Edition.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 4: The Enhanced E-R Model Modern Database Management 9 th Edition Jeffrey A. Hoffer,
Advance Database Engineering 1 Chapter 4: The Enhanced ER Model and Business Rules Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 3: THE ENHANCED.
Modeling Data in the Organization Muhammad Nasir
CS263 Lec. 4: Enhanced E-R Models Basic ER model introduced in the mid 1970s Since then business relationships and business data have become more complex.
© 2005 by Prentice Hall 1 Chapter 4: The Enhanced ER Model and Business Rules Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Modeling data in the Organization
The Enhanced E-R Model and Business Rules
LECTURE 4: Chapter 4: The Enhanced E-R Model
Advanced Database Analysis
Chapter 4: The Enhanced E-R Model and Business Rules
Chapter 4: The Enhanced ER Model and Business Rules
Database Management System 1 (ITED123A)
Chapter 3: The Enhanced E-R Model
Overview of Entity‐Relationship Model
CHAPTER 3: THE ENHANCED E-R MODEL
Review of Week 1 Database DBMS File systems vs. database systems
CGS 2545: Database Concepts Summer 2006
Presentation transcript:

Database Development Supertype, Subtype, and Business Rules Powered by DeSiaMore 1

Supertype/Subtype relationships Most important new modelling construct in the ER model Allows us to model a general entity type (the supertype) and then subdivide it into several specialised entity types (called subtypes) Each subtype inherits from its supertype and may have special attributes of its own Powered by DeSiaMore 2

Representing supertypes and subtypes The supertype is connected with a line to a circle, which in turn is connected by a line to each subtype that has been defined (see Fig.) The ‘U’ shaped symbol on each line connecting a subtype to the circle indicates that the subtype is a subset of the supertype, and also indicates the direction of the relationship Attributes shared by all the entities are associated with the supertype, whilst attributes that are unique to a particular subtype are associated with that subtype Powered by DeSiaMore 3

Basic notation for supertype/subtype relationships Powered by DeSiaMore 4

An example: the EMPLOYEE supertype Suppose that an organisation has 3 basic types of employees: Hourly: Employee_Number, Employee_Name, Address, Date_Hired, Hourly_Rate Salaried: Employee_Number, Employee_Name, Address, Date_Hired, Annual_Salary, Stock_Option Contract consultants: Employee_Number, Employee_Name, Address, Date_Hired, Contract_Number, Billing_Rate Powered by DeSiaMore 5

Employee supertype Many attributes the same across 3 types, so we could define a supertype called EMPLOYEE, with subtypes for HOURLY_EMPLOYEE, SALARIED_EMPLOYEE and CONSULTANT (see Fig) Powered by DeSiaMore 6

Employee supertype with three subtypes All employee subtypes will have emp_no., name, address, and date-hired Each employee subtype will also have its own attributes Powered by DeSiaMore 7

When to use supertype/subtype relations Should consider using subtypes when either (or both) of the following conditions are present: 1. There are attributes that apply to some (but not all) of the instances of an entity type 2. The instances of a subtype participate in a relationship unique to that subtype Both are true in the following Fig., where PATIENT has two subtypes: OUTPATIENT and RESIDENT PATIENT (the primary key is PATIENT_ID) All patients have an Admit_Date and a Patient_Name Powered by DeSiaMore 8

Patient example Every patient is cared for by a RESPONSIBLE_PHYSICIAN who develops a treatment plan for the patient Each subtype also has unique attributes. Outpatients have a Checkback_Date, whilst residents have a Date_Discharged and a unique relationship that assigns each patient to a bed (this is a mandatory relationship, and each bed may or may not be assigned to a patient) Powered by DeSiaMore 9

Supertype/subtype relationships of patients Both outpatients and resident patients are cared for by a responsible physician Only resident patients are assigned to a bed Powered by DeSiaMore 10

Generalization and specialization BOTTOM-UP Generalization: = the process of defining a more general entity type from a set of more specialized entity types. BOTTOM-UP TOP-DOWN Specialization = the process of defining one or more subtypes of the supertype, and forming supertype/subtype relationships. TOP-DOWN Following Figs. Shows Generalisation in a situation where we have 3 different entity types: CAR, TRUCK and MOTORCYCLE Following Figs. Shows Generalisation in a situation where we have 3 different entity types: CAR, TRUCK and MOTORCYCLE In second Fig. The more general entity type VEHICLE is shown In second Fig. The more general entity type VEHICLE is shown Powered by DeSiaMore 11

Generalisation MOTORCYCLE is not shown as it does not satisfy conditions for a subtype discussed earlier – the only attributes of MOTORCYCLE are those that are common to all vehicles, there are no attributes specific to motorcycles. Further, MOTORCYCLE does not have a relationship to another entity type MOTORCYCLE is not shown as it does not satisfy conditions for a subtype discussed earlier – the only attributes of MOTORCYCLE are those that are common to all vehicles, there are no attributes specific to motorcycles. Further, MOTORCYCLE does not have a relationship to another entity type Powered by DeSiaMore 12

Example of generalization Three entity types: CAR, TRUCK, and MOTORCYCLE All these types of vehicles have common attributes Powered by DeSiaMore 13

Generalization to VEHICLE supertype So we put the shared attributes in a supertype Note: no subtype for motorcycle, since it has no unique attributes Powered by DeSiaMore 14

Specialisation In an example of specialisation, an entity type PART has identifier Part_No and other attributes Description, Unit_price, Location, Qty_On_Hand, Routing_Number and Supplier (a multivalued attribute as there may be more than one supplier) Some parts are internally Manufactured Parts whilst others are externally Purchased Parts (some parts are obtained from both sources – when the choice depends on factors such as manufacturing capacity, unit price of the parts etc.) Powered by DeSiaMore 15

Specialisation Some attributes apply to all parts regardless of source, others such as Routing_Number depend on the source as they apply only to Manufactured Parts. This suggests that PART should be specialised by defining the subtypes MANUFACTURED_PART and PURCHASED_PART A new relationship ‘Supplies’ has been created between PURCHASED_PART and SUPPLIER that allows users to more easily associate purchased parts with their suppliers The attribute Unit_Price is now associated with the relationship ‘Supplies’ so that the price may vary between suppliers Powered by DeSiaMore 16

Example of specialization Entity type PART Only applies to manufactured parts Applies only to purchased parts Powered by DeSiaMore 17

Specialization to MANUFACTURED PART and PURCHASED PART Note: multivalued attribute was replaced by a relationship to another entity Created 2 subtypes Powered by DeSiaMore 18

Business Rule Business rule: a statement that defines or constrains some aspect of the business. It is intended to assert business structure or to control or influence the behavior of the business. EX1: A student may register for a section of a course only only if he/she has successfully completed the prerequisites for the course. EX2: A preferred customer qualifies for a 10% discount, unless he has an overdue account balance Powered by DeSiaMore 19

Business rules The major business rule for study is called action assertion:  rule expressing constraints/control of organizational actions Powered by DeSiaMore 20

Stating an action assertion Action assertions deal with the dynamic aspects of the organisation and impose “must/must not” and “should/should not” constraints on handling data An action assertion is the property of some business rule (called the anchor object) for a data handling action (such as create, update, delete etc.) and it states how the other business rules (called corresponding objects) act on the anchor object Powered by DeSiaMore 21

Stating an action assertion Examples of action assertions are: A course (anchor object) must have a course name (corresponding object). Here the action is updating the course name property of a course Powered by DeSiaMore 22

Previously the term “integrity constraint” was used. Now the term “business rules” encompasses more than just constraints, it is a new paradigm for specifying information systems requirements Business Rules Paradigm Powered by DeSiaMore 23

Paradigm Shift based on: Business rules are a core concept in an enterprise since they are an expression of business policy and guide individuals and aggregate behavior. Business rules can be expressed in term that are familiar to end users, allowing users to define and maintain their own rules. Business rules are highly maintainable. They are stored in a central repository, and each rule is expressed only once, then shared throughout the organization. Enforcement of business rules can be automated, through the use of software that can interpret the rules and enforce them using the integrity mechanisms of the DBMS Powered by DeSiaMore 24

Classification of Business Rules Structural constraints - business rules that define the static structure of the organization definitions domains relationships Operational constraints - business rules that constrain the ongoing operations of the organization. procedural declarative Powered by DeSiaMore 25

Classification of Business Rules Business Rules Structural Constraints Operational Constraints DeclarativeProceduralRelationships Domain Constraints Definitions Supertype/ Subtype Constraints FactsTerms Derived Base E-R Diagram Powered by DeSiaMore 26

Business Rules: Defining Structural Constraints Definitions Term - a word or phrase that has a specific meaning for the business. Fact - an association between two or more terms. Derived Fact - a fact that is derived from other facts or rules, using an algorithm or inference Powered by DeSiaMore 27

Domain Constraints A specification of the characteristics of the data values that can be associated with one or more attributes. ATTRIBUTE Attribute_nameDefinitionDomain_name Data_type Range Length DOMAIN Is_assigned_to Powered by DeSiaMore 28

Business Rules: Defining Operational Constraints Constraint base - is an organized collection of rules (or constraints), usually stored in a repository. Constraint language simple so that end users can understand them structured to be convertible to computer code Powered by DeSiaMore 29

Business Rules: Defining Operational Constraints Constrained object - an entity, attribute, or relationship on which operations are limited. Constraining object - an entity, attribute, or relationship that influences the ability to perform an operation or read another object. Powered by DeSiaMore 30