Lecture 2

Introduction to Object-oriented

Dr Goran Nenadic MSS/H10 School of Informatics, University of Manchester

1

Aims

¢ Understand the need for object oriented DBs ¢ Learn basic concepts and principles ¢ Learn the basics of ODL and OQL ¢ Understand advantages and disadvantages of object databases

2

Plan

¢ Overview of object-oriented methodology ¢ Object model (ODMG) ¢ Object definition language (ODL) ¢ Object query language (OQL) ¢ Object and object-relational DBs

3

CN3023, Databases 3, 2005/2006, School of Informatics 1 Problems with relational DBs

¢ focused on traditional business applications ¢ limited data types and operators £ limited data abstraction ¢ definition of additional specific types and operators is not straightforward £ need to be embedded in application programs ¢ insulation between data and operations

4

continued Problems with relational DBs

¢ integration with OO languages £ storage of complex objects from a Java program is not straightforward ¢ need for £ abstract data types £ encapsulation of operations £ inheritance £ better integration with programming languages

5

OODBs œ introduction

¢ Integration of two technologies: OO programming and DBs ¢ Main ideas £ raise the level of abstraction £ provide direct —correspondence“ between real-world and objects ¢ objects do not lose their integrity and identity and can easily be identified and operated upon

6

CN3023, Databases 3, 2005/2006, School of Informatics 2 OODBs œ objects

¢ An object belongs to a specific class ¢ Have structure, state (value), behavior (operations), identity, name(s) ¢ Object structure of arbitrary complexity £ in order to contain all of the necessary information ¢ Contrast to traditional database systems £ information about a complex object is often scattered over many relations or records, leading to loss of direct correspondence between a real-world object and its database representation

7

OODBs œ operations

¢ Applied to objects of a particular type £ includes non-standard application-specific operations ¢ Operations can be invoked by passing a message to an object £ includes the operation name and the parameters ¢ Operator polymorphism/overloading £ ability to be applied to different types of objects £ operation name may refer to several distinct implementations, depending on the type of objects it is applied to

8

Brief overview of OO concepts

¢ Classes and objects ¢ Object identity ¢ Encapsulation and information hiding ¢ Inheritance ¢ Polymorphism

9

CN3023, Databases 3, 2005/2006, School of Informatics 3 Classes and objects

¢ A class is a construct used to describe the structure of objects generated from the class £ can be an abstract data type equipped with a possible partial implementation ¢ An object is an instance of a class

¢ Note £ some languages make distinction between types (data types) and classes (collections)

10

Object identity (OID)

¢ An object has an existence and identity independent of its value £ Object Identity (OID) is unique £ not visible to the users, but used internally to identify each object ¢ Note £ there are also values, which do not have OIDs £ values cannot be referenced (e.g. constants)

11

Type constructors

¢ Used to construct state (current value) of a complex object from other objects ¢ object = (OID, type constructor, current state) ¢ Basic constructors £ atom: represent all basic atomic values (numbers, strings, Booleans, etc) £ tuple (i.e. struct) £ collection types: set, list, bag, array

12

CN3023, Databases 3, 2005/2006, School of Informatics 4 Type constructors œ example

Student (OiD3, tuple)

name (OiD1, atom, John)

student-id (OiD2, atom, S007)

Note: identicalobject states vs. equalobject states (reference) (value)

name (OiD4, atom, John)

13

Encapsulation

¢ Define the behavior of objects based on the operations that can be externally applied to them £ internal structure of objects is hidden ¢ Encapsulation: separation of the objects of a class from anything outside of the class £ information hiding ¢ Stipulate a public interface to a class and hide the —secrets“ in the private part

14

continued Encapsulation

¢ Public interface is a collection of signaturesof the functions provided by a class £ signature specifies the operation‘s name, parameters, and return value class £ implementation (method) of operations is hidden ¢ Objects of a class can only be used through the public interface of the class £ an object is known to the outside world by its name and signatures published in its public interface

15

CN3023, Databases 3, 2005/2006, School of Informatics 5 continued Encapsulation

