Chris Russell O2.41 02920 41 6431 crussell@cardiffmet.ac.uk Business Analysis Entity Modelling Chris Russell O2.41 02920 41 6431 crussell@cardiffmet.ac.uk Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Session schedule Business Analysis Schedule Academic Year 2014-5 Semester 2 Week Topic 1 Introduction 2 Investigate situation: rich picture, context diagrams 3 Consider perspectives: types of participation, CATWOE, Power-Interest, Thomas-Kilmann 4 Analyse needs 1: Use Cases 5 Analyse needs 2: structured techniques 6 Define requirements 1a: SSADM 7 Define requirements 1b: SSADM EASTER 8 Define requirements 2: UML 9 Generic assignment feed-forward and task review 10 Balance good enough software against quality costs; Prioritise requirements 11 Assignment submisison Lecture BA13 Entity Modelling
Activities and Paradigms Investigate Situation Consider Perspectives Analyse Needs Define Requirements Socio-technical Rich picture CATWOE Types of participation Thomas-Kilmann Power-Interest X Functional Level 0 diagram Structured techniques DFD, ERM and ELH Object-Oriented Context diagram Use Cases Class and Sequence diagrams Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Contents Logical Data Modelling Revision Key concepts Examples Lecture BA13 Entity Modelling
Logical Data Modelling The DFD tells us how: data is processed by a system data is stored within a system But not the meaning or structure of such data - this is the concern of Logical Data Modelling Lecture BA13 Entity Modelling
Logical Data Modelling Consists of: the Logical Data Structure (LDS) diagram a set of associated textual descriptions LDM is similar to Entity Relationship Modelling; LDS is similar to the Entity Relationship Diagram Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Revision: relation Attributes Keyfield Personnel 18/2/71 2 Hardy Rd Brown, G 7138 Accounts 12/8/60 92 Coleridge St Smith, R 3812 Purchasing 10/5/50 10 Milton St Bloggs, F 1234 Dept DOB Address Name Emp# Tuples Lecture BA13 Entity Modelling Employee Number 7138
Lecture BA13 Entity Modelling Revision: degree The “degree” of a relation is the number of attributes 4 3 1 2 5 Personnel 18/2/71 2 Hardy Rd Brown, G 7138 Accounts 12/8/60 92 Coleridge St Smith, R 3812 Purchasing 10/5/50 10 Milton St Bloggs, F 1234 Dept DOB Address Name Emp# Lecture BA13 Entity Modelling
Revision: cardinality The “cardinality” of a relation is the total number of tuples existing at some time instant 3 2 1 Personnel 18/2/71 2 Hardy Rd Brown, G 7138 Accounts 12/8/60 92 Coleridge St Smith, R 3812 Purchasing 10/5/50 10 Milton St Bloggs, F 1234 Dept DOB Address Name Emp# Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Revision: domain The domain of an attribute is the set of values from which it is taken The domain of Emp# could be the set of all 4 digit integers between 1000 and 9999 The domain of DOB could be all valid dates so, for example, 32/6/71 is invalid The domain of the department could be (Purchasing : Accounts : Personnel ) Lecture BA13 Entity Modelling
Revision: referential Integrity Foreign Key Employee Table Accounts NULL 5823 Purchasing 8146 Personnel 18/2/71 2 Hardy St Brown, G 7138 12/8/60 92 Coleridge Cr Smith, R 3812 20/5/50 10 Milton St Bloggs, F 1234 Dept DOB Address Name Emp# Department Table Annexe 1921 Administration Main 5823 Accounts 8146 Purchasing Building Manager# Dept Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Key concepts Entities Relationships Degree Optionality Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Entities A thing - object, concept, group of people etc - about which the system needs to store information Not the same as an External Entity in a DFD Notation: a round cornered rectangle containing the entity’s - unique - name Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Entities “Qualifications” required for an entity: There must be more than one occurrence Each occurrence should be uniquely identifiable There must be data that we want to hold about the entity It should be of direct interest to the system Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Relationships Each entity is related to at least one other entity Notation: related entities are linked by a line, labelled in both directions The line is annotated with the relationship’s degree and optionality Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Degree The degree to which any two entities are related must be indicated: Many to Many (m:n) - each occurrence of A is related to one or more occurrences of B, and vice-versa. One to Many (1:m) - each occurrence of A is related to one or more occurrences of B, but each occurrence of B is related to only one occurrence of A. Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Degree Degrees (cont.)… One to One (1:1) - each occurrence of A is related to only one occurrence of B, and vice-versa. Notation: “crow’s feet” are added to the line at the “many” end In a 1:m relationship “m” should be at the bottom Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Optionality If an occurrence of one entity is not related to at least one occurrence of the other, then the relationship is optional rather than mandatory. Notation: dashed line at the optional end(s) Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling An example A university At a university, students are tutored by Lecturers. A student registers for a course at enrolment. The course consists of modules, which the student is required to attend. These modules are taught by Lecturers. Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Course Module Student Making up Consists of Registers Is registering Is tutored Lecturer Tutors Is taught by Teaches Attends Is Attended by Student RegNo, Name, Address, DateJoined Lecturer StaffNo, Name, extension Course CNo, Title, Duration Module ModNo, Module, Semester ,staffno 1:M Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Course Module Student Making up Consists of Registers Is registering Is tutored Lecturer Tutors Is taught by Teaches Attends Is Attended by Student RegNo, Name, Address, DateJoined Lecturer StaffNo, Name, extension Course CNo, Title, Duration Module ModNo, Module, Semester ,staffno ,Cno 1:m Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling 1:m Relationships Course(cno, name, duration) Student(sno, name, address) Course Student Enrols Consists of The primary key of table course (cno) can be placed in table student as an additional (foreign key) attribute. Thus student becomes: Student(sno, name, address,cno) Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling ,Cno Course Module Student Making up Consists of Registers Is registering Is tutored Lecturer Tutors Is taught by Teaches Attends Is Attended by Student RegNo, Name, Address, DateJoined Lecturer StaffNo, Name, extension Course CNo, Title, Duration Module ModNo, Module, Semester ,staffno ,Cno 1:m Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Student RegNo, Name, Address, DateJoined ,staffno ,Cno Lecturer StaffNo, Name, extension Module ModNo, Module, Semester ,Cno Course CNo, Title, Duration Is tutored Student Attends Registers Is registering M:N Course Consists of Making up Tutors Is Attended by Teaches Module Lecturer Is taught by Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling M:N Relationships Student Module Grade achieves Is achieved by awards Is awarded for Student Module attends Is attended by 1:M {New Entity} 1:M Lecture BA13 Entity Modelling
M:N Relationships(Cont.) The primary key of Student (sno) can be placed in Grade as an additional (foreign key) attribute. Thus Grade becomes: Grade sno Student Module Grade achieves Is achieved by awards Is awarded for The primary key of Module (mno) can be placed in Grade as an additional (foreign key) attribute. Thus Grade becomes: Grade sno, mno Lecture BA13 Entity Modelling
M:N Relationships(Cont.) Both attributes now become keys. Therefore: Grade (sno, mno) Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Student RegNo, Name, Address, DateJoined ,staffno ,Cno Lecturer StaffNo, Name, extension Module ModNo, Module, Semester ,Cno Course CNo, Title, Duration Grade RegNo, ModNo, Ass1, Ass2, Exam,…) Student Is tutored achieves Registers Is achieved by Is registering Course Grade Consists of Is awarded Making up Tutors Teaches Module Lecturer Is taught by awards Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Student (RegNo, Name, Address, DateJoined ,staffno ,Cno Lecturer (StaffNo, Name, extension Module (ModNo, Module, Semester ,Cno Course (CNo, Title, Duration Grade (RegNo, ModNo, Ass1, Ass2, Exam,…) Student Is tutored achieves Registers Is achieved by Is registering Course M:N Grade Consists of Is awarded Making up Tutors Teaches Module Lecturer Is taught by awards Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Student (RegNo, Name, Address, DateJoined ,staffno ,Cno Lecturer (StaffNo, Name, extension Module (ModNo, Module, Semester ,Cno Course (CNo, Title, Duration Grade (RegNo, ModNo, Ass1, Ass2, Exam,…) Delivery (Staffno, ModNo) Student Is tutored achieves Registers Is achieved by Is registering Course Grade Consists of Is awarded Making up Tutors Teaches Module Lecturer awards Lecture BA13 Entity Modelling Delivery
Lecture BA13 Entity Modelling 1:1 Relationship Three Options: Can I join the two entities? Can I use the same key? Either the primary key of the entity Country may be a foreign key in for the entity City or vice-versa (but not both). Country City Has a capital Is the capital of Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Another example The Count Moneybags General Hospital The Count Moneybags General Hospital deals with patients using an appointments 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. Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Entity Matrix Hospital x Clinic x Clinic Session x Appointment x x Doctor x x Patient Hospital x Operating Theatre x Theatre Sessions x Operation x Doctor x x Patient Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling This week, Next week Task 10 in Seminar ELH in Lecture Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Relationships Hospital Operating Theatre Clinic Theatre Sessions Clinic Session Doctor Operation Appointment Patient Lecture BA13 Entity Modelling Add the Cardinality
Lecture BA13 Entity Modelling Remove the Many to many relationships. Relationships and cardinality Hospital Operating Theatre Clinic Theatre Sessions Clinic Session Doctor Operation Appointment Patient Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling Relationships and cardinality Hospital Operating Theatre Clinic Theatre Sessions Clinic Session Doctor Operation Appointment Patient Patient- Operation Link Patient- Appointment Link Lecture BA13 Entity Modelling
Lecture BA13 Entity Modelling x Entity 2 x Entity 3 x Entity 4 x Entity 5 Entity 6 x x Lecture BA13 Entity Modelling