[go: up one dir, main page]

0% found this document useful (0 votes)
26 views33 pages

Unit 1 Conceptual Data Modeling

Uploaded by

Esther Praveena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views33 pages

Unit 1 Conceptual Data Modeling

Uploaded by

Esther Praveena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

UNIT I

CONCEPTUAL DATA MODELING


Database environment –Database system development lifecycle –Requirements collection –
Database design --Entity-Relationship model –Enhanced-ER model –UML class diagrams.
Introduction of Data Base
What is Data?
Data is a collection of a distinct small unit of information. It can be used in a variety of forms
like text, numbers, media, bytes, etc. it can be stored in pieces of paper or electronic memory,
etc.

Word 'Data' is originated from the word 'datum' that means 'single piece of information.' It is
plural of the word datum.

In computing, Data is information that can be translated into a form for efficient movement and
processing. Data is interchangeable.

What is Database?

A database is an organized collection of data, so that it can be easily accessed and managed.

You can organize data into tables, rows, columns, and index it to make it easier to find relevant
information.

Database handlers create a database in such a way that only one set of software program provides
access of data to all the users.

The main purpose of the database is to operate a large amount of information by storing,
retrieving, and managing data.

There are many dynamic websites on the World Wide Web nowadays which are handled through
databases.

For example, a model that checks the availability of rooms in a hotel. It is an example of a
dynamic website that uses a database.

There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.

Modern databases are managed by the database management system (DBMS).

What are the components of DBMS?

1
Hardware, Software, Data, Database Access Language, Procedures and Users all together form the
components of a DBMS.
Hardware
The hardware is the actual computer system used for keeping and accessing the database. The
conventional DBMS hardware consists of secondary storage devices such as hard disks. Databases run on
the range of machines from microcomputers to mainframes.
Software
Software is the actual DBMS between the physical database and the users of the system. All the requests
from the user for accessing the database are handled by DBMS.
Data
It is an important component of the database management system. The main task of DBMS is to process
the data. Databases are used to store the data, retrieved, and updated to and from the databases.
Users
There are a number of users who can access or retrieve the data on demand using the application and the
interfaces provided by the DBMS.
The users of the database can be classified into different groups −
 Native Users
 Online Users
 Sophisticated Users
 Specialized Users
 Application Users
 DBA- Database Administrator
The components of DBMS are given below in pictorial form −

2
What are the applications of DBMS?
The Database Management System (DBMS) is defined as a software system that allows the user
to define, create and maintain the database and provide control access to the data.
It is a collection of programs used for managing data and simultaneously it supports different
types of users to create, manage, retrieve, update and store information.
Applications of DBMS
In so many fields, we will use a database management system.
Some of the applications where database management system uses −
Railway Reservation System − The railway reservation system database plays a very important
role by keeping record of ticket booking, train’s departure time and arrival status and also gives
information regarding train late to people through the database.
Library Management System − Now-a-days it’s become easy in the Library to track each book
and maintain it because of the database. This happens because there are thousands of books in
the library. It is very difficult to keep a record of all books in a copy or register. Now DBMS
used to maintain all the information related to book issue dates, name of the book, author and
availability of the book.
Banking − Banking is one of the main applications of databases. We all know there will be a
thousand transactions through banks daily and we are doing this without going to the bank. This
is all possible just because of DBMS that manages all the bank transactions.
Universities and colleges − Now-a-days examinations are done online. So, the universities and
colleges are maintaining DBMS to store Student’s registrations details, results, courses and grade
all the information in the database. For example, telecommunications. Without DBMS there is no
telecommunication company. DBMS is most useful to these companies to store the call details
and monthly postpaid bills.
Credit card transactions − The purchase of items and transactions of credit cards are made
possible only by DBMS. A credit card holder has to know the importance of their information
that all are secured through DBMS.
Social Media Sites − By filling the required details we are able to access social media platforms.
Many users sign up daily on social websites such as Facebook, Pinterest and Instagram. All the
information related to the users are stored and maintained with the help of DBMS.
Finance − Now-a-days there are lots of things to do with finance like storing sales, holding
information and finance statement management etc. these all can be done with database systems.
Military − In military areas the DBMS is playing a vital role. Military keeps records of soldiers
and it has so many files that should be kept secure and safe. DBMS provides a high security to
military information.

