Object Database Systems

download Object Database Systems

of 58

Transcript of Object Database Systems

  • 8/12/2019 Object Database Systems

    1/58

    23 July 2014 16.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    2/58

    Introduction1. Relational database systems support a small, fixed

    collection of data types (e.g., integers, dates, strings),which has proven adequate for traditionalapplication domains

    Eg: administrative data processing.

    2. In many application domains, much more complex

    kinds of data must be handled.3. Typically this complex data has been stored in OS file

    systems or specialized data structures, rather than ina DBMS.

    23 July 2014 26.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    3/58

    Introduction

    Why OODBMS?

    Let us start with modeling this simple example in a

    RDBMS Assume that we are given the following diagram

    0,0

    1

    2

    34

    5

    6 7

    8

    23 July 2014 36.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    4/58

    Introduction

    Motivating Example Our objective is to store this graph in a RDBMS and

    support queries on these simple geometries What kind of relations we need?

    Print names of rectangles which are squares

    Find all objects which are inside the rectangle 7.

    0,0

    1

    2

    34

    5

    67

    8

    23 July 2014 46.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    5/58

    Introduction

    Motivating Example Relations

    POINT(pname, x, y), EDGE(ename, aPoint), RECTANGLE(rname,anEdge).

    0,0

    1

    2

    34

    5

    67

    8

    r5 e1

    r5 e2

    r5 e3

    r5 e4

    e1 p1

    e1 p2

    e2 p2

    e2 p3

    e3 p3

    e3 p4

    e4 p4

    e4 p1

    p1 3 4

    p2 3 10

    p3 10 10

    p4 10 4

    RECTANGLE

    EDGEPOINT

    23 July 2014 56.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    6/58

    Introduction

    Though we can model and query these simplegeometric objects, its Not clean

    Complexity increases with complex objects (like irregularpolygons)

    Even with these simple objects, how do you answer querieslike find nearest objects to point 2 or find all intersectingobjects

    What is lacking Support for complex data types

    Support for predicates (e.g., area, intersect, length)

    23 July 2014 66.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    7/58

    Relational Databases Traditionally, could not represent files such as

    pictures, audio and video natively (only BLOB)

    23 July 2014 76.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    8/58

    Features offered by a DBMS1. reduced application development time,2. concurrency control and recovery,

    3. indexing

    4. support, andquery capabilities Are increasingly attractive and, ultimately,

    necessary.

    In order to support multimedia applications, a DBMSmust support complex data types.

    Object-oriented concepts have strongly influencedefforts to enhance database support for complex dataand have led to the development of object-databasesystems,

    23 July 2014 86.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    9/58

    Object-database systems have developed along two distinctpaths:

    Object-oriented database systems: Object-orienteddatabase complex objects play a central role. The approach isheavily influenced by object-oriented programming languagesand can be understood as an attempt to add DBMSfunctionality to a programming language environment.

    Object-relational database systems: Object-relationaldatabase systems can be thought of as an attempt to extendrelational database systems with the functionality necessary to

    support a broader class of applications and, in many ways,provide a bridge between the relational and object-orientedparadigms.

    23 July 2014 96.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    10/58

    OODBMS: A Solution? Started in the 1980s

    Integrates database capabilities with OO programminglanguage capabilities

    Makes database objects appear as programminglanguage objects in an existing language (such as JAVA,C++ or Smalltalk)

    Relational Model is no longer valid: objects are relatedthrough inheritance and polymorphism

    More of a persistent programming language than aDBMS

    23 July 2014 106.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    11/58

  • 8/12/2019 Object Database Systems

    12/58

    OO Advantages OO principles brought to databases:

    New modeling power

    Extensibility of systems Code reuse

    Easy maintenance of programs

    However, it is only recently that OO programming has

    itself really taken off.

    23 July 2014 126.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    13/58

    The drawbacks No clear standard

    (ODMG did come up with one, but it was not accepted by themajor OODBMS vendors)

    Lack of interoperability with traditional RDBMS tools(such as OLAP, backup and recovery, reporting, etc)

    Seen by some as a lost opportunity to revolutionizesoftware and database development

    Today, there are more products that perform object-sqlmaping than there are pure OODBMS

    23 July 2014 136.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    14/58

    Relational Database (revisited) Represents data in a table

    Think of displaying this information in a spreadsheet

    Requires indexing and sorting which takes time SQL may not be able to get the information we need in

    a complex query

    23 July 2014 146.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    15/58

    DefinitionsFrom Stonebraker: Object-Relational DBMSs: TheNext Great Wave

    Filesystems: no query

    RDBMS: query, simple data

    ODBMS: no (poor) query,complex data

    ORDBMS: query & complex (Picture Akmal Chaudri)

    23 July 2014 156.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    16/58

    OODBMS Terminology Object Identity:An object is denoted in a unique way

    in the database system, using an identifier or OID(object identifier) that the objects keeps during itsentire lifetime, independently of its attribute values.

    23 July 2014 166.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    17/58

    OODBMS Terminology Type: the type of an object corresponds to its

    structure and to the operations that can be

    performed on it. Atomic types, such as strings and integer

    Complex types are defined using constructors (tuplesor set constructors).

    An object (o) can have as an atomic value not onlya string or real but also the OID of another objecto. Object o is said to consist of object o

    23 July 2014 176.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    18/58

    OODBMS Terminology Objects with the same type are grouped into classes.

    Classes encompass objects having the same structure

    and behaviour, which is expressed by the set ofmethods or operations applicable to the objects theycontain.

    23 July 2014 186.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    19/58

    OODBMS TerminologyADTs:Abstract data types combinations of data

    types (e.g., polygon) and their operations (e.g.,PolygonArea [an operation that would compute

    the area of a polygon]). Note that the DBMS neednot have any knowledge on the ADTimplementation (i.e., the code corresponding tothe operations).

    ADTs are encapsulated in the sense that they areaccessible only through the operations that aredefined on them.

    23 July 2014 196.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    20/58

    ADTs have been regularized in the sense that thegeographic dimension (e.g., points, line segments[nodes only have two arcs], complex polylines [nodescan have two or more connected arcs], polygons) isused to clearly distinguish between them.

    23 July 2014 206.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    21/58

    OODBMS Terminology Inheritance: Subclasses are defined from an existing

    superclass with a refinement of its structure. Subclasses inherit methods and structures from the superclass (e.g.,

    all methods defined for the superclass can be used in the subclass).

    However, a subclass can redefine a method defined in thesuperclass.

    A subclass can also have methods defined only for that subclass.This leads to polymorphism.

    The subclass is a specialization of the superclass, and thesuperclass is a generalization of the subclass.

    A subclass can inherit from many superclasses.

    23 July 2014 216.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    22/58

    OODBMS Terminology Most OO DBMS use OQL rather than SQL as their

    query language.

    OQL is aware of the complex structures present inthe OODBMS, and can return complex results.

    SQL is used as the DDL, DQL and DML (datadefinition, data query, and data manipulationlanguage).

    In OODBMS, the primary means of developing thedatabase is through the native OO language.

    23 July 2014 226.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    23/58

    object-oriented database management

    systems (OODBMSs)

    The data in object-oriented database managementsystems (OODBMSs) is managed through two sets ofrelations, one describing the interrelations of dataitems and another describing the abstract

    relationships (inheritance).

    23 July 2014 236.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    24/58

    object-oriented database management

    systems (OODBMSs) The strong connection between application and

    database results in less code, more natural datastructures, and better maintainability and reusability

    of code. OO languages, such as C++ or Java, are able toreduce code size by not having to translate code into adatabase sublanguage such as SQL and ODBC or JDBC.

    23 July 2014 246.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    25/58

    New Data Types User-dened abstract data types (ADTs):

    Structured types:

    Inheritance:

    23 July 2014 256.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    26/58

    23 July 2014 6.OBJECT-DATABASE SYSTEMS/D.S JAGLI 26

  • 8/12/2019 Object Database Systems

    27/58

    The rich variety of data types in an ORDBMS oers adatabase designer many opportunities

    for a more natural or more effcient design.

    23 July 2014 276.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    28/58

    differences between RDBMS and

    ORDBMS database design Structured Types and ADTs

    23 July 2014 286.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    29/58

    23 July 2014 296.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    30/58

    Introduction to Object-Relational DBMSs Several major software companies including IBM,

    Informix, Microsoft, Oracle, and Sybase have allreleased object-relational versions of their products.

    These companies are promoting a new, extendedversion of relational database technology calledobject-relational database management systemsalso known as ORDBMSs.

    23 July 2014 306.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    31/58

    23 July 2014 31

    Does a database supporting complex applications have to be

    object-oriented?

    A certain group thinks that future applications canonly be implemented with pure object-orientedsystems. Initially these systems looked promising.

    However, they have been unable to live up to theexpectations.

    A new technology has evolved in which relationaland object-oriented concepts have been combined

    or merged. These systems are called object-relational database systems.

    The main advantages of ORDBMSs are massivescalability and support for object-oriented

    features. 6.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    32/58

    Advantages of ORDBMSs The main advantages of extending the relational

    data model come from reuseand sharing.

    Reuse comes from the ability to extend the DBMSserver to perform standard functionality centrally,rather than have it coded in each application.

    If we can embed the functionality in the server, itsaves having to define it in each application thatneeds it, and consequently allows the functionalityto be shared by all applications.

    23 July 2014 326.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    33/58

    Disadvantages of ORDBMSs The ORDBMSs approach has the obvious disadvantage of

    complexity and associated increased costs.

    There are proponents of the relational approach thatbelieve the essential simplicity and purity of the relationalmodel are lost with these types of extension.

    There are also those that believe that the RDMSs is beingextended for what will be a minority of applications that donot achieve optimal performance with current relationaltechnology.

    23 July 2014 336.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    34/58

    Disadvantages of ORDBMSs (Cont.) Instead of discussing object models, terms like user-

    defined data types are used. The terminology of object-orientation abounds with terms like abstract types. classhierarchies, and object models. However, ORDBMSs

    vendors are attempting to portray object models asextensions to the relational model with some additionalcomplexities.

    This potentially misses the point of object-orientation,

    highlighting the large semantic gap between these twotechnologies.

    23 July 2014 346.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    35/58

    Relational DBMS The relational model was formally introduced by

    Dr. E. F. Codd in 1970 and has evolved since then,through a series of writings and later throughimplementations by IBM and others. The definingstandard for relational databases is published by

    ANSI (the American National Standard Institute)

    as SQL (ANSI 1986) or SQL1, called SQL-86. Arevised standard is called SQL2, also referred to asSQL-92.

    23 July 2014 356.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    36/58

    Relational DBMSA relational database is composed of many

    relations in the form of two-dimensional tables ofrows and columns containing related tuples.

    Organizing data into tables, the form in whichdata is presented to the user and the programmer,is known as the logical viewof the database. The

    stored data on a computer disk system is called theinternal view. The rows (tuples) are calledrecordsand the columns (fields in the record) arecalled attributes.

    23 July 2014 366.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    37/58

  • 8/12/2019 Object Database Systems

    38/58

    RDBMSs RDBMSs use Structured Query Language (SQL,

    currently SQL2) as the data definition language(DDL) and the data manipulation language(DML).

    SQL includes statements for data definition,modification, querying and constraint

    specification. The types of queries vary fromsimple single-table queries to complicated multi-table queries involving joins, nesting, setunion/differences, and others.

    23 July 2014 386.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    39/58

    disadvantages of Relational DatabasesAll processing is based on values in fields of

    records. Examples of RDBMSs include Oracle,developed by Oracle Corporation, and Microsoft

    Access developed by Microsoft.

    The main disadvantages of Relational Databasesinclude their inability to handle application areaslike spatial databases (e.g. CAD), applicationsinvolving images, special types databases (e.g.complex numbers, arrays, etc.) and otherapplications that involve complexinterrelationships of data.

    23 July 2014 396.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    40/58

  • 8/12/2019 Object Database Systems

    41/58

    Object-Oriented DBMS (OODBMS)

    The concept of abstract data types (ADTs) inwhich the internal data structure is hidden and the

    external operations can be applied on the objectthat is specified led to the concept ofencapsulation.

    The programming language SMALLTALK,developed by Xerox, was designed to be object-oriented. Other object-oriented programminglanguages include C++, Java, etc.

    23 July 2014 416.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    42/58

    Object-Oriented DBMS (OODBMS) The main features of OO programming languages are

    encapsulation, inheritance and polymorphism.

    Encapsulation can be thought as a protective layerthat prevents the code and the data from beingaccessed by other code defined outside the layer.

    23 July 2014 426.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    43/58

    Object-Oriented DBMS (OODBMS)

    The process in which one object inherits theproperties of a previously defined object is calledinheritance. Inheritance aids in the reuse ofexisting definitions for creating new objects.

    Polymorphism allows the same operator orsymbol to have different implementations,depending on the type of objects to which theoperator is applied.

    23 July 2014 436.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    44/58

    object-oriented database management

    systems (OODBMSs)

    The data in object-oriented database managementsystems (OODBMSs) is managed through two sets ofrelations, one describing the interrelations of dataitems and another describing the abstract

    relationships (inheritance).

    23 July 2014 446.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    45/58

    object-oriented database management

    systems (OODBMSs) The strong connection between application and

    database results in less code, more natural datastructures, and better maintainability and reusability

    of code. OO languages, such as C++ or Java, are able toreduce code size by not having to translate code into adatabase sublanguage such as SQL and ODBC orJDBC.

    23 July 2014 456.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    46/58

    Changing the lack of defining the lack of a defining standard was a drawback for

    OODBMSs.

    The Object Data Management Group (ODMG) hasproposed a standard known as ODMG-93 or ODMG1.0 standard , now revised into ODMG 2.0.

    23 July 2014 466.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    47/58

    Consists The standard consists of the object model, the object

    defining language (ODL), the object query language(OQL), and the bindings to OO programming

    languages.

    The ODL and OQL are based on the ODMG data

    model.

    23 July 2014 476.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    48/58

    Data Model The data model consists of data types, type

    constructors, etc., and is similar to the SQL reportthat describes the standard model for relationaldatabases.

    The ODL is designed so as to support semantic

    constructs of ODMG 2.0 object model. It isindependent of any programming language. TheODL is used to create object specifications.

    23 July 2014 486.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    49/58

    Data Model (cont.) The OQL is designed to work closely with the

    programming languages for which an ODMGbinding is defined such as C++, Java and

    SMALLTALK.

    The syntax of the OQL queries is similar to thesyntax of SQL (a query language for relationaldatabases) with some additional features such asobject identity, complex objects, inheritance,polymorphism and relationships.

    23 July 2014 496.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    50/58

    OODBMSsAn object-oriented language is the language for both

    the application and the database. OODBMSs havebeen integrated with C++, C, Java and LISP.

    The primary interface in an OODBMS for creating andmodifying objects is directly via the object language(C++, Java, etc.) using the native language syntax.

    23 July 2014 506.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    51/58

    Difference between relational databases

    and OO databases The difference between relational databases and

    OO databases is the way in which relationships arehandled.

    In OO databases, the relationships are representedwith OIDs, which improves the data accessperformance.

    In relational databases, relationships among tuplesare specified by attributes having the samedomain.

    23 July 2014 516.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    52/58

    OODBMSs Problems The main drawback of OODBMSs has been poor

    performance. Unlike RDBMSs, query optimizationfor OODBMs is highly complex.

    OODBMSs also suffer from problems of scalability,and are unable to support large-scale systems.Some examples of OODBMSs are O2 (now called

    Ardent) developed by Ardent Software, and theObjectStore system produced by Object DesignInc.

    23 July 2014 526.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    53/58

    Object-Relational DBMS (ORDBMS)An ORDBMS supports an extended form of SQL

    called SQL3 that is still in the development stages.The extensions are needed because ORDBMSs

    have to support ADT's.

    The ORDBMS has the relational model in itbecause the data is stored in the form of tableshaving rows and columns and SQL is used as thequery language and the result of a query is alsotable or tuples (rows).

    23 July 2014 536.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    54/58

    characteristics of an ORDBMSs Base datatype extension,

    Support complex objects, Inheritance, and

    23 July 2014 546.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    55/58

    Users define datatypes

    Object-Relational Database Management Systems(ORDBMSs) allow users to define data types, functionsand operators.

    As a result, the functionality of the ORDBMSsincreases along with their performance.

    23 July 2014 556.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    56/58

    An example schema of a student relation

    which ORDBMS supports

    STUDENT(fname,lname,ID,sex,major,address,dname,location,picture)

    Notice : extra attributes "location" and "picture"which are not present in the traditionalEMPLOYEE relation of RDBMS. The datatype of

    "location" is "geographic point" and "picture" is"image".

    23 July 2014 566.OBJECT-DATABASE SYSTEMS/D.S JAGLI

  • 8/12/2019 Object Database Systems

    57/58

    The differencesbetween the three approaches

    23 July 2014 57

    Criteria RDBMS ODBMS ORDBMSDefining standard SQL2 ODMG-2.0 SQL3 (in process)

    Support for object-

    oriented featuresDoes not support;

    It is difficult to mapprogram object to the

    database

    Supports extensively Limited support;mostly to new data

    type

    Usage Easy to use OK for programmers;some SQL access for

    end users

    Easy to use except for

    some extensions

    Support for complex

    relationshipsDoes not support

    abstract datatypesSupports a wide

    variety of datatypes

    and data with complex

    inter-relationships

    Supports Abstract

    datatypes and complex

    relationships

    Performance Very good

    performance

    Relatively less

    performanc

    Expected to perform

    very well6.OBJECT-DATABASE SYSTEMS/D.S JAGLI

    Th diff b h h

  • 8/12/2019 Object Database Systems

    58/58

    The differences between the three

    approachesCriteria RDBMS ODBMS ORDBMS

    Product maturity Relatively old and so verymature

    This concept is few yearsold and so relatively maturfeature

    Still in development stageso immature

    The use of SQL Extensive supports SQL OQL is similar to SQL, butwith additional features like

    Complex objects andobject-oriented features

    SQL3 is being developedwith OO features

    incorporated in it

    Advantages Its dependence on SQL,relatively simple queryoptimization hence goodperformance

    It can handle all types ofcomplex applications,reusability of code, lesscoding

    Ability to query complexapplications and ability tohandle large and complexapplications

    Disadvantage Inability to handle complexapplications

    Low performance due tocomplex query optimization,

    inability to support large-scale systems

    Low performance in webapplication

    Support from vendors It is considered to behighly successful so themarket size is very largebut many vendors aremoving towards ORDBMS

    Presently lacking vendorsupport due to vast size ofRDBMS market

    All major RDBMS vendorsare after this so has verygood future