25
Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Embed Size (px)

DESCRIPTION

Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing What is an entity? An entity is a ‘thing’ which can be distinctly identified some distinct identifiable thing for which the system must store data in order to perform its fundamental activities

Citation preview

Page 1: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Information Modelling

andthe logical data structure

Page 2: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Information Modelling

What is an entity? What do we mean by relationship? Why model the data in a system? What is a logical data structure? LDS notation

Page 3: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

What is an entity?

An entity is

a ‘thing’ which can be distinctly identified

some distinct identifiable thing for whichthe system must store data in order to

perform its fundamental activities

Page 4: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Attributes of an entity

An entity (or object) will have certain features that can take different values. These features are called attributes.

An attribute isan elementary data element that describesan object or a fact about an object

Page 5: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Entity examples

Entities can be described by:customer = customer number + customer name + customer addressperson = name + addr + NI# + occupation +

DOB + height etc...Orcustomer (customer number,

customer name, customer address)

Page 6: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Entity guidelines

Entity names should be a noun or noun phrase

Names should represent the role or classification of the thing

Uniquely identifiable occurrences Entities must have attributes Should be of interest to the business

Page 7: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Identifying entity occurrences (1)

A means to identifiy one entity occurrence from another is needed.A candidate key is

an attribute, or set of attributes, of anentity which uniquely identifies a single

occurrence from all others

Page 8: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Identifying entity occurrences (2)

A primary key is

A alternate key is

the particular candidate key chosen toidentify a single entry

a candidate key not chosen to be the primary key

Page 9: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

What do we mean by relationship?

A relationship represents a set of connections

between objects represents an association between

objects in the real world is an association between two (or

more) entities

Page 10: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Relationship guidelines

Occurrences of a relationship created when events occur

Regard as a sentence with place holders<lecturer> works in <department>

Use active rather than passive namesreports to rather than is reported to

Page 11: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Why model data in a system?

The information model describes the information required to support the system

It helps to organise information and define what it means

Examplesattendee namepublic course and coursefull course

Page 12: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

The information model (1)

Carefully organised and defined info helps info to be understood avoids redundancy ensures correctness, validity and

completeness

Page 13: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

The information model (2)

The information model concerns: entities - categories of things that

information describes relationships - associations

between entities attributes - qualities or properties

of entities

Page 14: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Information example

Given the following statement of purpose of a system determine the entities, relationships between them and the attributes required.

Trent College requires a new student record system to be set up. It must be able to show who is on which course and in which department it is run. It should hold student information for mail shots etc.

Page 15: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

What is a logical data structure (LDS)?

An LDS is a graphical representation which

It is a semantic modelling tool which helps to clarify concept

highlights important categories ofinformation (entities) and relevant

associations between them (relationships)

Page 16: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

The LDS

Used to identify and organise information used by the system (not just stored)

A B

C

XY

Page 17: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

LDS notation (1)

The entity

The relationship

Lecturer Course

teaches

taught by

Page 18: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

LDS notation (2)

Connecting entities via relatioshipsLecturer Course

teaches

taught by

Project Partuses

used by

SupplierSupplies

Supplied by

Page 19: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Cardinality of a relationship

1:1

1:N

M:N

Lecturer Courseteaches

taught by

Lecturer Courseteaches

taught by

Lecturer Courseteaches

taught by

Page 20: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Participation in a relationship

Office Employeeoccupied by

occupies

Office Employeeoccupied by

occupies

Office Employeeoccupied by

occupies

Office Employeeoccupied by

occupies

Page 21: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Recursive relationships

A relationship from one entity type to itselfEg, Employees may be managers too

May also be 1:1, or M:N

Employeemanaged

by

manages

Page 22: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Sub-types/Supertypes

Treatment

In Patient

Patient

Out PatientDoctor

Out-patientTreatment

Out-patientDepartmentBed

providesprovidedby

given to

given

given to

givengiven by

gives

occupies

occupied by

Page 23: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

LDS construction guidelines

Define the area for analysis Determine entities and attributes Determine key attributes of entities Add remaining attributes to entities Determine the relationships between the

entities Examine events and operations of system

to ensure that the model supports them

Page 24: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Data dictionary entries

Entities Definition of its role Attributes that describe itRelationships Reference to entities involved Cardinality/Optionality

Page 25: Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Information Modelling and the logical data structure

Dr. Andy Seddon

StaffordshireUNIVERSITY

Schoolof

Computing

Summary

Entities Attributes Relationships Logical data structure Cardinality of relationships Participation of relationships Data dictionary