3
Online Shopping − Now-a-days we all do Online shopping without wasting the time by going
shopping with the help of DBMS. The products are added and sold only with the help of DBMS
like Purchase information, invoice bills and payment.
Human Resource Management − The management keeps records of each employee’s salary,
tax and work through DBMS.
Manufacturing − Manufacturing companies make products and sell them on a daily basis. To
keep records of all those details DBMS is used.
Airline Reservation system − Just like the railway reservation system, airlines also need DBMS
to keep records of flights arrival, departure and delay status.
So finally, we can clearly conclude that the DBMS is playing a very important role in each and
every field.

1.1 Database Environment


Advanced databases play a vital role in functioning of modern organization. Every day we all
are dealing with some database applications like shopping at a super market, withdrawing cash
using ATM, ordering a book online etc. Database technology not only used to improve our daily
operations but also the quality of decisions that affects our daily life. Database environment
encapsulates one or more databases. This encapsulation allows us to perform the group
operations between multiple databases in a single transaction. Database environment is
4
surrounded by different types of relations, tables, file models, time sharing models to store,
access and update the data in the organizational database.
Database Characteristics
Database contain a flood of data about many aspects of our life. Such as consumer
preferences, telecommunications usage, credit history etc. Databases contain these sorts of facts
as well as non-conventional facts such as photographs, fingerprints etc.
Some important properties of database are discussed below.
(a) Persistent: - It means data reside on stable storage such as a magnetic disk. It depends upon
the intended usage.
(b) Shared: – It means the database have multiple uses and uses.
(c) Interrelated: – It means that data stored as separate units can be connected to provide a whole
picture.
(d) Entity: – It is a cluster of data usually about a single subject that can be accessed together.
File Processing System:
File processing system is a type of system which is used to store and organize the information in
the database. It is the process of creating, storing and accessing the content of files. It can be
used to save a new file in the processing system. Through this file processing system, we can
create new files and save the existing files.
Advantages File Processing System
(a) It is simple to use.
(b) It is less expensive.
(c) It fits the needs of many small businesses and home users.
(d) Popular file management systems are packaged along with the operating systems.
(e) Good for database solutions.
Disadvantages of File Processing System: There are certain disadvantages in file processing
system.
(a) It typically does not support multiuser access.
(b) It is limited to smaller databases.
(c) It has limited functionality.
(d) It has redundancy.
(e) It has integrity issues.

5
Main Services of Relational Database Management System:
The main services of Relational Database Management System are listed below.
(a) Data storage, data retrieval and data update.
(b) User accessible catalog.
(c) It supports the transaction.
(d) It controls the concurrency in the database.
(e) It is recoverable.
(f) Only authorized users can view access the data.
(g) It supports the data communication.
(h) It supports the data independence.
Need of Database: There are certain advantages of using the database.
(a) It has the chance of maximum reduction of redundancy.
(b) In database, data can be used for more than one application.
(c) It supports standardization.
(d) It has the better security option.
(e) The integrity of data is independent of several applications.
(f) Here the data can be used directly.
Time Sharing Model
Time sharing model is the main frame and terminal of database. Its environment consists of the
mainframe and minicomputer.
The components of time sharing model are operating systems. Here, DBMS and applications are
running on a single computer.
It has the interaction through terminals. The user interface in time sharing model is generated by
mainframe or minicomputer. It has one or more cooperative processors for processing system.
File Server Model:
File server model consists of server and personal computers. It has the environment consists of
file server and work stations.
The components of a file server model are DBMS and application programs which are separated
from the database.

6
It has the interaction through workstations. The screen layout is generated by workstations. In
file server model, all processing is carried out by one or more intelligent workstations.
Data Integrity
Normally data integrity means consistency, validity and accuracy of data in a database.
Normally, there are four types of data integrity. These are listed below.
a) Table level integrity
b) Field level integrity
c) Relationship level integrity
d) Business rules
Physical data independence.
Physical data independence is the ability to modify re internal schema without having the change
to the conceptual or external schema.
In physical data independence, the conceptual schema covers the users from changes in the
physical storage of data.
Physical data independence indicates that the physical storage structures or devices used for
storing the data could be changed without necessitating a change in the conceptual view of any
of the external views.
Components of a run time database manager.
The run time database manager is normally called as the database control system. It has the
following components.
(a) Authorization control checks the authorization of users.
(b) Command processor processes the queries passed by authorization control module.
(c) Integrity checker checks the integrity constraints so that only valid data can be entered into a
database.
(d) Query optimizer determines an optimal strategy for the query execution.
(e) Transaction manager ensures that the transaction properties are maintained by the systems.
(f) The scheduler provides an environment in which multiple users can work on.
(g) Data manager is responsible for the actual handling of data in the database.

