1 Class Diagrams and Entity Relationship Diagrams (ERD)



Similar documents
Developing Entity Relationship Diagrams (ERDs)

Data Analysis 1. SET08104 Database Systems. Napier University

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

DATABASE DESIGN. - Developing database and information systems is performed using a development lifecycle, which consists of a series of steps.

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Entity/Relationship Modelling. Database Systems Lecture 4 Natasha Alechina

Welcome to the Data Analytics Toolkit PowerPoint presentation on EHR architecture and meaningful use.

EXTENDED LEARNING MODULE A

A brief overview of developing a conceptual data model as the first step in creating a relational database.

Chapter 2: Entity-Relationship Model

Lecture 12: Entity Relationship Modelling

Lesson 8: Introduction to Databases E-R Data Modeling

Modern Systems Analysis and Design

CA IDMS. Database Design Guide. Release , 2nd Edition

A Short Tutorial on Using Visio 2010 for Entity-Relationship Diagrams

Entity-Relationship Model

Data Modeling Basics

7.1 The Information system

Fundamentals of Database Design

Chapter 2: Entity-Relationship Model. Entity Sets. " Example: specific person, company, event, plant

Chapter 2: Entity-Relationship Model. E-R R Diagrams

DATABASE INTRODUCTION

Concepts of Database Management Seventh Edition. Chapter 6 Database Design 2: Design Method

Conceptual Design: Entity Relationship Models. Objectives. Overview

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

11 November

2. Conceptual Modeling using the Entity-Relationship Model

Relational Database Concepts

Lecture Notes INFORMATION RESOURCES

Chapter 3. Data Analysis and Diagramming

TIM 50 - Business Information Systems

Database Design Process

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

Database Design Process

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

The Entity-Relationship Model


The E-R èentity-relationshipè data model views the real world as a set of basic objects èentitiesè and

Data Modeling: Part 1. Entity Relationship (ER) Model

Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model

Relational Database Basics Review

Entity Relationship Diagram

Foundations of Information Management

XV. The Entity-Relationship Model

Designing Databases. Introduction

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

ER modelling, Weak Entities, Class Hierarchies, Aggregation

Normal forms and normalization

IV. The (Extended) Entity-Relationship Model

Database Design Methodology

Chapter 7. Process Analysis and Diagramming

MODULE 8 LOGICAL DATABASE DESIGN. Contents. 2. LEARNING UNIT 1 Entity-relationship(E-R) modelling of data elements of an application.

Select the Crow s Foot entity relationship diagram (ERD) option. Create the entities and define their components.

LAB 3: Introduction to Domain Modeling and Class Diagram

Database Management Systems

Databases and BigData

ComponentNo. C_Description UnitOfMeasure. C_Quantity

5.5 Copyright 2011 Pearson Education, Inc. publishing as Prentice Hall. Figure 5-2

BI solutions with Visio Graphical visualizations with Visio, SharePoint and Visio Services

LOGICAL DATABASE DESIGN

Preview DESIGNING DATABASES WITH VISIO PROFESSIONAL: A TUTORIAL

Why & How: Business Data Modelling. It should be a requirement of the job that business analysts document process AND data requirements

Database Design and the E-R Model

2x 2x 2 8x. Now, let s work backwards to FACTOR. We begin by placing the terms of the polynomial inside the cells of the box. 2x 2

not necessarily strictly sequential feedback loops exist, i.e. may need to revisit earlier stages during a later stage

SOFTWARE ENGINEERING IT 0301 Semester V B.Nithya,G.Lakshmi Priya Asst Professor SRM University, Kattankulathur. School of Computing, Department of IT

AS LEVEL Computer Application Databases

SQL AND DATA. What is SQL? SQL (pronounced sequel) is an acronym for Structured Query Language, CHAPTER OBJECTIVES

Introduction to normalization. Introduction to normalization

Higher National Unit specification: general information. Relational Database Management Systems

Database Design and Database Programming with SQL - 5 Day In Class Event Day 1 Activity Start Time Length

