1 / 27

Lecture 5 Entity Relationship Modelling

CS 4310: Software Engineering. Lecture 5 Entity Relationship Modelling. Entity-Relationship Model. Technique for carrying out the conceptual and logical design of the system A widely accepted data modelling approach 3 basic notions: entities attributes relationships.

cartergary
Download Presentation

Lecture 5 Entity Relationship Modelling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 4310: Software Engineering Lecture 5 Entity Relationship Modelling

  2. Entity-Relationship Model • Technique for carrying out the conceptual and logical design of the system • A widely accepted data modelling approach • 3 basic notions: • entities • attributes • relationships

  3. What is an entity? • An entity is an object that can be identified in the users’ work environment and that users want to track.

  4. Entities • An entity is a thing or object in the real world (within the application context) • An entity has a set of properties which uniquely identify it. • An entity is represented as a rectangle in an ER diagram Project

  5. What is an Attribute? • An attribute describes a characteristic of an entity • For example: • An entity: Employee • Has attributes: • Employee_Name • Extension • Date_Of_Hire

  6. Attributes • Example: Project = (proj_name, location, budget, • start_date, end_date) • Represented as ellipses in an ER diagram budget start_date location Project end_date proj_name

  7. What are Relationships? • Relationships are associations between entities which express some real world relationship Project Employs Employee • Project and Employeeparticipate in the employs relationship • The function that an entity plays in a relationship is called that entity’s role

  8. Relationship Sets starts at • There can be more than one relationship between entities. • There can be recursive relationships that can indicate roles for clarity. • A relationship can also have descriptive attributes. Road Town ends at manager works for Employee worker date Client orders Book

  9. Degree of Relationships • Refers to the number of entities participating in a relationship • Most relationships are binary (degree 2), but can also have ternary (degree 3) relationships. Name proj_name Hires Project Contractor location Address budget end_date start_date end_date Contract number start_date value

  10. Mapping Cardinalities • Express the number of entities to which another entity can be associated via a relationship • For a binary relationship, the mapping cardinality can be one of the following: • one to one • one to many • many to one • many to many

  11. Cardinality Examples Person ID Book • A person has only one ID book and an ID book belongs to only 1 person • A person can own many cars (possibly 0), but a car only has 1 owner • A person can own many houses and a house can have multiple owners owns Person Car owns Person House owns

  12. Design Issues • Entity or Attribute? • Example: should location be an entity or an attribute? • can a project be in more than 1 location? • Entity or Relationship? • generally: relationships for actions between entities • whatever “makes sense” in application context

  13. ER Diagram Symbols Entity Set One-to-one link Many-to-one link Attribute Many-to-many link Relationship

  14. Example ERD start_date budget ID surname end_date first_name proj_name employs Project Employee location position year_joined start_date end_date eliminates year_left species Alien area

  15. ER Design: Where to Start • Identify entity sets • Describe the entity sets with attributes • Specify relationships and cardinalities

  16. Simple Modelling Example • Every department within the company is in only one division. • Each division has more than one department in it. • There is no upper limit on the number of departments that a division can have.

  17. 1. Define Entities Division Department Employee

  18. 2. Define Relationships Division contains Department manages Employee

  19. 3. Define Cardinality Division contains Department manages Employee

  20. is sent by Standard Notation A plain rectangle is used to represent the entity type. INVOICE A labeled line to represent the relationship. 1 : 1 A B A B 1 : N

  21. Diagram with Standard Notation Division contains Department manages Employee

  22. has enrolled COURSE STUDENT refers to LOAN BOOK Notation Examples ONE course has enrolled ONE or MORE students. ONE student is enrolled on ONE course. ONE loan refers to ONE book. ONE book is referred to ONE loan.

  23. supplies SUPPLIER PART Many-to-Many Relationship Example • Any one supplier might supply more than one kind of part. • Any one kind of part might be bought from a number of different suppliers.

  24. More Examples is associated Property Customer can place Order Customer teach Students Teachers

  25. Example - Simple Hospital System WARD DOCTOR has accommodates treats assigned AILMENT NURSE PATIENT cares for suffers from

  26. College System DEPARTMENT is_in offers COURSE LECTURER teaches enrols STUDENT

  27. Your Project Work • Develop Requirements Document. • Think about your system’s entities and relationships

More Related