1.2 Database Development Life Cycle:


The Database Life Cycle (DBLC) contains six phases, as shown in the following Figure:
database initial study, database design, implementation and loading, testing and evaluation,
operation, and maintenance and evolution.

7
1.Database Initial Study:
In the Database initial study, the designer must examine the current system’s operation
within the company and determine how and why the current system fails. The overall
purpose of the database initial study is to:
• Analyze the company situation.
• Define problems and constraints.
• Define objectives.
• Define scope and boundaries.
a. Analyze the Company Situation: The company situation describes the general conditions in
which a company operates, its organizational structure, and its mission.
To analyze the company situation, the database designer must discover what the company’s
operational components are, how they function, and how they interact.

8
b. Define Problems and Constraints: The designer has both formal and informal sources of
information. The process of defining problems might initially appear to be unstructured.
Company end users are often unable to describe precisely the larger scope of company
operations or to identify the real problems encountered during company operations.
c. Define Objectives: A proposed database system must be designed to help solve at least the
major problems identified during the problem discovery process. In any case, the database
designer must begin to address the following questions:
• What is the proposed system’s initial objective?
• Will the system interface with other existing or future systems in the company?
• Will the system share the data with other systems or users?
d. Define Scope and Boundaries: The designer must recognize the existence of two sets of
limits: scope and boundaries. The system’s scope defines the extent of the design according to
operational requirements.
Will the database design encompass the entire organization, one or more departments within the
organization, or one or more functions of a single department? Knowing the scope helps in
defining the required data structures, the type and number of entities, the physical size of the
database, and so on.
The proposed system is also subject to limits known as boundaries, which are external to the
system. Boundaries are also imposed by existing hardware and software.
2. Database Design:
The second phase focuses on the design of the database model that will support company
operations and objectives.
This is arguably the most critical DBLC phase: making sure that the final product meets user and
system requirements.
As you examine the procedures required to complete the design phase in the DBLC, remember
these points:
• The process of database design is loosely related to the analysis and design of a larger
system. The data component is only one element of a larger information system.
• The systems analysts or systems programmers are in charge of designing the other system
components. Their activities create the procedures that will help transform the data within
the database into useful information.
3. Implementation and Loading:
The output of the database design phase is a series of instructions detailing the creation of tables,
attributes, domains, views, indexes, security constraints, and storage and performance guidelines.
In this phase, you actually implement all these design specifications.

9
a. Install the DBMS: This step is required only when a new dedicated instance of the DBMS
is necessary for the system. The DBMS may be installed on a new server or it may be installed
on existing servers. One current trend is called virtualization. Virtualization is a technique that
creates logical representations of computing resources that are independent of the underlying
physical computing resources.
b. Create the Database(s): In most modern relational DBMSs a new database implementation
requires the creation of special storage-related constructs to house the end-user tables. The
constructs usually include the storage group (or file groups), the table spaces, and the tables.
c. Load or Convert the Data: After the database has been created, the data must be loaded into
the database tables. Typically, the data will have to be migrated from the prior version of the
system. Often, data to be included in the system must be aggregated from multiple sources. Data
may have to be imported from other relational databases, non-relational databases, flat files,
legacy systems, or even manual paper-and-pencil systems
4. Testing and Evaluation:
In the design phase, decisions were made to ensure integrity, security, performance, and
recoverability of the database. During implementation and loading, these plans were put into
place. In testing and evaluation, the DBA tests and fine-tunes the database to ensure that it
performs as expected. This phase occurs in conjunction with applications programming.
a. Test the Database: During this step, the DBA tests the database to ensure that it maintains
the integrity and security of the data. Data integrity is enforced by the DBMS through the proper
use of primary and foreign key rules. In database testing you must check Physical security
allows, Password security, Access rights, Data encryption etc.
b. Fine-Tune the Database: Although database performance can be difficult to evaluate
because there are no standards for database performance measures, it is typically one of the most
important factors in database implementation. Different systems will place different performance
requirements on the database. Many factors can impact the database’s performance on various
tasks. Environmental factors, such as the hardware and software environment in which the
database exists, can have a significant impact on database performance.
c. Evaluate the Database and Its Application Programs: As the database and application
programs are created and tested, the system must also be evaluated from a more holistic
approach. Testing and evaluation of the individual components should culminate in a variety of
broader system tests to ensure that all of the components interact properly to meet the needs of
the users. To ensure that the data contained in the database are protected against loss, backup and
recovery plans are tested.
5. Operation
Once the database has passed the evaluation stage, it is considered to be operational. At that
point, the database, its management, its users, and its application programs constitute a complete

