25
1 Data Modeling : ER Model… Lecture 07

1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

Embed Size (px)

Citation preview

Page 1: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

1

Data Modeling : ER Model…

Lecture 07

Page 2: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

2

Summary of last lecture•ER model notation•Examples•Ternary relationship•Weak entities

•Extended ER Model•Process Modeling

Page 3: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

3

EXTENDED E-R MODEL•extensions to capture more meaning•concepts of generalization, aggregation and sub-set hierarchies added• Similar to OO concepts : inheritance,

composite objects

Page 4: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

4

Generalization•to generalize from two or more entity sets and factor out commonality

•Example : given two entities Faculty and Non-faculty, we can define a ‘general’ entity called Employee

•Common attributes are factored out to define ‘Employee’ entity; specific (non-common) attributes incorporated in ‘Faculty’ and ‘Non-faculty’ entities

•represented by IS-A relationship

Page 5: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

5

Page 6: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

6

Another example :

Page 7: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

7

Specialization•also called subset hierarchy; we created

special cases for a given entity. - Teacher a specific case of Employee - Employee called superset, Teacher called

subset•entity E1 is subset of E if every instance of E1

is also an instance of E; this is also IS-A relationship

•E called superset and E1 as subset (or sub-class); E may have multiple and possibly over-lapping subsets

•every instance in E need not be present in subsets of E

Page 8: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

8

Specialization…..•specialization allows classification of an entity in subsets based on some distinguishing attribute/property

•we may have several specialization of same entity

•the subsets may have additional attributes

Page 9: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

9

Page 10: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

10

Inheritance•there is inheritance of attributes from superclass or superset

•the subclass/subset automatically inherits attributes defined at superclass/superset level

•thus, inheritance present in both Generalization and specialization• Direction important : bottom-up in

generalization, top-down in Specialization

• Important to distinguish the two cases

Page 11: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

11

Aggregation•for building complex entity from existing entities (or existing entities and relationships)

•two ways of defining complex entities : • create an attribute whose value is

another entity• define an entity as containing a group of

related entities

Page 12: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

12

Examples :•Work-order object (entity) defined as consisting of entities Raw-material, Tools and Workers;

•Work-order itself related with Customer entity

•Aggregation notation not explicitly provided in Extended E-R model

Page 13: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

13

Raw Material Tools

Worker

Customer

JobNo Quantity

Work-order

Page 14: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

14

Summary•Data Modeling important to understand

data to be handled in a given application.•We develop a conceptual Model first.•ER model uses concepts of Entity,

Relationship and Attribute.•Provides Constraints: primary key,

cardinality….•Simple to use diagramming notation•User cam understand and validate our

model

Page 15: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

15

Process Modeling

Page 16: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

16

Outline

•Process decomposition diagrams•Data flow diagram (DFD)

Page 17: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

17

Process Model•A process is a business activity which when executed produces certain outputs from given inputs

•The function(s) performed by a process may be complex, with multiple inputs, outputs and users

•The entire application itself is a process

•We use successive decomposition into sub processes to reveal greater details of the processing

Page 18: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

18

Function Decomposition•Decomposition splits wok of a task into subtasks; subtasks together make-up the parent task; not like ‘calling’ a module

•Balanced decomposition: sub-tasks are roughly equal in complexity

Page 19: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

19

Function Decomposition …•Top-down decomposition gives hierarchical structure

•Decompose into 2 or more; not more than 5

•A high cohesion (high independence) and minimum coupling (minimum interdependence) are fundamental criteria

•Continue decomposition until elementary processes are identified

Page 20: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

20

Function Decomposition•Elementary process is a smallest unit of activity meaningful to end user (it sees and leaves data in consistent state)

•Process decomposition diagram• A tree structure• Elementary processes are leaf nodes• Data are not shown

Page 21: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

21

FD Diagrams: Examples

Page 22: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

22

FD Diagrams: Examples

Page 23: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

23

•Exercise: prepare FDDs for• Railway reservation system• Hospital patient management• Employee payroll

Page 24: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

24

Function Decomposition …•Use proper naming of processes•Business functions named as nouns (marketing, Inventory control, …)

•Process name consists of an active verb and an object (accept order, calculate interest, …)

Page 25: 1 Data Modeling : ER Model… Lecture 07. 2 Summary of last lecture ER model notation Examples Ternary relationship Weak entities Extended ER Model Process

25

Naming …•Avoid long names (sentences containing and, if, then, etc. indicate non-cohesive complex tasks)

•Real world is a good reference for selecting proper names; organizational units are organized functionally and each unit has a well-defined task