¢ Visible and hidden attributes and methods £ hidden attributes completely encapsulated and can be accessed only through methods ¢ Update is a typical encapsulated method £ create, delete, update ¢ Benefits £ implementations of class functions can be changed without affecting the clients who use the class functions

16

Inheritance

¢ Class hierarchy £ definition of new class based on previously defined ones £ e.g. PERSON: Name, Address, Birthdate, Age ¢ Subtype/supertype £ a new type that is similar but not identical to an already defined type £ STUDENT subtype-of PERSON: Program, Average

17

continued Inheritance

¢ Single inheritance £ each type has a single supertype £ type hierarchy is a tree ¢ Multiple inheritance £ types can have multiple supertypes £ problems: name conflicts, semantics, exception handling

¢ Inheritance can be used to support abstraction and code reusage

18

CN3023, Databases 3, 2005/2006, School of Informatics 6 Polymorphism

¢ Operator overloading £ the same operator name or symbol bound to two or more different implementations of the operator, depending on the type of objects to which the operator is applied £ example: operator ”+‘ for numbers, strings, sets ¢ Binding of an object to a function £ static (early): during the compile time £ dynamic (or late or runtime) otherwise

¢ power of dynamic binding is that an object can have a dynamic form whose functions can be determined at runtime

19

OODB standards, m odelsand languages

20

W hy OO standards?

¢ One of the reasons for success of the relational database paradigm was the SQL standard £ portability, interoperability ¢ Object Data Management Group proposed a standard ODMG that includes £ Object Model (OM) £ Object Definition Language (ODL) £ Object Query language (OQL) £ bindings

21

CN3023, Databases 3, 2005/2006, School of Informatics 7 Note: ODMG

¢ The ODMG is a non-profit consortium of database vendors and interested parties who collaborated to define data storage portability standards for object-oriented applications. Since its inception in 1991, the ODMG has continued to grow and today includes database vendors, tool vendors, consulting firms, and corporate end users. ¢ Member companies include Advanced Language Technologies, Andersen Consulting, Ardent Software, Baan, CERN, Computer Associates, Ericsson, GemStone Systems, Hitachi, IBEX Computing SA, JavaSoftSunMicrosystems, Lockheed Martin, Microsoft, NEC Corporation, Object Design, The Object People, Objectivity, POET Software, Sybase, Telenor R&D, Versant Object Technology, and W atershed Technologies.

¢ The ODMG group completed its work on object data management standards in 2001 and was disbanded. The final release of the ODMG standard (ODMG 3.0, including the overall data model) can be found at http://www.odmg.org 22

ODMG object model

¢ Provides a standard data model for object databases ¢ Supports object definition via ODL ¢ Supports object querying via OQL ¢ Supports a variety of data types and type constructors

23

continued ODMG object model

¢ basic concepts £objects ¢ collections ¢ atomic objects (user-defined) £literals £interface £class £extent, key, factory objects

24

CN3023, Databases 3, 2005/2006, School of Informatics 8 ODMG objects

¢ Object has four characteristics £ identifier: unique system-wide identifier £ nam e: unique within a particular database and/or program; [optional] £ lifetim e: persistent vs. transient £ structure: specifies how object is constructed by the type constructor and whether it is ¢ collection object ¢ atom icobject

25

ODMG built-in collections

¢ Set œ unordered collection that does not allow duplicates ¢ Bag œ unordered collection that allows duplicates ¢ List œ ordered collection that allows duplicates ¢ Arrayœ one-dimensional array of dynamically varying length, with direct access ¢ Dictionaryœ unordered sequence of key-value pairs with no duplicate keys

Notes: 1) all objects in a collection must be of the same type 2) OM defines built-in interfaces for each collection (see later) 26

ODMG atomic objects

¢ Any object that is not a collection £ typically structured complex objects, such as tuples (struct) ¢ Contains £ properties: attributes and relationships £ operations ¢ Attribute values can be literals or OIDs ¢ Note £ atomic objects are defined via keyword classin ODL (see later)

27