10
information system. The beginning of the operational phase invariably starts the process of
system evolution.
6. Maintenance and Evolution
The database administrator must be prepared to perform routine maintenance activities within the
database. Some of the required periodic maintenance activities include:
• Preventive maintenance (backup).
• Corrective maintenance (recovery).
• Adaptive maintenance (enhancing performance, adding entities and attributes, and so on).
• Assignment of access permissions and their maintenance for new and old users.

1.3 Requirements Analysis.


Requirements Analysis is the stage in the design cycle when you find out everything you can
about the data the client needs to store in the database and the conditions under which that data
needs to be accessed.
Keep in mind, too, that a single pass through this stage rarely yields all the information the
database designer needs. Be prepared to return to the tasks associated with Requirements
Analysis several times during the course of designing a database.
Collecting Data
Collecting data is relatively easy, but turning raw information into something useful requires that
you know how to extract precisely what you need. In this module, intermediate to experienced
programmers interested in data analysis will learn techniques for working with data in a business
environment.
You will learn how to look at data to discover what it contains, how to capture those ideas in
conceptual models, and then feed your understanding back into the organization through
business plans, metrics dashboards, and other applications. Along the way, you will experiment
with concepts through hands-on exercises at various points in the moule.
1. Use graphics to describe data with one, two, or dozens of variables
2. Develop conceptual models using back-of-the-envelope calculations, as well as scaling
and probability arguments
3. Mine data with computationally intensive methods such as simulation and clustering
4. Make your conclusions understandable through reports, dashboards, and other metrics
programs
5. Understand financial calculations, including the time value of money
6. Use dimensionality reduction techniques or predictive analytics to conquer challenging
data analysis situations
7. Become familiar with different open source programming environments for data analysis
11
Purpose of Requirements Analysis
The overall purpose of Requirements Analysis is to gather every bit of information needed to
design a database that meets the informational needs of an organization. This is accomplished by
performing a series of related tasks:
1. Examine the existing database(s)
2. Conduct user interviews
3. Create a data flow diagram (if needed)
4. Determine user views
5. Document all findings
DBLC Requirements Analysis
As mentioned earlier in this course, Requirements Analysis is the most important and most
labor-intensive stage in the DBLC. It is critical for the designer to approach Requirements
Analysis armed with a plan for each task in the process.
Experience is the great teacher when it comes to assessing informational needs, but there is no
substitute for preparation, especially for new designers. Most database designers begin
Requirements Analysis by examining the existing database(s) to establish a framework for the
remaining tasks.
Analyzing how an organization stores data about its business objects, and scrutinizing its
perception of how it uses stored data (for example, gaining familiarity with its business rules)
provides that framework.
Interview both Producers and Users of Data
The database requirements are determined by interviewing both the producers and users of data
and using the information to produce a formal requirements specification.
That specification includes the data required for processing, the natural data relationships, and
the software platform for the database implementation.
For example, products, customers, salespersons, and orders can be formulated in the mind of the
end user during the interview process.
The information needed to build a data model is gathered during the requirements analysis.
Although not formally considered part of the data modeling stage by some methodologies, in
reality
1) the requirements analysis and
2) the ER diagramming part of the data model are done at the same time.
Requirements Analysis
The goals of the requirements analysis are:

