960 likes | 1.11k Views
Chap. 8 Object-Oriented Databases. 서울대학교 컴퓨터공학부 SNU Internet Data Base Lab 교수 김 형 주. Contents. Introduction Foundation and Evolution of OODBs Persistence in OODBs Transactions & Concurrency Control in OODBs Recovery in OODBs Versioning Client/Server Architecture and OODBs.
E N D
Chap. 8 Object-Oriented Databases 서울대학교 컴퓨터공학부 SNU Internet Data Base Lab 교수 김 형 주
Contents • Introduction • Foundation and Evolution of OODBs • Persistence in OODBs • Transactions & Concurrency Control in OODBs • Recovery in OODBs • Versioning • Client/Server Architecture and OODBs
Introduction Object-Oriented Databases Object Orientation Database Capabilities Abstract Data Typing Inheritance Object Identity Persistence Concurrency Transactions Recovery Querying Versioning Integrity Security Performance
Overview of DBMS Concepts (1) • Persistence • the ability of objects to persist different program invocations • Transactions • units are executed either entirely or not at all (atomicity). • Concurrency control • to guarantee database and transaction consistency
Overview of DBMS Concepts (2) • Recovery • three types of failures: • transaction failure • system failure • media failure • Querying • queries are used to select subsets and subobjects from database collection objects or sets • Versioning • consists of tools & constructs to automate or simplify the construction & organization of versions or configuration
Overview of DBMS Concepts (3) • Integrity • the predicates that capture the consistency of a database • Security • Encryption algorithms • User access control mechanism • Performance issues • indexes or accelerators • clustering techniques • query optimization
Approaches to OODB (1) • Novel database data model/data language approach • the most aggressive approach for incorporating OO capabilities into DB • ODMG93: ODL, OQL. OML • Extending an existing DB language with OO capabilities • e.g. extending SQL with object-oriented constructs • Intelligent SQL • UniSQL
Approaches to OODB (2) • Extending an existing OOPL with DB capabilities • e.g. OODB extensions have been incorporated in C++ and Smalltalk as language extension • Gemstone’s OPAL (Smalltalk extension) • Providing extendible OODBMS system libraries • C++ client library for database management • Ontos, Versant
Approaches to OODB (3) • Embedding OODB language constructs in a host language • e.g. O2 provides embedded extensions for C and Basic • Application-specific products with an underlying OO DBMS • Echelon: OODBMS for XML • Multimedia content server
Approaches to OODBs: Summary • Novel database data model/data language approach • Extending an existing DB languages with OO capabilities • Extending an existing OOPL with database capabilities • Providing extendible OODBMS libraries • Embedding OODB language constructs in a host language • Application-specific products with an underlying OODBMS
Contents • Introduction • Foundation and Evolution of OODBs • Persistence in OODBs • Transactions & Concurrency Control in OODBs • Recovery in OODBs • Versioning • Client/Server Architecture and OODBs
Foundation and Evolution of OODBs • The hierarchical data model • The network data model • The relational data model • Set-and-Tuple complex object models • Semantic data models
Hierarchical Data Model • This model represents the structures of the persistent DB • as a collection of tree • node ( a set of objects of the same type ) • relationship ( one-to-many (parent: child) ) • 70’s: IBM IMS • COBOL, PL/I
< The hierarchical data model > Parent Child #1 Child #N ………….
A hierarchical representation of desktops, folders, documents Desktop 2 Desktop 1 Folder 13 Folder 12 Folder 11 Document 112 Document 111
Network Model • This model is more general than the hierarchical model. • same record type can be • owner (parent) • member (child) • 70’s: System 2000 • COBOL, PL/I
< The network model > Owner #1 Owner #n ……………….. Member B Member A Member C
1 Contains Drawer N Desktop 1 N 1 Contains Contains Contains 1 N N Folder Cabinet 1-to-M relationships supported by the network model
Relational Model • Navigational (how) • in a hierarchical or a navigational DB • Declarative (what) • in a relational DB • Constitution of RDB • relation(table) : row+column • 1970, E.F. Codd (IBM) • Relational Calculus, Relational Algebra • 1976: Ingres (UC Berkely), System/R (IBM SanJose)
Relational DB for Intelligent offices Columns Folders C1 C2 CN Desktops Rows Documents Intelligent Office Tables
Set-&-Tuple complex object Model • 1985: Khoshafisian & Bancillon • Set-&-Tuple complex object model • have been proposed to the relational model with nested relations • attribute values can be tuples or sets • Set valued attributes • Relation valued attributes • Extending SQL • extending relational calculus permitting sets • extending relational algebra permitting sets
Semantic Data Model • Semantic data model • node --- entity, object • link --- relationship • semantic v.s. object-oriented model • entity type v.s. class • entity v.s. instance • attribute v.s. instance variable • So many proposals (1980-1986) • GEM, Association Model, SDM, RM/T, ……
Integrity Constraints for OODBs • Unique/primary key constraints • Existential constraint • NOT NULL constraint • Integrity rules • Triggers • Pre- and postconditions for methods • Disjointness constraint • Covering constraint
Contents • Introduction • Foundation and Evolution of OODBs • Persistence in OODBs • Transactions & Concurrency Control in OODBs • Recovery in OODBs • Versioning • Client/Server Architecture and OODBs
Persistence in OODBs • Ways to create and maintain persistent objects • 3 strategies to create & identify persistent objects: • persistent classes and class extensions • persistence through reachability • persistence instances
Persistent classes and class extensions • System built-in persistent classes • Subclasses of built-in persistent classes are persistent • Understand as ADT constructor and Container classes • Most cases: COLLECTION classes (set, bag, list, array) • Iterators (for navigating persistent instances)
Persistence through Reachability Application’s Object Space Persistent Object Space Transient Object Space DB X Y Z
Declaring Persistent & Transient instances Persistent Instances Transient Instances Archival Documents Query Result Accounts New Folder Invoices
Main Stream to Manipulate Persistent OODBs • Strategies for persistence in OODBs • extending a DB language with OO capability • extending SQL with OO features • IntelligentSQL, UniSQL • extending an OO language with DB capabilities • language extension: making Smalltalk an OODBMS • extendible library: Ontos, Versant
Extending SQL with OO • SQL standards • SQL-89 • SQL-92 • Currently SQL-3 standardization effort incorporates OO features • user-defined abstract data typing • inheritance • set, collection types • object identity
Case Study (ORDB): Intelligent SQL • Prototype developed at Ashton-Tate that extended SQL and the InterBase DB engine • Main concepts of object orientation • abstract data types • inheritance • tuples and object identity • extended dot “.” notation • identity
Intelligent SQL: Abstract Data Type CREATE CLASS Stack[T] { INSTANCE VARIABLE ( ARRAY StArr[M] of T, Top INTEGER); METHODS ( push ….. ( ……); pop ….. (…….); } CREATE TABLE Account( AccountNumber INTEGER, Location CHAR(20) Payables Stack[Dollar]) SELECT AccountNumber, Pop(Payables) FROM Account WHERE Location = “New York”
Intelligent SQL: Inheritance CREATE TABLE OfficeWorker ( Name CHAR(20), Address CHAR(100), Workeroffice CHAR(10), Salary FLOAT, DateOfBirth DATE) CREATE TABLE Manager SPECIALIZES OfficeWorker ( Title CHAR(10)) CREATE TABLE VicePresident SPECIALIZES Manager (AdminAssistant CHAR(20)) SELECT Address FROM Manager WHERE Salary > 60K CREATE TABLE HighlyPaidWorker SPECIALIZES OfficeWorkers WHERE Salary > 60,000
Intelligent SQL: Tuple and OID CREATE TUPLE ADDRESS ( Number INTEGER, StrtName CHAR (20), AptNo INTEGER, City CHAR(20), State CHAR(20), Zip INTEGER); CREATE TABLE Persons ( Name CHAR (20), Age INTEGER, HomeAddr ADDRESS); CREATE TABLE Persons( Name CHAR(20), Age INTEGER, HomeAddr TUPLE ( Number INTEGER, StrtName CHAR (20), AptNumber INTEGER, City CHAR(20), State CHAR(20), Zip INTEGER) )
Case Study (ORDB): UniSQL • Won Kim at UniSQL, Inc. • SQL/X is an extension of the SQL-89 with OO extensions • direct reference to table records • ability to associate procedures or methods with table definitions • support of table inheritance • support of collection types in relations
UniSQL CREATE CLASS IMAGE ( Size INTEGER, Type INTEGER, Content …) CREATE CLASS PERSON ( Name CHAR (32), … Picture IMAGE); CREATE CLASS MAP ( MapName CHAR(32), MapRegion CHAR(32); MapImage set IMAGE)
Extending OOPL with DB Capabilities • Two alternatives • use language extensions that enrich the OO language with database capabilities • GemStone’s OPAL by ServioLogic • provide extendible OODBMS libraries • C++ libraries for database management by Ontos, Versant, Objectivity, and ObjectDesign
Case Study (PL Ext): OPAL • Making Smalltalk as a DB language • OPAL is the GemStone’s DDL and DML • Defining a class in OPAL Receiving_class_name subclass ‘Name_subclass’ instVarName: ListofInstanceVariables classVars: ListofClassVariables poolDictionaries: ListofCommonVariables inDictionary: DictionaryName constraints: ListofDomainConstraints InstanceInvariant: False/True isModifiable: False/True
Case Study (PL Ext): OPAL Richworker := Workers select: {:aworker | aworker.salary > 60000} Jones := Workers select: { :aworker | (aWorker.age > 21) & (aWorker.name.last = “Jones”)}
C++ Classes for DB capabilities • Class libraries supporting persistence and DB capabilities • constructors new with various parameters • methods to destroy the persistent object • methods to read/write object from/to DB • methods to lock/unlock the object • predicate to check the object’s modification • Persistent classes are defined by their inheritance from a root persistent class
< Persistent classes routed at PersistentObject > PersistentObject PersistentFolder PersistentWorker PersistentPeripheral Persistent AccountFolder Persistent SalesPersion Persistent Scanner
Case Study (Library): Versant • OODBMS from Versant Object Technology • Supports C, C++, and Smalltalk interface • Persistent root class PObject provides • new operator • delete method • className(), isPersistent(), isInstanceOf(),... • object management methods • version management methods
Case Study (Library): ObjectStore (1) • ObjectStore ODBMS from ObjectDesign, Inc. • A number of high-performance capability • Any object type can be persistent or transient // Create an instance of office_type Officeapp *officeobject = new(officedb, office_type) // Declare binding of a variable to a database Database *officedb; …………….. officedb = os_database::open(“/office/officedb”);
Case Study (Library): ObjectStore (2) • Collections and Querying in ObjectStore • ObjectStore collection classes : • os_Collection, os_Set, os_Bag, os_List • The general form for executing a query is : <collection-object>.os_query( <element type name>, <query string>, <database> ) corporateOffices[: size > 200 :];
Persistent Complex Object Storage Strategies(Fast Object Access!!!) • Two complementary storage techniques • indexing to accelerate the searches • conventional indexing techniques are applicable • B-tree, primary/secondary index, hashing, etc. • clustering to store objects that are accessed together as close as possible • graph structured object space are mapped onto physical storage units such as pages, segments
Mapping complex object spaces onto secondary-storage disk pages Page 1 Page 2 ………….. Persistent Object Space Physical Disk Pages
Case Study (Clustering): ObjectStore • ObjectStore • persistent address space • concurrently sharable • its size is larger than that of virtual address space • theoretical 2^29 bytes/DB • Main memory < Virtual Memory < Persistent Memory • Several disks can be used for persistent memory • A database can have many segments • Clustering objects in the segments improve the performance
ObjectStore & VM extend views of memory in similar way Persistent Memory Physical memory VM OS Paging System
Case Study (Clustering): GemStone • GemStone • specify how objects should be clustered (e.g.) MyObject cluster clusterPerson self cluster. name cluster. age cluster. Soc-sec-num cluster. Address cluster. address streetNum cluster address streetName cluster address State cluster
Contents • Introduction • Foundation and Evolution of OODBs • Persistence in OODBs • Transactions & Concurrency Control in OODBs • Recovery in OODBs • Versioning • Client/Server Architecture and OODBs