Presentation is loading. Please wait.

Presentation is loading. Please wait.

Conceptual Modelling Entity Relationship Model Overview Entities, Attributes and Relationship modelling Generating a Relational Database for an EAR model.

Similar presentations


Presentation on theme: "Conceptual Modelling Entity Relationship Model Overview Entities, Attributes and Relationship modelling Generating a Relational Database for an EAR model."— Presentation transcript:

1

2 Conceptual Modelling Entity Relationship Model

3 Overview Entities, Attributes and Relationship modelling Generating a Relational Database for an EAR model Tutorial - Using the QSEE case tool

4 Abstraction Layers Conceptual –What data is held An Image and its meta-data Entity-Relationship model (ERM) Logical –How data is organised in storage Block and Directory structure Tables, keys Physical –How data is stored in bits JPEG as a stream of bytes A Database as files and records stored in a DBMS-specific format Abstraction Realisation (Refinement Reification) (Reverse Engineering) (Engineering, Model-Driven development

5 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.

6 Entities and Instances Employee SMITH Employee ALLEN Instances (entity instances, objects) Entity (entity type, class) isA Employee Data Schema

7 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

8 mimedecode.php MMS mailbox mmsmail@cems.uwe.ac.uk mime2db.php MySql database php scripts mms1 index.php getpage.php getimage.php MMS Photo Gallery Documentation Originating phoneno

9 MMS Photo : EAR diagram Entity Attribute Relationship Primary key Data Type Each Member has created many Photos Diagram generated by QSEE Each Photo created by exactly one Member Or none

10 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.

11 Case Tool - QSEEQSEE 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)

12 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.

13 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.

14 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

15 Relationship CARDINALITY M1 P4P5P1 M2 P3 P7 M4 One-one One-many Many-many MemberPhoto 1..n

16 It is hard to get this notation the right way round. –Always read it both ways Every X is related to how many Y’s? Every Y is related to how many X’s?

17 Relationship OPTIONALITY M1 P4P5P1 M2 P3 P7 M3 One-many MemberPhoto

18 QSEE

19 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.


Download ppt "Conceptual Modelling Entity Relationship Model Overview Entities, Attributes and Relationship modelling Generating a Relational Database for an EAR model."

Similar presentations


Ads by Google