12
1. To determine the data requirements of the database in terms of primitive objects
2. To classify and describe the information about these objects
3. To identify and classify the relationships among the objects
4. To determine the types of transactions that will be executed on the database and the
interactions between the data and the transactions
5. To identify rules governing the integrity of the data
The modeler works with the end users of an organization to determine the data requirements of
the database. Information needed for the requirements analysis can be gathered in several ways:
Review of existing documents:
Such documents include existing forms and reports, written guidelines, job descriptions, and
personal narratives. Paper documentation is a good way to become familiar with the organization
or activity you need to model.
Interviews with end Users
These can be a combination of individual or group meetings. Try to keep group sessions to under
five or six people. If possible, try to have everyone with the same function in one meeting. Use a
blackboard or overhead transparencies to record information gathered from the interviews.
Review of existing automated systems: If the organization already has an automated system,
review the system design specifications and documentation. The requirements analysis is usually
done at the same time as the data modeling. As information is collected, data objects are
identified and classified as either entities, attributes, or relationship. They are then assigned
names and defined using terms familiar to the end-users. The objects are then modeled and
analyzed using an ER diagram. The diagram can be reviewed by the modeler and the end-users
to determine its completeness and accuracy. If the model is not correct, it is modified, which
sometimes requires additional information to be collected. The review and edit cycle continue
until the model is certified as correct.
1.4 Database Design
What is Database Design?
Database design can be generally defined as a collection of tasks or processes that enhance the
designing, development, implementation, and maintenance of enterprise data management
system.
Designing a proper database reduces the maintenance cost thereby improving data consistency
and the cost-effective measures are greatly influenced in terms of disk storage space. Therefore,
there has to be a brilliant concept of designing a database. The designer should follow the
constraints and decide how the elements correlate and what kind of data must be stored.
The main objectives behind database designing are to produce physical and logical design
models of the proposed database system. To elaborate this, the logical model is primarily
concentrated on the requirements of data and the considerations must be made in terms of

13
monolithic considerations and hence the stored physical data must be stored independent of the
physical conditions.
On the other hand, the physical database design model includes a translation of the logical design
model of the database by keep control of physical media using hardware resources and software
systems such as Database Management System (DBMS).
Why is Database Design important?
The important consideration that can be taken into account while emphasizing the importance of
database design can be explained in terms of the following points given below.
1. Database designs provide the blueprints of how the data is going to be stored in a system.
A proper design of a database highly affects the overall performance of any application.
2. The designing principles defined for a database give a clear idea of the behavior of any
application and how the requests are processed.
3. Another instance to emphasize the database design is that a proper database design meets
all the requirements of users.
4. Lastly, the processing time of an application is greatly reduced if the constraints of
designing a highly efficient database are properly implemented.
Life Cycle

the life cycle of a database is not an important discussion that has to be taken forward in this
article because we are focused on the database design. But, before jumping directly on the
designing models constituting database design it is important to understand the overall workflow
and life-cycle of the database.
1. Requirement Analysis
First of all, the planning has to be done on what are the basic requirements of the project under
which the design of the database has to be taken forward. Thus, they can be defined as: -
Planning - This stage is concerned with planning the entire DDLC (Database Development Life
Cycle). The strategic considerations are taken into account before proceeding.
System definition - This stage covers the boundaries and scopes of the proper database after
planning.

14
2. Database Designing
The next step involves designing the database considering the user-based requirements and
splitting them out into various models so that load or heavy dependencies on a single aspect are
not imposed.
Therefore, there has been some model-centric approach and that's where logical and physical
models play a crucial role
Physical Model - The physical model is concerned with the practices and implementations of the
logical model.
Logical Model - This stage is primarily concerned with developing a model based on the
proposed requirements. The entire model is designed on paper without any implementation or
adopting DBMS considerations.
3. Implementation
The last step covers the implementation methods and checking out the behavior that matches our
requirements.
It is ensured with continuous integration testing of the database with different data sets and
conversion of data into machine understandable language.
The manipulation of data is primarily focused on these steps where queries are made to run and
check if the application is designed satisfactorily or not.

Data conversion and loading - This section is used to import and convert data from the old to
the new system.

Testing - This stage is concerned with error identification in the newly implemented system.
Testing is a crucial step because it checks the database directly and compares the requirement
specifications.

1.4 Database Design Process

The process of designing a database carries various conceptual approaches that are needed to be
kept in mind. An ideal and well-structured database design must be able to:

1. Save disk space by eliminating redundant data.


2. Maintains data integrity and accuracy.
3. Provides data access in useful ways.
4. Comparing Logical and Physical data models.

Logical

