department of computer engineering

25
Department of Computer Engineering MASTER THESIS OBJECT DATA MODELING AS STRUCTURING APPROACH IN DATABASE DESIGN Name : Anwar Mahmoud Dawoud Supervisor : Assist. Prof. Dr. Adil Amirjanov

Upload: merv

Post on 12-Jan-2016

27 views

Category:

Documents


6 download

DESCRIPTION

Department of Computer Engineering. Near East University. OBJECT DATA MODELING AS STRUCTURING APPROACH IN DATABASE DESIGN. MASTER THESIS. Name : Anwar Mahmoud Dawoud Supervisor : Assist. Prof. Dr. Adil Amirjanov. Introduction. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Department of Computer Engineering

Department of Computer Engineering

MASTER THESIS

OBJECT DATA MODELING AS STRUCTURING APPROACH IN DATABASE DESIGN

Name : Anwar Mahmoud Dawoud

Supervisor : Assist. Prof. Dr. Adil Amirjanov

Page 2: Department of Computer Engineering

• One of the approach for simplification of the database design is to use object modeling of data .

• In this thesis the object data modeling is used as structuring approach for database design.

• The concept of the Object Relational DB System (ORDBS) as a hybrid of the RDBS and OODBS.

• The ORDBMS provide Object Definition Language(ODL), and a Object Query Language(OQL).

Introduction

Page 3: Department of Computer Engineering

• Objects

• Object-oriented programming.

• A Database system.

• Object Relational Databases.

• Object-Oriented Databases.

Object Data Modeling

Some Basic Concepts :

Page 4: Department of Computer Engineering

Simplified Picture Of A Database System

Database

Database Management System (DBMS)

Application programs End Users

Page 5: Department of Computer Engineering

Database Capabilities ConcurrencyTransactions

RecoveryQuery

Security

Integrity

Persistence

Object Oriented Modeling Complex objects

Attributes

Classes

Object identity

OverridingEncapsulation

Behaviors

Inheritance

Naming

Makeup of an Object Oriented Database

An Object Oriented Database is the marriage of Object Oriented modeling and Database Technology

Page 6: Department of Computer Engineering

Basic Object Oriented Modeling

1. Complex Objects

2. Object Identity

3. Classes and Types.

4. Attributes

5. Behaviors

6. Encapsulation

7. Inheritance.

8. Overloading, Overriding, and Late Binding

9. Naming

Page 7: Department of Computer Engineering

Client Server Architectures

( a )object server

Objects Store

(b )page server

(c )database server

Objects Store

Application Object Manager Object ServerRequests

Objects

Objects Store

DB Manager Object ServerAddresses

Pages

Application Comms Object ServerSQL

Tables

Application

Page 8: Department of Computer Engineering

Strategies For Handling Method

(b )Storing method in database.

Objects Store

Application Object ManagerRequests

Objects

File 1

Objects Store

Application Object Manager

Object Server

Object ServerRequest

Objects

File 2 File 3

( a )Storing method outside database

Page 9: Department of Computer Engineering

Database Capabilities

1. Integrity 1.1 Relationships Integrity 1.2 Nulls Integrity 1.3 Referential Integrity 1.4 Entity integrity2. Concurrency Control3. Recovery4. Transactions5. Security

Page 10: Department of Computer Engineering

Classification of DBMSs

Data Complexity Extensibility

Relational DBMS

File Systems

Object-Relational DBMS

Object-Oriented DBMS

Sea

rch

Cap

abil

itie

s m

ult

i-u

ser

Su

pp

ort

Page 11: Department of Computer Engineering

The object features proposed in SQL3 covering: • Row types.• User-defined types (distinct types and structured types) • User-defined Routines (procedure, functions).• Polymorphism.• Supertype and subtype relationships.• Persistent stored modules.• Support for large objects.

Classification of DBMSs

Page 12: Department of Computer Engineering

Object Relational Algebra

Union Intersection Difference

abc

xy

aabbcc

xyxyxy