CN3023, Databases 3, 2005/2006, School of Informatics 9 ODMG literals

¢ Literal has a current value but not an identifier £ embedded in objects ¢ Three types of literals £ atom ic: basic (predefined) data type values (e.g., short, float, boolean, char) £ structured: values that are constructed by type constructors (e.g., date, time, struct variables) £ collection: a collection (e.g., set, array) of values or objects

28

ODMG interfaces

¢ An interface describes visible attributes, relationships and operations £ it is a specification of the abstract behaviour (operation signatures) of an object type ¢ Used to specify abstract operations that can be inherited by classes or other interfaces £ —behaviour inheritance“ ¢ State properties of an interface (i.e. its attributes and relationships) cannot be inherited £ objects cannot be instantiated from an interface

29

continued ODMG interfaces

¢ All objects inherit the basic Object interface which provides basic operations £ create a new copy £ delete the object £ compare (identities) of objects

(see also slide 49)

30

CN3023, Databases 3, 2005/2006, School of Informatics 10 ODMG class

¢ Class is a specification of abstract behaviour and abstract state of an object £ classes are —instantiable“ ¢ Inheritance through classes allows both state and behavior inheritance, but (strictly) among classes ¢ Two concepts related to classes: extent and key

31

continued ODMG class

¢ Extent of a class £ contains all persistent objects of that class £ similar to creating an object of type Set and making it persistent ¢ Keys £ one or more properties whose valuesare unique for objects in an extent £ e.g. national insurance number

32

ODMG factory object

¢ Factory object £ used to generate or create individual objects ¢ There is an interface called ObjectFactory interface ObjectFactory{ Object new (); }; new() returns new objects with an object_id

¢ Basically, provides constructor operations for new objects

33

CN3023, Databases 3, 2005/2006, School of Informatics 11 ODMG database

¢ ODMG Object Model supports the concept of databases as storage areas for persistent objects of a given set of types (defined by OM) ¢ A database has a schema that contains a set of type definitions (see ODL) ¢ ODMG defines interfaces for Database and DatabaseFactoryobjects

(see also slide 57)

34

continued ODMG database

¢ Each OO database has £ its database nam e £ bind operation (assigns individual unique names to persistent objects)

¢ named objectsare entry points to the database £ unbind (removes bound names) £ lookup (retrieves an object with the specified name)

35

36

CN3023, Databases 3, 2005/2006, School of Informatics 12 Object Definition Language (ODL)

37

ODL

¢ supports semantics constructs of ODMG ¢ independent of any programming language £ but can be easily mapped to a OO language using the specific language bindings ¢ used to create object specifications (classes and interfaces) ¢ not used for database manipulation

38

ODL œ syntax and data types

¢ compatible with Interface Definition Language (IDL) of CORBA (Common Object Request Broker Architecture) ¢ specification of £ classes £ interfaces

39

CN3023, Databases 3, 2005/2006, School of Informatics 13 ODL œ class definition

className1 [ extendsName2 ] ( extent name_of_entext keyname_of_key ) { attribute struct s_name {….} name; attribute string; …. relationship class_name r_name inverse name; …. void a_method(); … } 40

Class definition œ example 1

classPerson ( extent persons keyssn ) { attribute struct Pname {string fname, string lname} name; attribute string ssn; attribute date birthdate; attribute enum Gender{M, F} sex; attribute struct Address {short no, string street, string city, string post_code} address; short age(); }

41

Class definition œ example 2

ClassFacultyMember extendsPerson (extent faculty) { attribute string rank; attribute float salary; attribute string phone;

relationship Dept works_ininverse Dept::has_facultyMember; relationship set advises inverse GradStu::advisor;

void give_raise (in float raise); void promote (in string new_rank); };

42

CN3023, Databases 3, 2005/2006, School of Informatics 14 Class definition œ inheritance

¢ Inheritance is done using extends £ individual objects inherit both the properties (attributes and relationships) and operations ¢ Multiple class inheritance is not supported! (but multiple behaviour inheritance is)

43

Class definition œ relationships