15
A logical data model generally describes the data in as many details as possible, without having
to be concerned about the physical implementations in the database. Features of logical data
model might include:

1. All the entities and relationships amongst them.


2. Each entity has well-specified attributes.
3. The primary key for each entity is specified.
4. Foreign keys which are used to identify a relationship between different entities are
specified.
5. Normalization occurs at this level.

A logical model can be designed using the following approach:

1. Specify all the entities with primary keys.


2. Specify concurrent relationships between different entities.
3. Figure out each entity attributes
4. Resolve many-to-many relationships.
5. Carry out the process of normalization.

Also, one important factor after following the above approach is to critically examine the design
based on requirement gathering. If the above steps are strictly followed, there are chances of
creating a highly efficient database design that follows the native approach.

If we compare the logical data model as shown in the figure above with some sample data in the
diagram, we can come up with facts that in a conceptual data model there are no presence of a
primary key whereas a logical data model has primary keys for all of its attributes. Also, logical

16
data model the cover relationship between different entities and carries room for foreign keys to
establish relationships among them.

Physical

A Physical data mode generally represents how the approach or concept of designing the
database. The main purpose of the physical data model is to show all the structures of the table
including the column name, column data type, constraints, keys (primary and foreign), and the
relationship among tables. The following are the features of a physical data model:

1. Specifies all the columns and tables.


2. Specifies foreign keys that usually define the relationship between tables.
3. Based on user requirements, de-normalization might occur.
4. Since the physical consideration is taken into account so there will straightforward
reasons for difference than a logical model.
5. Physical models might be different for different RDBMS. For example, the data type
column may be different in MySQL and SQL Server.

While designing a physical data model, the following points should be taken into consideration:
1. Convert the entities into tables.
2. Convert the defined relationships into foreign keys.
3. Convert the data attributes into columns.
4. Modify the data model constraints based on physical requirements.

Comparing this physical data model with the logical with the previous logical model, we might
conclude the differences that in a physical database entity names are considered table names and

17
attributes are considered column names. Also, the data type of each column is defined in the
physical model depending on the actual database used.
Entity - An entity in the database can be defined as abstract data that we save in our database.
For example, a customer, products.
Attributes - An attribute is a detailed form of data consisting of entities like length, name, price,
etc.
Relationship - A relationship can be defined as the connection between two entities or figures.
For example, a person can relate to multiple persons in a family.
Foreign key - It acts as a referral to the Primary Key of another table. A foreign key contains
columns with values that exist only in the primary key column they refer to.
Primary key - A primary key is the pointer of records that is unique and not null and is used to
uniquely identify attributes of a table.
Normalization - A flexible data model needs to follow certain rules. Applying these rules is
called normalizing.

1.5 Entity-Relational model (ER model)


 ER model stands for an Entity-Relationship model. It is a high-level data model. This
model is used to define the data elements and relationship for a specified system.
 It develops a conceptual design for the database. It also develops a very simple and easy
to design view of data.
 In ER modeling, the database structure is portrayed as a diagram called an entity-
relationship diagram.
For example, suppose we design a school database. In this database, the student will be an entity
with attributes like address, name, id, age, etc.
The address can be another entity with attributes like city, street name, pin code, etc. and there
will be a relationship between them.

Component of ER Diagram

18
1. Entity:
An entity may be any object, class, person or place. In the ER diagram, an entity can be
represented as rectangles.
Consider an organization as an example- manager, product, employee, department etc. can be
taken as an entity.

a. Weak Entity
An entity that depends on another entity called a weak entity. The weak entity doesn't contain
any key attribute of its own. The weak entity is represented by a double rectangle.

2. Attribute
The attribute is used to describe the property of an entity. Eclipse is used to represent an
attribute.
For example, id, age, contact number, name, etc. can be attributes of a student.

19
a. Key Attribute
The key attribute is used to represent the main characteristics of an entity. It represents a primary
key. The key attribute is represented by an ellipse with the text underlined.

b. Composite Attribute
An attribute that composed of many other attributes is known as a composite attribute. The
composite attribute is represented by an ellipse, and those ellipses are connected with an ellipse.

c. Multivalued Attribute
An attribute can have more than one value. These attributes are known as a multivalued attribute.
The double oval is used to represent multivalued attribute.
For example, a student can have more than one phone number.

