ontos ( formerly vbase) presentation - class csci 397c student: son doan date: november 11, 1999

Post on 21-Dec-2015

217 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ONTOS ( formerly VBase)

Presentation - class CSCI 397CStudent: Son Doan

Date: November 11, 1999

ONTOS (formerly VBase)

Introduction What is ONTOS (formerly VBase)? Basic Architecture of ONTOS Applications Setup a Working Database Using DBATool Accessing Persistent Objects Metaschema Transaction control Object SQL

Introduction

GemStone from Servio Corporation, based on SMALLTALK.

ONTOS from Ontos,Inc., based on C++. O2 from O2 Technology,based on O2C. ObjectStore, based on C++. Objectivity/DB, based on C++. Versant, based on C++.

Approaches for OO DBMSs

Extend a programming language.

Example: GemStone (extends SMALLTALK)

Extend a data model such as relational

data model with object-oriented features.

Example: Oracle, IBM DB2

Provide extendible object-oriented DBMS

libraries. Example: ONTOS

What is ONTOS?

A commercial product of Ontos of Billerica, Massachussettes

Based on making C++ into a database programming language

Provides a persistent object store for C++ Activate and deactivate objects Handle concurrency Incorporate ObjectSQL

Application Process

Virtual Application code

Memory

Client

Local Area Network

ONTOS’ Client-Server Architecture

ONTOS’ Client-Server Architecture (cont.)

Local Area Network

Database Primary Secondary

Registry Server Server

File System File System

Distributed database

ONTOS object database

A distributed database and based on the client/server architecture for data interaction.

The server side manages the data store The client side provides the interface to

user processes and manages the mapping of data to the application process’ virtual memory space.

Large data-intensive applications

3 major components of the integrated object system:

The kernel database: “meta-schema” basic functionality.

The class libraries and the header files The utility programs

Setup a Working Database Using DBATool

% cd <dir> % cp /usr/local/ONTOS/ONTOSDB/db/OntosSchema

myKernel % DBATool >> register kernel tutorialKern on <host> at

<dir>/myKernel >> register database tutorialDB with kernel

tutorialKern >> quit

Accessing Persistent Objects

Naming of Objects

Activation of Persistent Objects

Deactivation of Persistent Objects

Deletion of Objects

Naming of Objects

The name of an object can serve as an

entry point to the database.

The name of an object is typically set in

the constructor.

Name is an inherited attribute from the

root class Object.

Naming of Objects (Example)

class Thing: public Object {

private:

int priv_value;

public:

Thing(int aValue, char* theName);

int getValue();

void setValue();

};

Naming of Objects (Example)

// Constructor

Thing::Thing(int aValue, char* theName) : Object ( theName ) {

priv_value = aValue;

}

A Thing can then be created as follows:

myThing = new Thing(someValue, “myFavoriteThing”);

Access a persistent object

ONTOS’s class Object provides the function OC_lookup() to access a particular object in the database

Example:

Thing *myThing = (Thing*)OC_lookup(“myFavoriteThing”);

Activation of Persistent Objects

Activation initiates transferring the object’s state from the database to main-memory and transforming references.

A single object: using OC_lookup(). All objects contained in an Aggregate: using

OC_getCluster() All objects reachable from a particular object:

using OC_getClosure().

Activation of Persistent Objects

Object OC_lookup ( char *objectName,

LockType lock = readLock, …);

Object OC_getCluster ( char *clusterName,

LockType lock = readLock, …);

Object OC_getClosure ( char *objectName,

LockType lock = readLock, …);

Deactivation of Persistent Objects

An object is deactivated with the operation void Object::putObject();

An entire Aggregation is deactivated with void Aggregate::putCluster(…);

Implicitly achieved by deleting with

void Object::deleteObject();

void Object::deleteCluster();

Metaschema

Metaschema provides the underlying support that allows a form of access called programmatic access to database.

Metaschema classes include:- Type- PropertyType- PropertyIterator

Metaschema (Example)

Type* the ThingType = (Type*) OC_lookup ( “Thing” );

Type* propertyType = (Type*) OC_lookup ( “Thing::priv_value” );

PropertyIterator* propIter = new PropertyIterator ( theThingType );

while ( propIter->moreData() ) {

// get result with operator() function

… }

Compare OntosDB with C++

OntosDB C++

============================= Type class Property data member Procedure member function Supertype base class Subtype derived class

Transaction Control

In a database with many concurrent users, conflict between users must be resolved.

Atomicity of change Transaction data pool 3 kinds of transactions:

– Basic transactions– Nesting transactions– Shared transactions

Basic Transactions

3 graduations for locking objects: read lock, write lock, or no lock.

The interface to the transaction mechanism consists of 3 functions: TransactionStart TransactionCommit TransactionAbort

Nesting Transactions

Transaction may be nested (i.e., multiple TransactionStart calls without intervening commits or aborts are activated).

Nested transactions make long transactions more practical. A single long transaction can be divided into a series of many small nested transactions.

Shared Transactions

Cooperating processes can share a single transaction.

The first process to issue a TransactionStart call initiates the transaction. Subsequent processes issuing a TransactionStart call with the same name simply join it.

A shared transaction may be thought of as one in which the transaction data pool is visible to all processes participating.

ObjectSQL

The interface of the two incompatible

systems C++ and Ontos utilizes

QueryIterator class.

Begin with OC_startQuerySession()

End with OC_endQuerySession().

ObjectSQL (Example)

OC_startQuerySession();

QueryIterator *myQuery;

myIter = new QueryIterator(“(select * from Thing where getValue() = 100)”);

while(myIter->moreData()) {

// get each Thing and process it somehow

}

delete myIter;

OC_endQuerySession();

ObjectSQL (cont.)

The resulting collection of objects satisfying the SQL query can be obtained by using QueryIterator::moreData().

To get each object of the result collection, use QueryIterator::YieldRow()

Example:ArgumentList *anArgList = myIter->YieldRow();

Entity *ptr = (Entity *) (*anArgList)[0];

References Alfons Kemper. Object-Oriented Database Management.

Prentice Hall, New Jersey, 1994. George Wilkie. Object-Oriented Software Engineering.

Addison-Wesley, 1993. R.G.G. Cattell. Object Data Management. Addison-Wesley,

1991. James A. Larson. Database Directions. Prentice Hall, New

Jersey, 1995. Setrag Khoshafian, Razmik Abnous. Object Orientation.

John Wiley & Sons, Inc., 1995. A.A van Rossum. URL:

http://is.twi.tudelft.nl/databases/1996/ontos/report/ontos.html

top related