Download presentation
1
Lecture 5 Entity Relationship Modeling
Software Engineering Lecture 5 Entity Relationship Modeling
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 Employee participate 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 Employee works for 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 Project Hires 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 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 Person ID Book 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 Project Employee Alien employs eliminates start_date
budget ID surname end_date first_name proj_name Project employs 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
Standard Notation A plain rectangle is used to
represent the entity type. INVOICE A labeled line to represent the relationship. is sent by 1 : 1 A B A B 1 : N
21
Diagram with Standard Notation
Division contains Department manages Employee
22
Notation Examples ONE course has enrolled ONE or MORE students.
ONE student is enrolled on ONE course. LOAN BOOK refers to ONE loan refers to ONE book. ONE book is referred to ONE loan.
23
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. SUPPLIER PART supplies
24
More Examples is associated can place teach Customer Property Customer
Order teach Teachers Students
25
Example - Simple Hospital System
WARD DOCTOR has accommodates assigned treats NURSE PATIENT AILMENT cares for suffers from
26
College System DEPARTMENT COURSE LECTURER STUDENT is_in offers teaches
enrols STUDENT
27
Your Project Work Develop Requirements Document.
Think about your system’s entities and relationships
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.