¢ relationships: a property that specifies that two objects are related ¢ only binary relationships are explicitly represented in the object model ¢ inverse relationship used to specify a single conceptual relationship (possibly in both ways) relationship Dept works_ininverse Dept::has_facultyMember; FacultyMember works_in Dept Dept has_facultyMem berFacultyMember

44

continued Class definition œ relationships

¢ similar construction for Dept class

ClassDept ( extent departments keydname ) { attribute string dname; attribute FacultyMember head; …. relationship set has_facultyMember inverse FacultyMember::works_in; };

¢ inverses are used to maintain referential integrity

45

CN3023, Databases 3, 2005/2006, School of Informatics 15 continued Class definition œ relationships

¢ If a relationship is to be represented only in one direction œ use attributes attribute FacultyMember chair;

¢ Syntax for specifying collections: collection

ClassFacultyMember extendsPerson { … relationship set advises inverse GradStu::advisor; }; A FacultyMember advisesa set of GradStus

46

Class definition œ operations

¢ Operation signatures £ name, argument types and return value ¢ Operation names are unique within the class/interface ¢ Can specify exceptions £ raising exceptions during operation execution void register_student(in string ssn) raises(student_no_valid, section_full);

47

Interface definition

¢ Interface describes visible attributes, relationships and operations ¢ Properties of an interface (i.e., its attributes and relationships) cannot be inherited £ objects cannot be instantiated from an interface ¢ Behaviour inheritance denoted using ”:‘ interface Date:Object

48

CN3023, Databases 3, 2005/2006, School of Informatics 16 continued Interface definition

¢ All objects inherit the basic Object interface interface Object { … booleansam e_as(inObject other_date); Object copy(); void delete(); basic operations: }; - create a new copy - delete the object - compare (identities)

49

Interface definition œ example 1

interface Date:Object { enum weekday{sun,mon,tue,wed,thu,fri,sat}; enum Month{jan,feb,mar,…,dec}; unsigned short year(); unsigned short month(); unsigned short day(); … boolean is_equal(in Date other_date); boolean same_as(in Date other_date); … };

50

Interface definition œ example 2

interface GeometryObject { attribute enum Shape{ Rectangle, Triangle, Circle} shape; attribute struct Point{ short x, short y} reference_point; float perimeter(); float area(); void rotate(in float angle_of_rotation); }; classCircle : GeometryObject { attribute struct Point{ short x, short y} reference_point; attribute short radius; };

51

CN3023, Databases 3, 2005/2006, School of Informatics 17 continued Interface definition

¢ No objects can be created based on GeometryObject (as it is an interface) ¢ Several classes can inherit an interface £ but, only operationsare inherited, not properties (attributes, relationships) ¢ Multiple inheritance of interfaces allowed by a class or by an interface £ class can inherit from at most one class (via extends) and from zero or more interfaces

52

ODMG interfaces (built-in)

inheritance hierarchy for built-in interfaces of the Object model

53

Built-in interfaces for collections

interface Collection: Object{ … exception ElementNotFound{anyelement;}; unsigned long cardinality(); boolean is_empty(); void insert_element(inany element); void remove_element(inany element) raises(ElementNotFound); boolean contains_element(inany element); Iterator create_iterator(inbooleanstable); … }; 54

CN3023, Databases 3, 2005/2006, School of Informatics 18 Built-in interfaces: iterators

¢ iterators are one of the basic interfaces in the object model ¢ iterates over a collection ¢ provides methods such as £ at_end() £ reset() £ get_element() £ next_position()

55

example Built-in interfaces for collections

¢ each collection type (set, list, bag, array, dictionary) provides additional methods

interface Set: Collection { Set create_union(inSet other_set); … boolean is_superset_of(inSet other_set); }; ¢ Note: look at the methods for other collections (p. 670)

56

Database interface interface Database{ void open(instring db_name); void close(); void bind(inany some_obj, in string obj_name); Object unbind(instring obj_name); Object lookup(instring obj_name) raises(ElementNotFound); … };

interface DatabaseFactory{ Database new(); }; 57

