Вы находитесь на странице: 1из 18

Conceptual Modelling

Entity Relationship Model


Overview

Entities, Attributes and Relationship


modelling
Generating a Relational Database for an
EAR model
Tutorial - Using the QSEE case tool
Abstraction Layers
Conceptual
What data is held Realisation
An Image and its meta-data (Refinement
Entity-Relationship model (ERM) Reification)
Logical (Engineering,
How data is organised in storage Model-Driven
Block and Directory structure development
Tables, keys
Abstraction
Physical
(Reverse
How data is stored in bits Engineering)
JPEG as a stream of bytes
A Database as files and records stored in a DBMS-specific
format
ER Model
This modelling language allows a very small
vocabulary: Just as English has nouns, verbs,
adjectives, pronouns..
ER models have only 3 core concepts
Attribute a simple, atomic data item like a date, a
name, a number [also called Property or Field]
Entity a group of attributes which are all related to
the same thing [also called Entity Type or Class]
Relationship a relationship between Entities.
Entities and Instances
Data
Instances
Employee Employee
(entity instances, SMITH ALLEN
objects)

Schema isA isA

Entity
(entity type, class)
Employee
MMS application
A simple web application which allows an
account holder to send a photo from a
mobile phone to a web site to be added to
a photo gallery
Server Technology
Data storage in MySQL relational database
Scripting language : PHP
MMS Photo Gallery

Documentation
mmsmail@cems.uwe.ac.uk

MMS mailbox
Originating phoneno

mime2db.php
MySql
database
mimedecode.php

mms1
php scripts index.php
getpage.php
getimage.php
MMS Photo : EAR diagram
Entity
Each Photo created
by exactly one
Member

Relationship
Attribute
Or
none
Each Member has
Primary key
created many
Photos

Data Type

Diagram generated by QSEE


Other conceptual models
ERM is not the only conceptual model in
use
Object-role model (ORM) drop the distinction
between attributes and relationships its all
relationships.
Single level models (RDF) drop the distinction
between type and instance.
Case Tool - QSEE

is a free download for individual use


is available in the lab (older version )
enables a wide range of diagram types to be
created
UML
Data flow diagrams
Entity-relationship diagram
With generation of SQL for creating a database (with some
fixes - use Perl script to clean up)
Entity (type)
Typically represents a type of thing person, department,
photo with properties of interest
Similar to a Class in Object-Orientation (but no methods)
Has a name
Name becomes the name of the table in a database
I prefer a singular noun Employee, Department. The table will
contain a varying number of entity instances but the Entity Type
is singular
Has attributes or properties (which might become fields
or columns in a database)
Entity instances are related (linked) to other entity
instances relationships
Has an Annotation (in QSEE)
Text to describe the scope of this type (what things can be one
of these), the meaning and usage, a typical example.
Attribute
Name
Must be unique within the Entity
Avoid SQL reserved words
Type (data type)
SQL provides a set of available data types essential
ones are:
integer a whole number
numeric number with decimal part
character fixed length string
varchar variable length string
date hold dates like 2005-10-14
blob a very large field such as a JPEG image
Primary Key
An attribute(or several) which uniquely identify each
instance of the entity within the set of all instances.
Relationships in QSEE
Name
Names the relationship
There can be multiple relationships between the same entity types e.g,
Employee Department
Works in
Is manager of
Has worked in
Must never work in
Relationship ends (roles) can be named too I prefer to use this
than relationship names which need a direction
Cardinality
from source (start) to destination (end)
Optional
Identifier
For 1-M, does the source (partly) identify the destination
Annotation
Text describing the meaning of this relationship
Relationship CARDINALITY

M1 M2 M4

P1 P4 P5 P7 P3

One-one

One-many
Member Photo
Many-many
1..n 1..n
It is hard to get this notation the right way
round.
Always read it both ways
Every X is related to how many Ys?
Every Y is related to how many Xs?
Relationship OPTIONALITY

M1 M3 M2

P1 P4 P5 P7 P7 P3

One-many
Member Photo
QSEE
Class Exercise - KML
A Folder has a name and contains zero, one or more
PlaceMarks and some Styles
A Placemark has attributes of :
A name
A description
A position defined by its longitude, latitude and Altitude, each
represented by a signed decimal number
A Style defines the appearance of a placemark the
symbol to show, the size, the foreground and
background colour.
Each Placemark has a Style
Draw an ERM for this simplified description of a KML
Folder.

Вам также может понравиться