Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling

640 views

Published on

Software Engineering, Lectures

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
640
On SlideShare
0
From Embeds
0
Number of Embeds
26
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Beit 381 se lec 19 - 18 - 12 apr24 - eraa and data modeling

  1. 1. SE-381 Software Engineering BEIT-V Lecture # 19 (Entity Relationship and Attribute Analysis & Data Modelling)
  2. 2. Data Modeling – Data Modeling, Semantic Modeling, Entity Relationship Diagrams, Entity Relationship Attribute Modeling, Object Data Classes etc are various names for the same technique, commonly known as Data Modeling. – Different authors have used slightly different notations to represent Entities, Relationships and Object Data Classes – Notations used by Chen 1976 (the founder of the technique) and Baynon-Davies 1989 are followed. Some unlearning and re- learning may be required to those who have already learnt and used it in their Data Bases course – Data Modeling supplements the Process Modeling technique and helps in identifying the data structures on which the system is to be built
  3. 3. Entity Relationship Modelling • One of the Oldest techniques used in Database and Information Systems Design, proposed by Chen 1976 • Representation of ‘Real World’ in terms of Entities, Attributes and Relationships between the Entities An Entity is a thing which the enterprise recognizes as being capable of an independent existence and which can be uniquely identified (Howe, 1983) An Entity may be an Object, concept or an event having characteristics of independent existence and unique identification, and should have data items or attributes associated with it. An Entity together with its attributes define an Entity Type of which there may be many instances. Similarly, a Relationship Type may have many instances, where occurrences of allied Entities are participating
  4. 4. Relationship A Relationship is an association between two or more entities. (Howe, 1983) The common attribute in two Entities, indicates they have some relationship. For N entities, there could be N(N-1)/2 possible relations, as every Entity being part of the systems will be related to every other entity so only direct relationships between the Entities are considered Parent Child School GoesSponsors Parent and Child and Child and School have direct relationships, but the relationship between Parent and School is indirect or derived relationship which should not be considered
  5. 5. Cardinality or Degree of the Relationship • It is number of instances of the respective entity type participating in the relationship. • It can be one-to-one (1:1), one-to-many (1:M) or many-to-many (M:N) • Crow-Foot notation used to represent cardinality Class Student CourseStudent Cheque PaymentBrings Consists_of Read
  6. 6. Membership Class or Optionality • Membership is Mandatory if every occurrence of the entity participates in the relationship • Membership is Optional if some of the instances of respective entity do exist but don’t participate in the relationship, or some occurrences of the entity can exist independently – Every Employee must be employed within a Department – A Department may exist without any (full-time) Employee • For Mandatory Entity we put in ‘a filled dot’ within the Entity, and for Optional Entity it is put outside on the Relationship Cheque PaymentBrings Employee DeprttWorks Cheque PaymentBrings
  7. 7. Assignment Rules 1:1 Relationship – Membership Mandatory on Both Entity Types – Membership Mandatory for only one Entity Type Cheque PaymentBrings Single table is needed Cheque (Cheque_no, date, sign, amount, … , Payment_Id, …) Employee CarUses Two tables needed, post the identifier of Optional into Mandatory Employee (Employee_no, Name, Designation, …) Car (Reg_no, Model, Capacity, …., Employee_no )
  8. 8. Assignment Rules – Membership Optional for both Entity Types Employee CarUses Three tables needed, one for each Entity and one for Relationship Employee (Employee_no, Name, Designation, …) Car (Reg_No, Model, Capacity, …. ) Uses ( Employee_no, Reg_no, …., Mileage_used_by)
  9. 9. Assignment Rules 1:M Relationship – Membership of many ‘Entity’ is Mandatory, Ward PatientContains Two tables needed Ward (Ward_no, Location, type, …) Patient ( Patient_Id,, Name, date_of_Admiss, …, Ward_no) – Membership of many ‘Entity’ is also Optional Ward PatientContains Three tables needed Ward (Ward_no, Location, type, …) Patient ( Patient_Id,, Name, date_of_Admiss, …) Contains (Patient_no, Ward_no)
  10. 10. Assignment Rules M:N Relationship – Will need Three Tables irrespective of membership class Teacher StudentTutors Three tables needed Teacher (Teacher_name, Subject, Qualification …) Student ( Reg_no,, Name, date_of_Admiss, Semester …) Tutors (Teacher_name, Reg_no)
  11. 11. Drawing of E-R Diagrams Following steps be followed to draw E-R Diagrams 1. Identify Entities from the problem definition 2. Investigate and record their inter-relationships 3. Draw E-R diagram showing Entities and Relationships 4. Indicate Degree and Membership Class of each Relationship 5. Validate the ERD against the System Requirements 6. Rationalize 7. Revalidate 8. Using Assignment Rules, convert the diagram into set of fully normalized tables
  12. 12. ERD - A Case Study Design an appropriate information system for the patients’ appointments and operations activities of a large general hospital. Initial analysis provide the following brief description of the existing manual system: • Patients are dealt with by an appointment system • Patients must make an appointment for a clinic session held at one of the hospital’s clinics • Doctors are allocated one or more appointments within a clinic session, but only one doctor will be present at each appointment • Operations are scheduled and allocated to one of a number of theatre sessions held in the hospital’s operating theatres, each doctor may perform a number of given operations on patients 1. First identify the set of Entities from the above description
  13. 13. Entities of the System HOSPITAL CLINIC CLINIC-SESSION APPOINTMENT PATIENT DOCTOR OPERATION OPERATING-THEATRE THEATRE-SESSION 2. Investigate and record Inter-relationships How many total relations are possible, Identify the direct Relations 3. Draw E-R diagram showing Entities and Relationships
  14. 14. First-Pass ERD
  15. 15. Eliminate the Indirect Relationships 4. Indicate and draw the Optionality of the relationships
  16. 16. Second-Pass ERD
  17. 17. Set of Tables Generated
  18. 18. References 1. NIIT (2005); System Analysis and Design for Software Engineers; Printice-Hall of India, New Delhi 2. Paul Beynon-Davies (1989); Information Systems Development, Macmillan, London, UK; Ch-5 Entity – Relationship Diagrams pp:38-54 3. P. P-S Chen (1976); the Entity-Relationship Model – Toward a Unified View of Data; ACM Transactions on Database Systems 1, pp:9-36 4. Any book on Data Bases or Data Modeling

×