20
d. Derived Attribute:
An attribute that can be derived from other attribute is known as a derived attribute. It can be
represented by a dashed ellipse.
For example, a person's age changes over time and can be derived from another attribute like
Date of birth

3. Relationship
A relationship is used to describe the relation between entities. Diamond or rhombus is used to
represent the relationship.

Types of relationship are as follows:


a. One-to-One Relationship
When only one instance of an entity is associated with the relationship, then it is known as one to
one relationship.
For example, a female can marry to one male, and a male can marry to one female.

b. One-to-many relationship
When only one instance of the entity on the left, and more than one instance of an entity on the
right associates with the relationship then this is known as a one-to-many relationship.
For example, Scientist can invent many inventions, but the invention is done by the only
specific scientist.

21
c. Many-to-one relationship
When more than one instance of the entity on the left, and only one instance of an entity on the
right associates with the relationship then it is known as a many-to-one relationship.
For example, Student enrolls for only one course, but a course can have many students.

d. Many-to-many relationship
When more than one instance of the entity on the left, and more than one instance of an entity on
the right associates with the relationship then it is known as a many-to-many relationship.
For example, Employee can assign by many projects and project can have many employees.

1.6 Enhanced ER model


Extended ER is a high-level data model that incorporates the extensions to the original ER
model. Enhanced ER models are high level models that represent the requirements and
complexities of complex databases.
The extended Entity Relationship (ER) models are three types as given below −
 Aggregation
 Specialization
 Generalization
Specialization
The process of designing sub groupings within an entity set is called specialization. It is a top-
down process. If an entity set is given with all the attributes in which the instances of the entity

22
set are differentiated according to the given attribute value, then that sub-classes or the sub-entity
sets can be formed from the given attribute.
Example
Specialization of a person allows us to distinguish a person according to whether they are
employees or customers. Specialization of account creates two entity sets: savings account and
current account.

In the E-R diagram specialization is represented by triangle components labeled ISA. The ISA
relationship is referred as superclass- subclass relationship as shown below –
Generalization
It is the reverse process of specialization. It is a bottom-up approach.
It converts subclasses to super classes. This process combines a number of entity sets that share
the same features into higher-level entity sets.
If the sub-class information is given for the given entity set then, ISA relationship type will be
used to represent the connectivity between the subclass and superclass as shown below −
Example

23
Aggregation
It is an abstraction in which relationship sets are treated as higher level entity sets and can
participate in relationships. Aggregation allows us to indicate that a relationship set participates
in another relationship set.
Aggregation is used to simplify the details of a given database where ternary relationships will
be changed into binary relationships. Ternary relation is only one type of relationship which is
working between three entities.

24
1.7 UML Class Diagram
The UML Class diagram is a graphical notation used to construct and visualize object-oriented
systems. A class diagram in the Unified Modeling Language (UML) is a type of static structure
diagram that describes the structure of a system by showing the system's:
 classes,
 their attributes,
 operations (or methods),
 and the relationships among objects.
What is a Class?
A Class is a blueprint for an object. Objects and classes go hand in hand. We can't talk about one
without talking about the other. And the entire point of Object-Oriented Design is not about
objects, it's about classes, because we use classes to create objects. So a class describes what an
object will be, but it isn't the object itself.
In fact, classes describe the type of objects, while objects are usable instances of classes. Each
Object was built from the same set of blueprints and therefore contains the same components
(properties and methods). The standard meaning is that an object is an instance of a class and
object - Objects have states and behaviors.
Example
A dog has states - color, name, breed as well as behaviors -wagging, barking, eating. An object is
an instance of a class.

UML Class Notation

25
A class represent a concept which encapsulates state (attributes) and behavior (operations). Each
attribute has a type. Each operation has a signature. The class name is the only mandatory
information.

Class Name:
 The name of the class appears in the first partition.
Class Attributes:
 Attributes are shown in the second partition.
 The attribute type is shown after the colon.
 Attributes map onto member variables (data members) in code.
Class Operations (Methods):
 Operations are shown in the third partition. They are services the class provides.
 The return type of a method is shown after the colon at the end of the method signature.
 The return type of method parameters is shown after the colon following the parameter
name. Operations map onto class methods in code

Class Visibility
The +, - and # symbols before an attribute and operation name in a class denote the visibility of
the attribute and operation.

