Database Technology
Outline
Part I: OO DB
Concepts for Object-oriented Databases Object database standard & languages and design Object relational and extended relational databases Overview of database types and database applications
Part II
3/17/2012 Abrehet M. 2
Database Technology
Outline(cont.)
Part II: Distributed Database System
Distributed DBMS Architecture Distributed Database Design Overview of Query Processing Query Decomposition and Data Localization Optimization of Distributed Queries
3/17/2012
Abrehet M.
Database Technology
Why OODB?
Traditional database models and systems has shortcomings to develop complex DB application. Complex database applications:
Geographic Information Systems, Multimedia (audio, image, video)
It demands:
longer duration transactions, data types for storing images or large textual items, define non-standard application specific operations.
3/17/2012
Abrehet M.
Database Technology
Introduction
Prerequisites are: Relational databases and SQL Object oriented programming
3/17/2012
Abrehet M.
Database Technology
Introduction
OODB
DBMS persistence Storage management concurrency recovery querying OOPL types & classes complex objects object identity encapsulation class hierarchy Polymorphism
Abrehet M. 6
3/17/2012
Database Technology
Introduction
Review of Object Oriented Programming Concepts Different object oriented database technologies
3/17/2012
Abrehet M.
Database Technology
3/17/2012
Abrehet M.
Database Technology
Database Technology
3/17/2012
Abrehet M.
10
Database Technology
Objects
An object is described by four characteristics
Identifier: a system-wide unique id for an object Name: an object may also have a unique name in DB (optional) Lifetime: determines if the object is persistent or transient Structure: Construction of objects using type constructors
3/17/2012
Abrehet M.
11
Database Technology
Objects
The state (current value) of a complex object may be constructed from other objects (or other values) by using certain type constructors
Can be represented by (i,c,v) i is an unique id c is a type constructor v is the object state
3/17/2012 Abrehet M. 12
Database Technology
Objects
Constructors
Basic types: atom, tuple and set
atom- basic data types Set- a set of OIDs {i1 , i2, ..., in}, a tuple of the form <al:il, a2:i2, ..., an:in>,
3/17/2012
Abrehet M.
13
Database Technology
Example
3/17/2012
Abrehet M.
14
Database Technology
Objects
Complex objects:
01 = (i1 ,atom, 'Houston') O2 = (i2, atom, 'Bellaire') 03 = (i3, atom, 'Sugarland') 04 = (i4, atom, 5) 05 = (i5, atom, 'Research') 06 = (i6, atom, '1988-05-22') 07 = (i7, set, {i1, i2, i3}) 09 = (i9, tuple, <MANAGER:i12, MANAGER_START_DATE:i6)
3/17/2012
Abrehet M.
15
Database Technology
A combination OODB with OOPL provides persistent and shared object capabilities. Object structure of arbitrary complexity allows necessary information that describes the object.
3/17/2012
Abrehet M.
16
Database Technology
3/17/2012
Abrehet M.
17
Database Technology
Object identity
In OOPL:
Each object gets a unique identifier: OID. OIDs need not be specified explicitly. This OID does not change during the whole lifetime of the object. (when the object's values change).
In OODB:
Used for objects (representation of real world object) not to lose their integrity and identity. as primary key in relational model
3/17/2012 Abrehet M. 18
Database Technology
Inheritance
class Point {private: int x, y; public: Point (int px = 0, int py = 0) {x=px; y=py;} move (int dx, int dy) {x+=dx; y+=dy;} int draw (); } subclass class Rectangle: public Point {private: int height, width; public: Rectangle (int x, int y, int height, int width); int draw (); } A rectangle class has attributes x, y, width and height. It allows to develop the data types of a system incrementally.
3/17/2012 Abrehet M. 19
Database Technology
OODB: Inheritance
3/17/2012
Abrehet M.
20
Database Technology
Article
Title
year
Bpage
Epage
ISBN
Book
Title
year
ISBN
Price
3/17/2012
Abrehet M.
21
Database Technology
Java implementation
public class Author { private long id; Private String name; Private Date birthday; privateSet<Publication> publications; Author() { } public Author(String name) {this.name = name; this.publications= new HashSet<Publication>();} ... }
3/17/2012
public class Publication { private String title; Private int year; Private List<Author> authors; Public Publication(String title) {this.title= title; this.authors= new ArrayList<Author>();} public String getTitle() {return this.title;} public void setTitle(String title) {this.title= title;} ... }
Abrehet M. 22
Database Technology
Java implementation
public class Article extends Publication { private long Beginpage; private long Endpage; Article() { } ... } public class Book extends Publication { private float price; Book() { }
... }
3/17/2012
Abrehet M.
23
Database Technology
3/17/2012
Abrehet M.
24
Database Technology
Aggregation
Objects may consist of component objects
class Line { private: Point start, end; int linewidth; public: Line (int xs, int ys, int xe, int ye, int lw); int draw (); }
Database Technology
3/17/2012
Abrehet M.
26
Database Technology
Polymorphism
public class GeoObject { private String shape; float Area; Point ReferencePoint; public class Rectangle extends GeoObject { private float Width, Height; Rectangle() {Shape='rectangle' } Area(float W, float H) { Area=W*H;} ... }
... }
3/17/2012
Abrehet M.
27
Database Technology
Polymorphism
public class Triangle extends GeoObject { private float height, base; Triangle() {Shape=triangle' }
Area(float B, float H) { Area=.;}
public class Circle extends GeoObject { private float radius; Circle() {Shape=Circle' }
Area(float radus) { Area=.;}
... }
... }
Database Technology
3/17/2012
Abrehet M.
29
Database Technology
Advantages of OODBS
Designer can specify the structure of objects and their behavior (methods) Better interaction with object-oriented languages such as Java and C++ Definition of complex and user-defined types Encapsulation of operations and user-defined methods
3/17/2012 Abrehet M. 30
Database Technology
3/17/2012
Abrehet M.
31
Database Technology
3/17/2012
Abrehet M.
32
Database Technology
Result
Name
Ford Mustang Mercedes SLK
3/17/2012
- The statement queries a relational database. => Returns a table with rows.
Abrehet M. 33
Database Technology
3/17/2012
Abrehet M.
Database Technology
3/17/2012
Abrehet M.
35
Database Technology
3/17/2012
Abrehet M.
36
Database Technology
Relational Databases
Data organised as tuples in relations. Link between data tuples.
primary and foreign keys
Database Technology
Object-oriented application development and relational data management results in clash of two incompatible models. Code to map between models is considerable overhead, costly and hard to maintain
3/17/2012 Abrehet M. 38
Database Technology
Database Technology
3/17/2012
Abrehet M.
40