Product

Page 13: Department of Computer Engineering

Object Relational Algebra

ProjectRestrict

a1a2a3

b1b1b2

a1a2a3

b1b1b2

a1a2a3

b1b1b2

a1a2a3

(Normal) Join

abc

xz

aaabc

xyzxy

Divide

a

Page 14: Department of Computer Engineering

Object Relational SQL

These SQL statements define the structure of a database, DDL SQL statements are more part of the DBMS and have large differences between the SQL variations. CREATE; ALTER, DROP are called DDL COMMANDS.

1- DDL (Data Definition Language)

DDL transact with tables, views, types, procedures, functions and triggers.

Page 15: Department of Computer Engineering

Object Relational SQL

These SQL statements are used to retrieve and manipulate data.

2- DML (Data Manipulation Language)

DML SQL commands include the following:

INSERT to add a row. UPDATE to change data in specified columns. DELETE to remove rows. SELECT to retrieve row.

Page 16: Department of Computer Engineering

The Customer And Employee Entity Relationship Diagrams

Emp_no

Emp_name

Emp_birth

Nationality_id

Emp_id

Position_id

Department_id

Emp_sex

Emp_marital_status

Emp_phone

Emp_Email

Emp_address

Nationality_id

Nationality_name

Position_id

Position_name

Department_id

Department_name

PK

PK

PK

FK

FK

FK

EMPLOYEE

NATIONALITY

POSITION

DEPARTMENT

Database Design With Object Data Modeling

Cus_no

Good_serial

Good_name

Good_price

Good_sale_date

GOODSCus_no

Cus _name

Cus_birth

Cus_id

Cus_sex

Cus_phone

Cus_Email

Cus_address

CUSTOMER

PK

FK

Page 17: Department of Computer Engineering

New Data Types

Birth_ty

Phone_ty

Address_ty

Name_ty

New Data Types

FnameMnameLname

MobileHome

DOBPOB

CityStreet

Page 18: Department of Computer Engineering

New DataType that used in Employee & Customer Tables

New Data Types

Birth_ty

Phone_ty

Address_ty

Name_ty

Emp_no

Emp_name

Emp_birth

Nationality_id

Emp_id

Position_id

Department_id

Emp_sex

Emp_martial_status

Emp_phone

Emp_Email

Emp_address

Cus_no

Cus _name

Cus_birth

Cus_id

Cus_sex

Cus_phone

Cus_Email

Cus_address

Page 19: Department of Computer Engineering

Create Table Customer )

Cus_No