26
 + denotes public attributes or operations
 - denotes private attributes or operations
 # denotes protected attributes or operations
Parameter Directionality
Each parameter in an operation (method) may be denoted as in, out or inout which specifies its
direction with respect to the caller. This directionality is shown before the parameter name.

Perspectives of Class Diagram


The choice of perspective depends on how far along you are in the development process.
During the formulation of a domain model, for example, you would seldom move past the
conceptual perspective. Analysis models will typically feature a mix of conceptual and
specification perspectives. Design model development will typically start with heavy emphasis
on the specification perspective, and evolve into the implementation perspective.
A diagram can be interpreted from various perspectives:
1. Conceptual: represents the concepts in the domain
2. Specification: focus is on the interfaces of Abstract Data Type (ADTs) in the software
3. Implementation: describes how classes will implement their interfaces
The perspective affects the amount of detail to be supplied and the kinds of relationships
worth presenting. As we mentioned above, the class name is the only mandatory information.

Relationships between classes

27
UML is not just about pretty pictures. If used correctly, UML precisely conveys how code
should be implemented from diagrams. If precisely interpreted, the implemented code will
correctly reflect the intent of the designer. Can you describe what each of the relationships mean
relative to your target programming language shown in the Figure below?
If you can't yet recognize them, no problem this section is meant to help you to understand UML
class relationships. A class may be involved in one or more relationships with other classes. A
relationship can be one of the following types:

Inheritance (or Generalization): A generalization is a taxonomic relationship between a more


general classifier and a more specific classifier. Each instance of the specific classifier is also an
indirect instance of the general classifier. Thus, the specific classifier inherits the features of the
more general classifier.
 Represents an "is-a" relationship.
 An abstract class name is shown in italics.
 SubClass1 and SubClass2 are specializations of SuperClass.
The figure below shows an example of inheritance hierarchy. SubClass1 and SubClass2 are
derived from SuperClass. The relationship is displayed as a solid line with a hollow arrowhead
that points from the child element to the parent element.

Inheritance Example - Shapes

28
The figure below shows an inheritance example with two styles. Although the connectors are
drawn differently, they are semantically equivalent.

Association
Associations are relationships between classes in a UML Class Diagram. They are represented
by a solid line between classes. Associations are typically named using a verb or verb phrase
which reflects the real world problem domain.
Simple Association
 A structural link between two peer classes.
 There is an association between Class1 and Class2
The figure below shows an example of simple association. There is an association that connects
the <<control>> class Class1 and <<boundary>> class Class2. The relationship is displayed as a
solid line connecting the two classes.

Cardinality: Cardinality is expressed in terms of:


 one to one
 one to many
 many to many

29
Aggregation
A special type of association.
 It represents a "part of" relationship.
 Class2 is part of Class1.
 Many instances (denoted by the *) of Class2 can be associated with Class1.
 Objects of Class1 and Class2 have separate lifetimes.
The figure below shows an example of aggregation. The relationship is displayed as a solid line
with an unfilled diamond at the association end, which is connected to the class that represents
the aggregate.

Composition
 A special type of aggregation where parts are destroyed when the whole is destroyed.
 Objects of Class2 live and die with Class1.
 Class2 cannot stand by itself.
The figure below shows an example of composition. The relationship is displayed as a solid line
with a filled diamond at the association end, which is connected to the class that represents the
whole or composite.

Dependency

30
An object of one class might use an object of another class in the code of a method. If the object
is not stored in any field, then this is modeled as a dependency relationship.
 A special type of association.
 Exists between two classes if changes to the definition of one may cause changes to the
other (but not the other way around).
 Class1 depends on Class2
The figure below shows an example of dependency. The relationship is displayed as a dashed
line with an open arrow.

The figure below shows another example of dependency. The Person class might have a hasRead
method with a Book parameter that returns true if the person has read the book (perhaps by
checking some database).

Realization
Realization is a relationship between the blueprint class and the object containing its respective
implementation level details. This object is said to realize the blueprint class. In other words, you
can understand this as the relationship between the interface and the implementing class.
For example, the Owner interface might specify methods for acquiring property and disposing of
property. The Person and Corporation classes need to implement these methods, possibly in very
different ways

.
Class Diagram Example: Order System

31
Class Diagram Example: GUI
A class diagram may also have notes attached to classes or relationships.

32
33

You might also like