CN3023, Databases 3, 2005/2006, School of Informatics 19 Note: language bindings

¢ Specify how ODL constructs are mapped to constructs in a specific OO language

£ Smalltalk and C++ bindings defined by ODMG (see Ch 21.4 for C++) £ ODMG Java binding has been superseded by Java Data Objects (JDO)

58

Object Query Language (OQL)

59

OQL

¢ ODMG‘s query language ¢ syntax is sim ilar to SQL with additional features for objects ¢ works closely with programming languages such as C++ £ embedded OQL statements return objects that are compatible with the type system of the host language

60

CN3023, Databases 3, 2005/2006, School of Informatics 20 Basic syntax

SELECT d.name FROM d in departments W HERE d.college = ”Engineering‘;

¢ An entry point to the database (e.g. named persistent object) is needed for each query ¢ Typically, an extent name (e.g., departments) may serve as an entry point

Recall: an extent is a persistent set of all persistent objects from a class 61

Basic syntax: iterators

¢ Iterator variables (d) are defined whenever a collection is referenced in an OQL query £ in the previous example, d ranges over each object in the collection (departments) ¢ Syntactical options for specifying an iterator: d in departments departmentsd departmentsasd

62

Basic syntax: data type of result

¢ bag: select…from…where… £ previous example: bag ¢ set: select distinct …from…where… ¢ list: select …from…where…order by

63

CN3023, Databases 3, 2005/2006, School of Informatics 21 continued Basic syntax: data type of result

¢ However, a query does not have to follow the select…from…where… format ¢ The data type of a query result can be any type defined in the ODMG model ¢ E.g., a persistent name on its own can serve as a query whose result is a reference to the persistent object (e.g., departments) whose type is set

64

OQL syntax summary

SELECT [DISTINCT] FROM [W HERE ] [GROUP BY ] [HAVING ] [ORDER BY ]

where: ::= IN | IN ,| AS | AS ,

65

Basic syntax: path expressions

¢ A path expression is used to specify a path to attributes and objects in an entry point ¢ A path expression starts at a persistent object name (or its iterator variable) ¢ The name will be followed by zero or more dot connected relationship or attribute names informatics_dept.chair (assuming that there is a persistent object named informatics_dept)

66

CN3023, Databases 3, 2005/2006, School of Informatics 22 continued Basic syntax: path expressions

¢ examples select f.rank from f in informatics_dept.has_facultyMember

select distinct f.rank from f in informatics_dept.has_facultyMember

FacultyMember set

67

Examples œ embedded query

