Logical Data Modelling
Logical Data Modelling
The sole purpose of an Information System is to support or automate business activities by storing and processing relevant business information or data. It is therefore critical to the success of any IS development that the meaning, structure and business rules of the required data are fully analysed, understood and modelled. During the Investigation phase we are concerned with understanding the underlying (i.e. logical) data requirement rather than making decisions about its physical implementation.
The LDM
In SSADM the vehicle for analysing the logical structure of an organisations information is the Logical Data Model (LDM). A Logical Data Model is a way of graphically representing what that information is really all about, how it relates to other information and business concepts, and how business rules are applied to its use in the system. The LDM is possibly the most important and ultimately the most rigorous product of an entire SSADM project. Logical Data Models consist of two parts:
a diagram called the Logical Data Structure (LDS); a set of associated textual descriptions that explain each part of the diagram.
Entities
Any object or concept about which a system needs to hold information is known as an Entity Type (or entity for short). To be a valid entity we must wish to hold information on more than one occurrence of it. Entity occurrences are real world instances of an entity type. For example the entity type Supplier will have occurrences such as:
Supplier No Supplier Name Supplier Address 3621 Off Beat Recordings 12 High Street etc. 2327 Bella Sonic Lake Industrial Estate etc.
Entities (continued)
The symbol for an entity in an LDS is a round cornered rectangle containing the entitys name (which must be unique):
An entity must have a number of properties to qualify as such: - There must be more than one occurrence of the entity. - 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.
Attributes
Each item of information (or data) that we hold about an entity is known as an attribute or data item. Examples of attributes for Supplier might be supplier number, supplier name, supplier address, and supplier telephone no. The detail of an entitys attributes is not formally included on the LDS itself. This is held in separate textual descriptions, which will be discussed later.
Relationships
Entities do not exist in isolation, but are related to other entities. In physical data structures these relationships are signified by physical links such as pointers or placement in the same file or document. In logical models relationships represent business associations or rules and not physical links. Any entities that are related are linked by a line on the LDS. The line is labelled with the name of the relationship, and is named in both directions.
supplier for Supplier ? placed with ?
Purchase Order
Degree
The number of occurrences of each entity type participating in a given relationship is denoted by the degree or cardinality of that relationship, and illustrated on the LDS by adding crows feet to the relationships line.
A
m:n
1:m
1:1
Optionality
Each relationship is further annotated to show if it must exist for all occurrences of the participating entity types. If there can be occurrences of one entity that are not related to at least one occurrence of the other, then the relationship is said to be optional for that entity. The relationship line is then converted to a dashed line at its optional end (which could mean both ends if both entities are optional participants).
Supplier
supplier for
placed with
Purchase Order
Identifying Entities
To identify entities in the current environment we can begin by looking at our physical data stores to find out exactly what it is that they hold information about. If we take the customer order file and discuss it with users, we find that it not only contains details of each individual order, but of the customers themselves,
i.e. customer address, customer telephone number etc., and so encompasses at least two entities, namely Customer and Customer Order.
Supplier Product
Verification
Once the list has been drawn up we should verify it with key users during preliminary scoping interviews. The key questions to ask of each entity are:
Are any of the candidates merely attributes of another entity? Do any of the candidates represent a subset of occurrences of another entity? Do all of the entities have a unique identifier?
During this process we may discover new entities, merge existing entities or discard candidates as being outside the area of investigation.
Note: There will often be relationships between entities that exist in the real world, but which are not of relevance to the system under discussion. E.g a customer of ZigZag may well be employed by one of its suppliers. This is NOT something that ZigZag will be interested in recording!
Adding Relationships
We now examine each entity to see if it is directly related, in a way that is of interest to the system, to any of the other entities. The best way to do this is in discussion with users, either taking each entity in turn, or starting with a key entity and moving around the LDS network as the relationships are identified. Having identified where we think relationships exist, we now consider their degree, optionality and names. We do this by identifying the business rules that apply to each entity pairing. The basic process is the same for all pairings, so we will look at just one example.
Stock - Delivery
We first consider the relationship from the Stock perspective:
Each Stock occurrence will consist of a quantity of a single product, all of which was delivered on the same delivery. If within the depot we have a quantity of a given product, some of which was delivered in one delivery and some in another, then we will have more than one Stock. This is an example of one of ZigZags business rules, and one that will continue in the new system.
Delivery
Stock
Stock
Choosing a name is often the hardest part of the procedure. It is important to name a relationship in both directions as it forces us to examine the true nature of the relationship, sometimes leading to the discovery of additional relationships or even entities. We should always try to choose phrases that accurately reflect the users view of the relationship. In our example it is not too difficult to find reasonable names: delivery of and delivered by.
Delivery
delivery of
delivered by
Stock
Overview LDS
Continuing this process for all of the relationships identified on the matrix gives us a first-cut overview LDS for the current system:
supplier of Supplier supplier of
supplier for
Despatch
Customer
Delivered by placed with Purchase Order results in ordered by order for held as holding of delivered by Delivery delivery of Stock supplied by
orderer of
ordered by
Customer Order
result of
Drilling Down.
The overview LDS provides us with a good basis for building a more complete model of current data. We begin the process of creating a detailed model by looking at this model and discussing it with users to check our understanding of the scope of current data and to uncover lower level entities which can be added immediately.
Product Type
Depot Zone
Product
Supplier Invoice
Delivery
Detail
Supplier
The terms master and detail refer only to an entitys role in a particular relationship. It is quite possible for an entity to be the master in one relationship and the detail in another.
Product
Stock
Keys
We should be able to select at least one identifier for each entity type,
i.e. an attribute that enables each occurrence of an entity to be uniquely identified, e.g. for Customer we could use customer number.
Any attribute or set of attributes which together uniquely identify an entity is known as a candidate key. One of these candidates (there will often only be one) should be selected as the primary key. Whenever we require direct access to an entity, the primary key is used to identify which occurrence we are interested in. For example, if we needed to access the Supplier entity to find out a suppliers address, we would use the primary key of supplier number to identify the correct occurrence.
Foreign Keys
If we have a relationship between two entities we need to be able to associate the occurrences at one end with the related occurrences at the other. In a relational model (such as the LDM) we do this by including the primary key of the master in the set of attributes of the detail. The copy of the masters primary key in the detail entity is known as a foreign key.
Key Navigation
Supplier attributes:
Supplier No. (Primary Key), e.g 271 Supplier Address etc.
Supplier
To access all purchase orders placed with supplier number 271, we look for all occurrences of Purchase Order with a supplier number attribute value of 271. Coming in the opposite direction, to access the supplier for purchase order 5001, we look for the single occurrence of the Supplier entity whose primary key is equal to the supplier number given in the foreign key of purchase order number 5001, i.e. supplier number 271.
Notation
The primary key is underlined and the foreign key preceded by an asterisk to show the contents of each entity: Supplier (supplier number, supplier address, supplier tel. no.) Purchase Order (P.O. number, P.O. date, *supplier number)
4/3/01
Supplier:
2327 Bella Sonic Lake Industrial Estate Unit 5 NE3 7AJ
Delivery Address:
Depot 1 Harrow Way Harrow HA4 3NB
Qty
Our Product
Description
Format
Unit Price
Ref
100 500 884690 993201 The Best of Johnnie Boy Unbranded Blank 3hr Video Tapes CD BV 6.99 0.53
Product
contains contained in
Link Entities
Depot Zone and Product Type provide another more complex illustration of many to many relationships: Each Depot Zone may store one or more Product Types. Each Product Type must be storable in one or more Depot Zones. The attributes that make up Depot Zone are Depot Zone Number, Shelf Height, and Depot Zone Description etc. Depot Zone Number is a unique identifier that is assigned to each Depot Zone, and is the label attached to the end of each row of shelving in the zone. Depot Zone Description would include values such as CD and DVD, Videos and Books, and Tape etc, which describe the sorts of products that the shelving in each zone can accommodate. The attributes of Product Type include Product type code and Product type name, where the Product type code is an abbreviation of the Product type name, e.g. BV for Blank Video, DVD for DVD etc. So, for example, we might have the following cases: Depot Zones 101 and 105 store DVD and CD product types; Depot Zone 102 stores VHS, BV and SPB (small paperback book) product types.
Link Entities
To make these associations we would have to set up lists of foreign keys in both entities, of arbitrary length.
Significant maintenance overhead Navigation around the model very difficult Against the rules of relational data modelling
Pigs Ear
substitute for
Product
substituted by
In the ZigZag overview LDS there are two 1:1 relationships - between Delivery and Purchase Order and between Supplier Invoice and Delivery .
Deliveries are identified by the purchase order they are satisfying The only information currently held about them details which parts of the purchase order they have successfully delivered. It is quite easy in this case to view Delivery as a logical extension (or conclusion) of a Purchase Order, so we will merge the two entities and transfer all of Deliverys relationships to Purchase Order. To do this successfully, Purchase Order will contain attributes delivery date and suppliers delivery reference while Purchase Order Item will contain quantity delivered.
Invoice Item
Supplier Invoice
Purchase Order
Purchase Order
Supplier Invoice
Customer
Customer Order
Purchase Order
Supplier
Product Type
Depot Zone
Product Substitute
Customer
Stock
*Supplier Number
Suppliers Delivery Reference Purchase Order Date Purchase Order Status Delivery Date Delivery Start Time Delivery End Time
SUPPLIER Supplier Number Supplier Name Supplier Address Supplier Tel. No. Supplier Contact Name SUPPLIER INVOICE *Purchase Order Number Suppliers Invoice Number Invoice Date
PURCHASE ORDER ITEM *Purchase Order Number *Product Number *Invoice Number Quantity Required Quantity Confirmed Quantity Delivered Quantity Accepted Invoiced Quantity Agreed Unit Price Required-By Date Required-By Time-Period
STOCK Stock Id *Purchase Order Number *Product Number *Zone Code Quantity Stocked Quantity Stocked Quantity Reserved DEPOT ZONE ALLOCATION *Depot Zone Number *Product Type Code
Description
Attribute
Primary Key
Yes
Foreign Key
Mandatory/ Optional
M M
Purchase Order Number Purchase Order Date Supplier Number Purchase Order Status Delivery Date Delivery Start Time Delivery End Time
Yes
M M O O O
must/may be
must be may must
either /or
Link Phrase
placed with result in contain
Entity Name
Supplier Supplier Invoice P.O. Item
Max.
15000
Average
10000
Access
Read, Create, Delete, Modify Read Read, Create
Archiving
Small Projects
Entity Name Supplier Product Depot Zone Purchase Order Purchase Order Item Short Description or Comments (optional) Numbers rise at Xmas Storage Area or Aisle within Depot Numbers rise at Xmas Min Volume 400 10000 26 1500 90000 Max Volume 750 100000 40 16000 420000 Ave Volume 500 25000 32 10000 200000 Growth Rate 5% 25% 20% 15% 25%
Attribute Name Purchase Order Number Purchase Order Date Purchase Order Status
Short Description or Comments (optional) Automatically generated by system Date order placed
Length 9 8 1
Entity Description Table and Data Catalogue Table for Small Projects
Product Type
Product
Supplier
Product Type
Depot Zone
Product
Product Substitute
Purchase Order
Despatch
Customer
Supplier Invoice
Customer Order
Stock