Outline. Data Modeling. Conceptual Design. ER Model Basics: Entities. ER Model Basics: Relationships. Ternary Relationships. Yanlei Diao UMass Amherst

Object Oriented Software Models

Relational Data Analysis I

Access Tutorial 3: Relationships

Understanding Data Flow Diagrams Donald S. Le Vie, Jr.

A Tutorial on Quality Assurance of Data Models 1. QA of Data Models. Barry Williams. tutorial_qa_of_models.doc Page 1 of 17 31/12/ :18:36

Information Technology Services Kennesaw State University

Fundamental Concepts of Relational Theory Technical Brief

Conceptual Design Using the Entity-Relationship (ER) Model

FIXED ASSET CONTROL. Required Fields: Acquisition Amount. Required Fields: Retirement Amount. Required Fields: Asset Class, Acquisition Amount

Database Fundamentals: 1

The Entity-Relationship Model

Database Design Basics

Physical Design. Meeting the needs of the users is the gold standard against which we measure our success in creating a database.

Design and Implementation

Databases and Information Management

Design and UML Class Diagrams

Databases Model the Real World. The Entity- Relationship Model. Conceptual Design. Steps in Database Design. ER Model Basics. ER Model Basics (Contd.

CHAPTER 6 DATABASE MANAGEMENT SYSTEMS. Learning Objectives

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

D6 INFORMATION SYSTEMS DEVELOPMENT. SOLUTIONS & MARKING SCHEME. June 2013

Foundations of Information Management

USING UML FOR OBJECT-RELATIONAL DATABASE SYSTEMS DEVELOPMENT: A FRAMEWORK

We know how to query a database using SQL. A set of tables and their schemas are given Data are properly loaded

Foundations of Business Intelligence: Databases and Information Management

Answers to Review Questions

BİL 354 Veritabanı Sistemleri. Entity-Relationship Model

Access Tutorial 2: Tables

Transcription:

1 Class Diagrams and Entity Relationship Diagrams (ERD) Class diagrams and ERDs both model the structure of a system. Class diagrams represent the dynamic aspects of a system: both the structural and behavioural features. ERDs, depicting only structural features provide a static view of the system. 2 Class Diagrams 2.1 Elements of a class diagram: 2.1.1 class Class Name A class is a general concept (represented as a square box). A class defines the structural attributes and behavioural characteristics of that concept. Shown as a rectangle labeled with the class name. 2.1.2 association Class 1 Class 2 Association A (semantic) relationship between classes. A line that joins two classes. 2.1.2.1 binary Person Eats Food Simple association between two classes. A solid triangle with the association name indicates the direction in which the association is meant to be read. 2.1.2.2 n-ary Class 1 Class 2 n-ary n-ary Association expresses an association between multiple classes Class 3 2.1.2.3 Aggregation Team Member has-a relationship page 1 of 14

2.1.2.4 Composition Tutorial Week 7 - Class and Entity-Relationship Diagrams Car Engine is-composed-of relationship 2.1.2.5 Generalization Car Volvo is-a-kind-of relationship 2.1.2.6 Dependency Project Manager Project The source class depends on (uses) the target class. (not used for requirements analysis) Team 2.1.2.7 Realization «datatype» Human Resources Class supports all operations of target class but not all attributes or associations. (not used for requirements analysis) «datatype» Project Manager Worker «datatype» System Administrator page 2 of 14

2.1.2.8 Association Classes Association Class Can be applied to binary or n-ary associations. Used to capture the attributes of an association. class 2 class 1 2.1.3 attribute class 1 -attribute 1 -attribute 2 -attribute 3 What is known about each object of this class type. Typical characteristics. 2.1.4 operation class 1 -attribute 1 -attribute 2 -attribute 3 +operation 1() +operation 2() +operation 3() What objects of this class type do. Typical actions that are relevant to the current analysis. 3 Creating a Class Diagram Here are some steps to help create a class diagram: 3.1 Identify Classes These are the abstract or physical things in our system which we wish to describe. Find all the nouns and noun phrases in the domain descriptions you have obtained through your analysis. Consider these class candidates. 3.2 Find Associations Now find the verbs that join the nouns. e.g., The professor (noun) teaches (verb) students (noun). The verb in this case, defines an association between the two nouns. Identify the type of association. Use a matrix to define the associations between classes. 3.3 Draw Rough Class Diagram Put classes in rectangles and draw the associations connecting the classes. 3.4 Fill in Multiplicity Determine the number of occurrences of one class for a single occurrence of the associated class. page 3 of 14

3.5 Identify Attributes Name the information details (fields) which are relevant to the application domain for each class. 3.6 Identify Behaviours - Specify the operations that are required for each class. (assume getter and setter methods for each attribute.) 3.7 Review your diagram and fine tune it. Look for inconsistencies and errors. Fix them. Make sure you have captured everything required from the domain you are studying - that your diagram is complete. 4 Entity Relationship Diagrams 4.1 Elements of Entity Relationship Diagrams: 4.1.1 Entity A data entity is anything about which we want to store data. 4.1.2 Relationship A relationship is a semantic association between one or more entities. 4.1.3 Attribute Key Attribute Attribute 1 A data attribute is a property common to an entity. Entity 1 Attribute 2 Attribute 3 4.2 Creating an ERD Here are the steps you may follow to create an entity-relationship diagram. page 4 of 14

4.2.1 Identify Entities Tutorial Week 7 - Class and Entity-Relationship Diagrams Identify the entities. These are typically the nouns and noun-phrases in the descriptive data produced in your analysis. Do not include entities that are irrelevant to your domain. 4.2.2 Find Relationships Discover the semantic relationships between entities. These are usually the verbs that connect the nouns. Not all relationships are this blatant, you may have to discover some on your own. The easiest way to see all possible relationships is to build a table with the entities across the columns and down the rows, and fill in those cells where a relationship exists between entities. 4.2.3 Draw Rough ERD Draw the entities and relationships that you have discovered. 4.2.4 Fill in Cardinality Determine the cardinality of the relationships. You may want to decide on cardinality when you are creating a relationship table. 4.2.5 Define Primary Keys Identify attribute(s) that uniquely identify each occurrence of that entity. 4.2.6 Draw Key-Based ERD Now add them (the primary key attributes) to your ERD. Revise your diagram to eliminate many-to-many relationships, and tag all foreign keys. 4.2.7 Identify Attributes Identify all entity characteristics relevant to the domain being analyzed. 4.2.8 Map Attributes Determine which to entity each characteristic belongs. Do not duplicate attributes across entities. If necessary, contain them in a new, related, entity. 4.2.9 Draw fully attributed ERD Now add these attributes. The diagram may need to be modified to accommodate necessary new entities. 4.2.10 Check Results Is the diagram a consistent and complete representation of the domain. page 5 of 14

5 Practice Example The University of Toronto has several departments. Each department is managed by a chair, and at least one professor. Professors must be assigned to one, but possibly more departments. At least one professor teaches each course, but a professor may be on sabbatical and not teach any course. Each course may be taught more than once by different professors. We know of the department name, the professor name, the professor employee id, the course names, the course schedule, the term/year that the course is taught, the departments the professor is assigned to, the department that offers the course. 5.1 Class Diagram 5.1.1 Identify Classes These are the abstract or physical things in our system which we wish to describe. Find all the nouns and noun phrases in the domain descriptions you have obtained through your analysis. Consider these class candidates. The class candidates are departments, chair, professor, course, and course section. Since there is only one instance of the University of Toronto, we exclude it from our consideration. 5.1.2 Find Associations Now find the verbs that join the nouns. e.g., The professor (noun) teaches (verb) students (noun). The verb in this case, defines an association between the two nouns. Identify the type of association. Use a matrix to define the associations between classes. department chair professor course department managed by is assigned offers (aggregate) chair manages is a professor assigned to teaches (aggregate) course offered by taught by 5.1.3 Draw Rough Class Diagram Put classes in rectangles and draw the associations connecting the classes. page 6 of 14

5.1.4 Fill in Multiplicity Determine the number of occurrences of one class for a single occurrence of the associated class. Course teaches 0..* 0..* Professor offers 1 assigned Department manages Chair 1 1 5.1.5 Identify Attributes Name the information details (fields) which are relevant to the application domain for each class. Add these attributes. We have the department name, the professor name, the professor employee id, the course names, the course schedule, the term/year that the course is taught, the departments the professor is assigned to, the department that offers the course. Course -name -schedule -term offers teaches 0..* 0..* Professor -name -employee id 1 assigned Department -name manages 1 1 Chair -is chair page 7 of 14

5.1.6 Identify Behaviours Specify the operations that are required for each class. (assume getter and setter methods for each attribute.) In this example - we are not given any behaviours, so we will have to make them up. What are some behaviours of these classes? Course -name -schedule -term +modify schedule() offers 1 teaches 0..* 0..* assigned Professo -name -employee id +prepare material() +teach lecture() +evaluate assignments() -name Department +add Course() +add professor() +remove course() +remove professor() +change chair() manages 1 1 -is chair Chair +create policy() +evaluate professor() 5.1.7 Review your diagram and fine tune it. Look for inconsistencies and errors. Fix them. Make sure you have captured everything required from the domain you are studying - that your diagram is complete. 5.2 Entity-Relationship Diagram 5.2.1 Identify Entities Identify the entities. These are typically the nouns and noun-phrases in the descriptive data produced in your analysis. Do not include entities that are irrelevant to your domain. The entity candidates are departments, chair, professor, course, and course section. Since there is only one instance of the University of Toronto, we exclude it from our consideration. 5.2.2 Find Relationships Discover the semantic relationships between entities. These are usually the verbs that connect the nouns. Not all relationships are this blatant, you may have to discover some on your own. The easiest way to see all possible relationships is to build a table with the entities across the columns and down the rows, and fill in those cells where a relationship exists between entities. department chair professor course department managed by is assigned offers chair manages is a professor assigned to teaches course offered by taught by page 8 of 14

5.2.3 Draw Rough ERD Draw the entities and relationships that you have discovered. page 9 of 14

5.2.4 Fill in Cardinality Determine the cardinality of the relationships. You may want to decide on cardinality when you are creating a relationship table. page 10 of 14

Here we must eliminate many-to-many relationships, and collapse one-to-one relationships where it makes sense. For example, the chair, without any behaviours, is really just an attribute of a department. So we can remove it as an entity and later add it as an attribute. page 11 of 14

5.2.5 Define Primary Keys Identify attribute(s) that uniquely identify each occurrence of that entity. department dept-prof professor prof-course course name dept. name employee id employee id employee id course name course name 5.2.6 Draw Key-Based ERD Now add them (the primary key attributes) to your ERD. Revise your diagram to eliminate many-to-many relationships, and tag all foreign keys. Dept. Name Department Is assigned Dept-Prof Dept. Name Employee ID offers has Professor Employee ID (0,*) Teaches Course Course name has Prof-Course Employee ID Course name page 12 of 14

5.2.7 Identify Attributes Identify all entity characteristics relevant to the domain being analyzed. Excluding those keys already identified: Schedule, Term, Professor name, Department Chair (which is an employee ID, a foreign key to Professor) 5.2.8 Map Attributes Determine which to entity each characteristic belongs. Do not duplicate attributes across entities. If necessary, contain them in a new, related, entity. Schedule Prof-Course, Term Prof-Course, Chair Department 5.2.9 Draw fully attributed ERD Now add these attributes. The diagram may need to be modified to accommodate necessary new entities. Dept. Name Department Chair Employee ID (fk Professor ) Is assigned Dept-Prof Dept. Name Employee ID offers has Professor Employee ID (0,*) Teaches Course Course name has Prof-Course Employee ID Course name Schedule Term page 13 of 14

5.2.10 Check Results Tutorial Week 7 - Class and Entity-Relationship Diagrams Is the diagram a consistent and complete representation of the domain. If not - fix it. page 14 of 14