select struct (name: struct( last_name: s.name.lname, first_name: s.name.fname), degrees: (select struct (deg: d.degree, yr: d.year, col: d.college) from d in s.degrees) from s in informatics_dept.chair.advises;

Retrieve last and first names plus degree information for all students advised by the head of InformaticsDept

68

Example

select struct( last_name: s.name.lname, first_name: s.name.fname, gpa: s.gpa), from s in informatics_dept.has_majors where s.class = ”senior‘ order by gpadesc, last-name asc, first_name asc;

Retrieve last and first names plus GPA (average) of all ”senior‘ (i.e. final year) students in the InformaticsDept; order the results by gpa, and then by names

69

CN3023, Databases 3, 2005/2006, School of Informatics 23 continued Example

select struct( last_name: s.name.lname, first_name: s.name.fname, gpa: s.gpa), from s in students where s.majors_in.dname = ”Informatics‘ and s.class = ”senior‘ order by gpadesc, last-name asc, first_name asc; Retrieve last and first names plus GPA (average) of all ”senior‘ (i.e. final year) students in the InformaticsDept; order the results by gpa, and then by names

70

Example œ for you

select struct( last_name: s.name.lname, first_name: s.name.fname), from s in grad_students where …

Retrieve last and first names of all graduate students in the InformaticsDept; whose advisor is a senior lecturer.

71

Views as named objects

¢ The define keyword in OQL is used to specify an identifier for a named query £ name should be unique; if not, the results will replace an existing named query ¢ Once a query definition is created, it will persist until deleted or redefined ¢ A view definition can include parameters

72

CN3023, Databases 3, 2005/2006, School of Informatics 24 continued Views as named objects

¢ A view to include students in a department who have a minor (in that department):

define has_minor(dept_name) as select s from s in students where s.minor_in.dname = dept_name has_minor can now be used in queries: has_minor(”Informatics‘) œ returns bag of students

73

”Element‘ operator

¢ used to return a single element from a singleton collection that contains one element

elem ent (select d from d in departments where d.dname = ”Informatics‘);

type of result is Department (and not bag)

If d is empty or has more than one elements, an exceptionis raised 74

Aggregate operators

¢ OQL supports a number of aggregate operators (that operate over a collection) that can be applied to query results ¢ min, max, count, sum, and avg ¢ count returns an integer; others return the same type as the collection type

count (s in has_minors(”Informatics‘)); count (select f.name from f in faculty where f.sex= F);

75

CN3023, Databases 3, 2005/2006, School of Informatics 25 continued Aggregate operators

avg (select s.gpa from s in students where s.class = ”senior‘ and s.majors_in.dname =”Business‘);

76

Membership and quantification

¢ (e in c) is true if e is in the collection c

”Informatics‘ in (select d.dname from d in departments)

select s.name.fname, s.name.lname from s in students where ”CN3023‘ in (select c.name from c in s.completed_sections.section.of_course);

77

continued Membership and quantification

¢ (for all e in c: b) is true if all e elements of collection c satisfy b ¢ (exists e in c: b) is true if at least one e in collection c satisfies b

for all g in (select s from s in grad_students where s.majors_in.dname = ”Informatics‘) : g.advisor in InformaticsDept.has_faculty;

78

CN3023, Databases 3, 2005/2006, School of Informatics 26 Operators for ordered collections

¢ Lists and arrays allow retrieving their first, last, and ith elements first (select struct (name: f.name.lname, salary f.salary) from f in faculty ordered by f.salarydesc); ¢ OQL provides additional operators for extracting a sub-collection (select …. order by …)[0-2]

79

Grouping operator

select deptname, avg_gpa: avg(select p.s.gpa from p in partition) from s in students group by deptname: s.majors_in.dname having count (partition) > 100;

expression attribute

Retrieve average GPA of majors in each department having >100 majors

80

81

CN3023, Databases 3, 2005/2006, School of Informatics 27 Designing Object Databases

82

OODBs vs. RDBs: relations

¢ OODB £ relationships are handled by reference attributes that include OIDs of related objects £ single and collection of references are allowed £ references for binary relationships can be expressed in a single direction or both directions via inverse operator

¢ if in both directions: redundancy, and hence inconsistency ¢ sometimes better to create a separate class to represent the relationship (cf. Grade, Student, Section classes)

83

continued OODBs vs. RDBs: relations

¢ RDB £ relationships among tuples are specified by attributes with matching values (via foreign keys) £ foreign keys are single-valued £ M:N relationships must be presented via a separate relation (table)

84

CN3023, Databases 3, 2005/2006, School of Informatics 28 OODBs vs. RDBs: inheritance

¢ Inheritance structures are built in OODB (via —:“ and extends operators) ¢ RDB has no built-in support for inheritance relationships £ object-relational databases

85

OODBs vs. RDBs: design

¢ the specification of operations £ OODB: operations specified during design (as part of class specification) £ RDB: may be delayed until implementation

86

Mapping EER to OODB schema

¢ Mapping EER schemas into OODB schemas is relatively simple especially since OODB schemas provide support for inheritance relationships

¢ Once mapping has been completed, operations m ust be added to OODB schemas since EER schemas do not include an specification of operations

87

CN3023, Databases 3, 2005/2006, School of Informatics 29 Current status and conclusions

88

Current status

¢ OODB market around $250M as opposed to the relational DB revenue of $20-50B

¢ OODBMS were originally thought of to replace RDBMS because of their better fit with object- oriented programming languages. However, high switching cost and the inclusion of object- oriented features in RDBMS to make them —object-relational“ have made RDBMS successfully defend their dominance.

89

continued Current status

¢ Object databases are now established as a com plem ent rather than a replacement for relational databases. ¢ OO ideas are being used in a large number of applications, without explicitly using the OODB platform to store data £ OO tools for modelling and analysis, OO programming languages £ object relational DBMS

90

CN3023, Databases 3, 2005/2006, School of Informatics 30 continued Current status s e c i v r e s RDBMS e RDBMS Object-relational s a

b DBMS a t a D

File & Network File & Network ODBMS Systems OODBMS System

Data modeling 91

Current status œ ORDBs

¢ An object-relational database (ORDB) is a relational database that allows developers to integrate the database with their own custom data types and methods. ¢ Also, software running over traditional DBMSs to provide similar features ¢ The goal of ORDBMS technology is to allow developers to raise the level of abstraction at which they view the problem domain. ¢ Object-oriented features added to SQL-99

92

continued Current status œ ORDBs

¢ SQL-99 includes £ some type construction (row, array, set, list) £ object identity (through reference types) £ encapsulation of operations £ inheritance £ new data types (BLOBs, CLOBs)

¢ Many vendors provide specific type extensions for newer data type (e.g. cartridgesin Oracle) ¢ Other vendors: Informix Universal Server, IBM‘s UDB, DB2/II

93

CN3023, Databases 3, 2005/2006, School of Informatics 31 Current status œ OODB products

¢ Com m erical ¢ Open source db4objects (db4o) db4o GemStone (GemStone/S, Facets) Ozone InterSystems (Caché) Perst Matisse (Matisse) Zope (ZODB) ObjectDB (ObjectDB) Objectivity (Objectivity/DB) Progress (ObjectStore, PSE Pro) Versant (merged with Poet; VDS, FastObjects) W 3apps (Jeevan)

94

Summary: OODBs approach

¢ User-defined data typesand operations £ this is part of the database definition £ direct —correspondence“ between real-world and database objects £ abstract data types, inheritance, encapsulation ¢ Integration and compatibility with OO languages £ OODBs provide persistent and straightforward storage for program objects and data structures (not straightforward in RDBs) £ objects do not lose their integrity and identity

95

continued Summary: OODBs approach

¢ main concepts/advantages (summary) £ object identity £ support for complex object structures £ encapsulation of properties and operations £ type hierarchies and behaviour inheritance £ polymorphism £ programming language compatibility (storage of objects and ODL/OQL bindings)

96

CN3023, Databases 3, 2005/2006, School of Informatics 32 continued Summary: OODBs approach

¢ Issues £ OM is more complex than relational model

¢ can represent more complex data structures than the simple relational representation, but more difficult to design ¢ representation of non-binary relationships not trivial £ no early standards, so limited use, popularity, portability

¢ low investment in non-standard technologies ¢ RDBs are traditionally much more used £ OQL needs named entities ¢ Object-relational databases as a compromise

97

Summary

¢ Overview of OO methodology ¢ Object model and various constructs and built-in types of the ODMG model presented ¢ ODL and OQL languages were presented ¢ Current state of OODBs/ORDBs, advantages and disadvantages discussed

98

Reading for this lecture

¢ Chapters 20 and 21 in the textbook

¢ Further information/optional reading: £Object relational DBs: Chapter 22

¢ http://www.odbms.org/, http://www.odmg.org/

99

CN3023, Databases 3, 2005/2006, School of Informatics 33 Questions for this lecture

1. Discuss the main the differences between a relational database system and an OO database system? 2. W hat are the main advantages of OO databases? 3. Explain each of the basic concepts of OODB. 4. Explain main concepts in ODMG object model. 5. Describe the difference between class and interface. 6. Describe the difference between ODL and OQL. 7. W hy do we need to use named entry points in every OQL query? 8. Discuss the main differences between representation of relationships in OO and relational databases. 9. W hat are object-relational databases?

100

CN3023, Databases 3, 2005/2006, School of Informatics 34