250 likes | 933 Views
Data Modeling : ER Model…. Lecture 07. Summary of last lecture. ER model notation Examples Ternary relationship Weak entities Extended ER Model Process Modeling. EXTENDED E-R MODEL. extensions to capture more meaning concepts of generalization, aggregation and sub-set hierarchies added
E N D
Data Modeling : ER Model… Lecture 07
Summary of last lecture • ER model notation • Examples • Ternary relationship • Weak entities • Extended ER Model • Process Modeling
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
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
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
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
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
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
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
Work-order Raw Material Tools Worker Customer JobNo Quantity
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
Outline • Process decomposition diagrams • Data flow diagram (DFD)
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
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
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
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
Exercise: prepare FDDs for • Railway reservation system • Hospital patient management • Employee payroll
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, …)
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