460 likes | 606 Views
Modelling Business Systems 6. Modelling and Managing Data. Elements of Data. Entity – something we hold information about Students, courses, customers, suppliers. Orders, accounts Concrete entities – e.g. student Abstract entities – e.g. accounts
E N D
Modelling Business Systems 6 Modelling and Managing Data CB1004 Modelling Business Systems 6
Elements of Data • Entity – something we hold information about • Students, courses, customers, suppliers. Orders, accounts • Concrete entities – e.g. student • Abstract entities – e.g. accounts • May not be components of the system e.g. suppliers but are part of the environment CB1004 Modelling Business Systems 6
Elements of Data • Attributes – the actual information we hold • Student registration number, address, stock description, price of a stock item • Concrete – height of a cupboard • Abstract – price • Instances – occurrences of the entity • Student • Values – of attributes • Age = 18 or 24 CB1004 Modelling Business Systems 6
Elements of Data • Relationships – connection between entities • Each supplier has an account • Degree of relationship • One-to-one – a supplier has one account (unusual to have more than one, or not to have an account) • One-to-many – Arbor operations supply many customers • Many-to-many – a cupboard contains many parts, a particular part may go into more than one cupboard CB1004 Modelling Business Systems 6
Elements of Data • Relationships cont. • Compulsory relationships – a supplier MUST have an account • Optional – not all academic staff work in CMS CB1004 Modelling Business Systems 6
Diagramming Conventions Account Supplier One-to-one Operations Customer One-to-many Parts Cupboard Many-to-many CB1004 Modelling Business Systems 6
Data models • Entity relationship diagram (ERD) • High level and abstract (conceptual) • Describes data in logical terms not its physical organisation • Draw one for Arbor # CB1004 Modelling Business Systems 6
Implementation models • Physical models • Hierarchical data model • Tree structure CB1004 Modelling Business Systems 6
Hierarchical (tree) Data Model Level 0 Level 1 Leaves Level 2 Leaves CB1004 Modelling Business Systems 6
Hierarchical model • Child may have only one parent • Contradicts use of many-to-many relationships CB1004 Modelling Business Systems 6
Central assembly & packing CAP Employs produces Consists of processes Operator Product Production facility Used for Carries out Operation CB1004 Modelling Business Systems 6
Adjusting the model – 2 parents Operator Production facility Operation CB1004 Modelling Business Systems 6
Replication Operator Production facility Operation Operation CB1004 Modelling Business Systems 6
Pointers Operator Production facility Operation Pointer CB1004 Modelling Business Systems 6
Many-to-many • Not solved by pointers • What connects various products to various production facilities is when any product is processed by a particular production facility • A production order or job - a logical entity CB1004 Modelling Business Systems 6
Many-to-many relationships Production facility Product CB1004 Modelling Business Systems 6
Replace by two one-to-many Production facility Product Production order CB1004 Modelling Business Systems 6
Arbor logical model • Need to replace the many-to-many relationships with one-to-many # CB1004 Modelling Business Systems 6
Hierarchical schema CB1004 Modelling Business Systems 6
Hierarchical schema / terminology • How data is organised • Field- holds the value of a single attribute • Segment – group of fields • Sequence field – one of the fields within a segment used for ordering the segment • Analogies – filing cabinets, books with chapters etc CB1004 Modelling Business Systems 6
Network (plex) model • Concept of a set • Two entities with a one-to-many relationship • At one end is the owner, the other the member • Entities may belong to more than one set type as owners or members CB1004 Modelling Business Systems 6
Central packing Owner Owner Member Member Operator Production facility Owner Owner Member Member Operation CB1004 Modelling Business Systems 6
Many-to-many relationships • Instances • More than one operator • Each may carry out more than one operation • Can be resolved in a similar manner to the hierarchical database problem $ • Introduce another (logical) entity e.g. production order CB1004 Modelling Business Systems 6
Central packing Owner Owner Member Member Production facility Product Owner Owner Member Member Production order CB1004 Modelling Business Systems 6
Terminology • Data item – holds value of a single attribute • Vector – groups different values of the same attribute e.g. orderno • Repeating group – groups different types of values e.g. orderno and ordertype • Record – collection of data items, vectors or repeating groups • Key – data item used to select a record • Set – consists of an owner and members CB1004 Modelling Business Systems 6
Network schema Production order Orderno Prodno Quantity Process Optype Opno 1234 C126 150 1 Cutting Grouting 2 CB1004 Modelling Business Systems 6
The problems • Both models based on the implementation of the database • Changes add to complexity CB1004 Modelling Business Systems 6
Relational model • Based on a two dimensional flat table or flat file CB1004 Modelling Business Systems 6
Cupboards CB1004 Modelling Business Systems 6
Terminology • Columns – corresponds to an attribute of an entity • Rows – correspond to one instance of an entity • Relations – all the instances (the whole table) • Domain – a particular column of a relation • Set of attribute values CB1004 Modelling Business Systems 6
The problems $ • Have several repeating groups • Calabria occurs many times - different sizes and finishes • Dependencies between domains • Stock class and siting • Could split to more than one table for different users • Style, model, finish, price – accounts • All except stock class – sales • Potential for duplication of data CB1004 Modelling Business Systems 6
Principles • Booch (1991) • The simplest yet most important goal in database design is the concept that each fact should be stored in exactly one place • Eliminates redundancy and potential storage requirements • Simplifies updating the database • Easier to prevent inconsistencies CB1004 Modelling Business Systems 6
Normalisation • Eliminates duplication where it is redundant • The value of ‘veneer’ is not dependent on the style ‘calabria’ • Relationship between these two does not need separating • However, the siting and stock class always go together siting = lounge, stock class = LG • Needs to be looked at • Example # CB1004 Modelling Business Systems 6
First normal form (1NF) • Separates repeating groups • Cupboard example • First repeating group contains style • Second repeating group contains size • Note the necessity for multiple field keys as we break down the tables CB1004 Modelling Business Systems 6
Second normal form (2NF) • Removal of partial dependencies • In ‘Cupboard’ • Values for height, fittings and price depend on style, size and surface finish • Value of price depends on variations in style, size and surface finish • Value of height only dependent on size – partial dependency • The value of a non-key attribute depends on the partial key NOT the whole key CB1004 Modelling Business Systems 6
Third normal form (3NF) • Removal of transitive dependencies – where the value of an attribute does not depend directly on the value of a key, but depends on the value of a second attribute which depends on the value of the key • ‘Application’ • Value of stock class depends entirely on siting; siting depends on the key attributes of style and surface finish CB1004 Modelling Business Systems 6
Semantic data model (SDM) • Based on principles deriving from the user’s view of the meaning of the data • Entities correspond to objects in the ‘real world’ • Classes are collections of entities that share the same set of attributes • Can also have subclasses CB1004 Modelling Business Systems 6
Semantic model CB1004 Modelling Business Systems 6
Data Processing and Manipulation • Data definition language (DDL) • Defines structural features of the model • Create table, create view • Data manipulation language (DML) • Defines how data is accessed and manipulated • Insert, select • Data control language (DCL) • Controls access to the database and security • Grant, revoke, lock table CB1004 Modelling Business Systems 6
DBMS vs. tradition • Traditionally • Box file became a computer based file of sequential records • Direct access disk storage – led to less sequential storage of data • Now moving to a more logical view of data CB1004 Modelling Business Systems 6
Cont. • Coffee machine # • First machine • Has columns of plastic cups already filled with ingredients • New requirement – physically add a new column of cups • Second machine • Makes up desired drink as requested • New requirements – change the logic in the machine to produce a new combination CB1004 Modelling Business Systems 6
Cont. • DBMS utilises a similar system to the second machine • Brings together individual data items as the user requests them # CB1004 Modelling Business Systems 6
The database • Stored data • All the data required by the information system • In turn these are determined by the individual management systems e.g. financial system, personnel system etc • Same data may be used for different reasons e.g. sales figures • Report on the performance of a retail outlet • Analyse customer demand for future production targets CB1004 Modelling Business Systems 6
The database cont. • Meta data • Parts database for cupboards will contain data about the parts that make up a particular cupboard • Schema • Defines the ordering and arranging of this data in the data model • Enables us to understand the relationship of parts to one another CB1004 Modelling Business Systems 6
As a result • The software used in databases is more user friendly and high level • Hence a detailed knowledge of computing is no longer necessary to create information systems • Build closer links between users and builders CB1004 Modelling Business Systems 6
Any questions? CB1004 Modelling Business Systems 6