Number)9(Primary Key,

FnameVarchar2)25(,

MnameVarchar2)25(,

LnameVarchar2)25(,

DOBDate,

POBVarchar2)25(,

Cus_Id

Number)9(,

Cus_Sex

Number)1(,

MobileVarchar2)13(,

HomeVarchar2)13(,

Cus_Email

Varchar2)25(,

CityVarchar2)25(,

StreetVarchar2)25((;

The Object Definition Language ) ODL (

Create table without using objects

Create Table Customer )

Cus_No

Number)9(Primary key,

Cus_Name

Name_Ty,

Cus_Birth

Birth_Ty,

Cus_Id

Number)9(,

Cus_Sex

Number)1(,

Cus_Phone

Phone_Ty,

Cus_Email

Varchar2)25(,

Cus_Address

Address_Ty(;

Create table with Using objects )new defined types(

Page 20: Department of Computer Engineering

The Customer Table Before And After Using Objects

Cus_name

Cus_birth

Cus_phone

Cus_address

Cus_no

Fname

Mname

Lname

DOB

POB

Cus_id

Cus_sex

Phone

Home

Cus_Email

City

Street

Cus_no

Cus _name

Cus_birth

Cus_id

Cus_sex

Cus_phone

Cus_Email

Cus_address

CUSTOMER

BEFORE

USING

OBJECTS

CUSTOMER

AFTER

USING

OBJECTS

Page 21: Department of Computer Engineering

The Object Definition Language ) ODL (

Create Or Replace View Employee_Vw As

SelectE.Emp_No,

E.Emp_Name,

E.Emp_Birth,

N.Nationality_Name,

P.Position_Name,

D.Department_Name

FromEmployee E , Nationality N , Position P , Department D

WhereN.Nationality_Id = E.Nationality_Id

And

P.Position_Id = E.Position_Id And

D.Department_Id = E.Department_Id;

Create view without using objects Create view with Using objects )new defined types(

Create Or Replace View Employee_Vw As

SelectE.Emp_No,

E.Fname,

E.Mname,

E.Lname,

E.DOB

E.POB

N.Nationality_Name,

P.Position_Name,

D.Department_Name

FromEmployee E , Nationality N , Position P , Department D

WhereN.Nationality_Id = E.Nationality_IdAnd

P.Position_Id = E.Position_Id And

D.Department_Id = E.Department_Id;

Page 22: Department of Computer Engineering

Create Or Replace Procedure New_Employee)Employee_NoInNumber,

Employee_FnameInVarchar2,

Employee_MnameInVarchar2,

Employee_LnameInVarchar2,

Employee_DobInDate,

Employee_PobInVarchar2(

AsBeginInsert Into Employee)Emp_No,Fname,Mname, Lname, Dob, Pob(

Values)Employee_No,Employee_Fname,Employee_Mname, Employee_Lname,Employee_Dob ,Employee_Pob(;

End;

Create Or Replace Procedure New_Employee

)Employee_No InNumber,

Employee_Name

InName_Ty,

Employee_BirthInBirth_Ty (

AsBegin

Insert Into Employee)Emp_No,Emp_Name,Emp_Birth(

Values)Employee_No,Employee_Name,Employee_Birth(;

End;

The Object Definition Language ) ODL (

Create procedure without using objects Create procedure with Using objects )new defined types(

Page 23: Department of Computer Engineering

Insert Into Employee ) Emp_No, Fname, Mname, Lname, Dob , Pob (

Values )

20043315,'Anwar', 'M', 'Dawoud', '12-Nov-82', 'Palistine' (;.

Insert Into Employee) Emp_No, Emp_Name , Emp_Birth (

Values )20043315,

Name_Ty)'Anwar','M','Dawoud'(,

Birth_Ty)'12-Nov-82','Palistine'( (;

The Object Query Language ) OQL (

UpdateEmployee

SetEmp_Name=Name_Ty)'Ahmed','A','Dalo'(

WhereEmp_No=20043815;

UpdateEmployee

SetFname='Ahmed', Mname='A', Lname='Dalo'

WhereEmp_No=20043815;

Insert Statement Without Using Objects Insert Statement With Using Objects

Update Statement Without Using Objects Update Statement With Using Objects

Page 24: Department of Computer Engineering

DeleteFrom Employee

WhereEmp_Name=Name_Ty)'Ahmed', 'R', 'Dawoud'(;

SelectEmp_No, Emp_Name

FromEmployee;

The Object Query Language ) OQL (

DeleteFrom Employee

WhereFname='Ahmed'And

Mname='R' And

Lname='Dawoud';

SelectE.Emp_No, E.Fname, E.Mname, E.Lname

FromEmployee E;

Delete Statement Without Using Objects Delete Statement With Using Objects

Select Statement Without Using Objects Select Statement With Using Objects

Page 25: Department of Computer Engineering

The thesis analyzes the features of Object Structured Query Language (OSQL) that includes Object Data Definition Language and Object Query Language. This analysis with discussion of the advantages of OSQL was made by structuring the problem with object data modeling in Trading

Company Database Design .

The comparisons of the SQL statements made with and without objectfeatures showed that the implementing object data modeling approach in database design gets the following advantages:

• Simplify the design by reduction of the steps of abstractions for mapping the real life problem to the database structure design;• Simplify the structuring of problem by using object data modeling• Reduce the number of SQL statements in query descriptions;

Conclusion