Object DBMSs Transparencies. ©Pearson Education 2009 Chapter 17 - Objectives Advanced database applications. Unsuitability of RDBMSs for advanced database.

Slides:



Advertisements
Similar presentations
Limitations of the relational model 1. 2 Overview application areas for which the relational model is inadequate - reasons drawbacks of relational DBMSs.
Advertisements

OO databases 1 Object Oriented databases. OO databases 2 Developing OODBMS - motivation motivation more and more application areas require systems that.
Chapter 10: Designing Databases
Jane Reid, BSc/IT DB, QMUL, 25/2/02 1 Object-oriented DBMS Background to ODBMS ODBMS requirements Object components ODB conceptual design –Graphical ODB.
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
1 Chapter 25 Introduction to Object DBMSs Transparencies © Pearson Education Limited 1995, 2005.
Object Databases Baochuan Lu. outline Concepts for Object Databases Object Database Standards, Languages, and Design Object-Relational and Extended-Relational.
Introduction to Databases
--The Object Database--1 The Object Database  Object databases integrate database technology with the object-oriented paradigm  In object databases,
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
Chapter Object-Oriented Practices. Agenda Object-Oriented Concepts Terminology Object-Oriented Modeling Tips Object-Oriented Data Models and DBMSs.
OBJECTS Object Oriented ???????. OBJECTS Object-Oriented n OO convenient label for a collection of interconnected ideas n OO approach views computer.
Data Management Design
Object-Oriented Databases
Chapter 11 Data Management Layer Design
Object (and Object-Relational) Database Systems (part two)
Introduction to Object DBMSs Transparencies © Pearson Education Limited 1995, 2005.
Oracle Database Administration
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Object Oriented Databases - Overview
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 18 Object Database Management Systems.
Databases Illuminated Chapter 7 The Object-Oriented Model.
RIZWAN REHMAN, CCS, DU. Advantages of ORDBMSs  The main advantages of extending the relational data model come from reuse and sharing.  Reuse comes.
Advanced Database CS-426 Week 13 – Object Relational Databases.
Chapter 4 Object and Object-Relational Databases (Part ½: Object-Oriented Concepts) Lecturer: H.Ben Othmen Department of Computer Science, Umm Al-Qura.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
III. Current Trends: 3 - Object-Relational DBMSsSlide 1/24 III. Current Trends Object-Relational DBMSs 3C13/D63C13/D6.
IST Databases and DBMSs Todd S. Bacastow January 2005.
Object-Relational DBMSs By Yao-Wen Tu CS157b12/09/2003 Prof. Sin-Min Lee.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Programming Languages and Paradigms Object-Oriented Programming.
Chapter 24 Introduction to Object DBMSs Prepared by Kai Huang CS157B Prof Sin-Min Lee.
Introduction to the Other Databases
Part 3: Introduction to Object DBMSs
Agenda  TMA03  M877 Block 3 Databases with Objects.
DBSQL 10-1 Copyright © Genetic Computer School 2009 Chapter 10 Object-Oriented Based DBMS.
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
The Relational Model. Review Why use a DBMS? OS provides RAM and disk.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
11 1 Chapter 11 Object Oriented Databases Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.
Chapter 12: Designing Databases
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Object_Oriented Databases, by Dr. Khalil 1 Object-Oriented Databases Dr. Awad Khalil Computer Science Department AUC.
Object Oriented Database By Ashish Kaul References from Professor Lee’s presentations and the Web.
Chapter 2 Object-Relational DBMSs Chapter 28 in Textbook.
Object Relational Features
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
Onject-oriented Database Prof. Sin-Min Lee Department of Computer Science.
AND OBJECT-ORIENTED DATABASES OBJECT-RELATIONAL DATABASES.
Lecture 16 Object relational databases. 2 Objectives How relational model has been extended to support advanced database applications. Features proposed.
The ODMG Standard for Object Databases
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
OODBMS and ORDBMS. Background Object-oriented software, based on the principles of user-defined datatypes, along with inheritance and polymorphism, is.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
Object-Relational Databases Paul Crowther & Martin Beer
Object-Oriented Database Management System (ODBMS)
Object-Relational DBMSs
Chapter 12 Outline Overview of Object Database Concepts
Compiled from Connelly et al. DBMS Text
Lec 3: Object-Oriented Data Modeling
ISC321 Database Systems I Chapter 10: Object and Object-Relational Databases: Concepts, Models, Languages, and Standards Spring 2015 Dr. Abdullah Almutairi.
Data Model.
Object Databases: Logical Data Modeling
Presentation transcript:

Object DBMSs Transparencies

©Pearson Education 2009 Chapter 17 - Objectives Advanced database applications. Unsuitability of RDBMSs for advanced database applications. Problems of storing objects in relational database. Definition for an OODBMS. Main features of the ODMG Object Data Standard. 2

©Pearson Education 2009 Chapter 17 - Objectives Advantages and disadvantages of OODBMSs. How the RDBMS has been extended into an ORDBMS. Main object management features of SQL:

©Pearson Education 2009 Advanced database applications Interactive and Dynamic Web sites Office Information Systems (OIS) and Multimedia Systems Geographic Information Systems (GIS) Computer-aided Software Engineering (CASE). 4

©Pearson Education 2009 Interactive and dynamic web sites Consider online catalog for selling clothes. Web site maintains preferences for previous visitors and allows a visitor to: obtain 3D rendering of any item based on color, size, fabric, etc; modify rendering to account for movement, illumination, backdrop, occasion, etc; select accessories to go with the outfit, from items presented in a sidebar; Need to handle multimedia content and to interactively modify display based on user preferences and user selections. Added complexity of providing 3D rendering. 5

©Pearson Education 2009 Office Information Systems (OIS) Stores data relating to computer control of information in a business, including electronic mail, documents, invoices, and so on. Modern systems now handle free-form text, photographs, diagrams, audio and video sequences. Documents may have specific structure, perhaps described using mark-up language such as SGML, HTML, or XML. 6

©Pearson Education 2009 Geographic Information Systems (GIS) GIS database stores spatial and temporal information, such as that used in land management and underwater exploration. Much of data is derived from survey and satellite photographs, and tends to be very large. Searches may involve identifying features based, for example, on shape, color, or texture, using advanced pattern-recognition techniques. 7

©Pearson Education Computer-Aided Software Engineering (CASE) Stores data about stages of software development lifecycle. Designs of this type have some common characteristics: Data has many types, each with a small number of instances. Designs may be very large. Design is not static but evolves through time. Updates are far-reaching. Involves version control and configuration management. Cooperative engineering.

©Pearson Education Weaknesses of RDBMSs Poor Representation of “Real World” Entities Normalization leads to relations that do not correspond to entities in “real world”. Semantic Overloading Relational model has only one construct for representing data and data relationships: the relation. Relational model is semantically overloaded. Poor Support for Integrity and Enterprise Constraints

©Pearson Education Weaknesses of RDBMSs Homogeneous Data Structure Relational model assumes both horizontal and vertical homogeneity. Many RDBMSs now allow Binary Large Objects (BLOBs). Limited Operations RDBMs only have a fixed set of operations which cannot be extended. Difficulty Handling Recursive Queries

©Pearson Education Weaknesses of RDBMSs Impedance Mismatch Most DMLs lack computational completeness. To overcome this, SQL can be embedded in a high-level 3GL. This produces an impedance mismatch - mixing different programming paradigms. Estimated that as much as 30% of programming effort and code space is expended on this type of conversion.

©Pearson Education Weaknesses of RDBMSs Other Problems with RDBMSs Transactions are generally short-lived and concurrency control protocols not suited for long-lived transactions. Schema changes are difficult. RDBMSs are poor at navigational access.

©Pearson Education Storing objects in a relational database One approach to achieving persistence with an OOPL is to use an RDBMS as the underlying storage engine. Requires mapping class instances (i.e. objects) to one or more tuples distributed over one or more relations. To handle class hierarchy, have two basics tasks to perform: (1)design relations to represent class hierarchy; (2)design how objects will be accessed.

©Pearson Education Storing objects in a relational database

©Pearson Education Mapping classes to tables Number of strategies for mapping classes to tables, although each results in a loss of semantic information. (1) Map each class or subclass to a table: Staff (staffNo, name, position, salary) Manager (staffNo, bonus, mgrStartDate) SalesPersonnel (staffNo, salesArea, carAllowance) Secretary (staffNo, typingSpeed)

©Pearson Education Mapping classes to tables (2) Map each subclass to a table Manager (staffNo, name, position, salary, bonus, mgrStartDate) SalesPersonnel (staffNo, name, position, salary, salesArea, carAllowance) Secretary (staffNo, name, position, salary, typingSpeed) (3) Map the hierarchy to a single table Staff (staffNo, name, position, salary, bonus, mgrStartDate, salesArea, carAllowance, typingSpeed, typeFlag)

©Pearson Education OODBMSs No one agreed object data model. One definition: Object-Oriented Data Model (OODM) Data model that captures semantics of objects supported in object-oriented programming. Object-Oriented Database (OODB) Persistent and sharable collection of objects defined by an ODM. Object-Oriented DBMS (OODBMS) Manager of an ODB.

©Pearson Education OODBMS - Concepts

©Pearson Education Relationships Relationships represented using reference attributes, typically implemented using OIDs. Consider how to represent following binary relationships according to their cardinality: 1:1 1:* *:*.

©Pearson Education :1 Relationships Add reference attribute to A and, to maintain referential integrity, reference attribute to B.

©Pearson Education :* Relationships Add reference attribute to B and attribute containing set of references to A.

©Pearson Education *:* Relationships Add attribute containing set of references to each object. For relational database design, would decompose *:N into two 1:* relationships linked by intermediate entity. Can also represent this model in an ODBMS.

©Pearson Education *:* Relationships

©Pearson Education Alternative Modeling for *:* Relationships

©Pearson Education Referential integrity Several techniques to handle referential integrity: Do not allow user to explicitly delete objects. System is responsible for “garbage collection”. Allow user to delete objects when they are no longer required. System may detect invalid references automatically and set reference to NULL or disallow the deletion.

©Pearson Education Referential integrity Allow user to modify and delete objects and relationships when they are no longer required. System automatically maintains the integrity of objects. Inverse attributes can be used to maintain referential integrity.

©Pearson Education ODMG Standard Established by vendors of OODBMSs to define standards. Have produced an Object Model that specifies a standard model for the semantics of database objects. The Java binding was submitted to JCP as basis for Java Data Objects (JDO). In 2001, ODMG completed its work and disbanded.

©Pearson Education ODMG Object Model Basic modeling primitives are object/literal. Only an object has a unique identifier. Objects/literals can be categorized into types. All objects of given type exhibit common behavior and state. A type is itself an object. Behavior defined by set of operations that can be performed on or by object. State defined by values objects carry for a set of properties.

©Pearson Education ODMG Object Model Property may be either an attribute of object or relationship between object and one or more other objects. ODMS stores objects, enabling them to be shared by multiple users and applications. ODMS based on a schema defined in ODL.

©Pearson Education ODMG Object Definition Language (ODL) Language for defining the specifications of object types for ODMG-compliant systems (equivalent to DDL of traditional DBMSs). Main objective is to facilitate portability of schemas between complaint systems, while helping to provide interoperability between ODMSs. ODL defines the attributes and relationships of types and specifies the signatures of the operations (but not the implementation).

©Pearson Education ODMG Object Definition Language (ODL)

©Pearson Education ODL Example

©Pearson Education

©Pearson Education ODMG Object Query Language (OQL) Provides declarative access to object database using SQL-like syntax. Does not provide explicit update operators - leaves this to operations defined on object types. Can be used as a standalone language and as a language embedded in another language, for which an ODMG binding is defined (Smalltalk, C++, and Java). OQL can also invoke operations programmed in these languages.

©Pearson Education ODMG Object Query Language (OQL) Can be used for associative and navigational access: Associative query returns collection of objects. How these objects are located is responsibility of ODMS. Navigational query accesses individual objects and object relationships used to navigate from one object to another. Responsibility of application program to specify procedure for accessing the objects.

©Pearson Education ODMG Object Query Language (OQL) An OQL query is a function that delivers an object whose type may be inferred from operator contributing to query expression.

©Pearson Education Example 17.2 Use of extents/traversal paths Get set of all staff (with identity) staff Get set of all distribution center managers (with identity) distributionCenters.ManagedBy

©Pearson Education Example 17.2 Use of extents/traversal paths Find all distribution centers in Seattle SELECT d.dCenterNo FROM d IN distributionCenters WHERE d.address.city = “Seattle”; Assume seattleCenters is named object (from last query). Find all staff who work at that center. seattleCenters.Has

©Pearson Education Example 17.2 Use of extents/traversal paths Because of ambiguity over return result, cannot access assistants’ salaries using: seattleCenters.Has.salary Instead use: SELECT [DISTINCT] s.salary FROM s IN seattleCenters.Has;

©Pearson Education Example 17.3 Use of aggregates How many staff work in New York. OQL aggregate can be applied within SELECT or to result of SELECT. Following equivalent: SELECT COUNT(a) FROM a IN assistants WHERE a.WorksAt.address.city = “New York”; COUNT(SELECT 1 FROM a IN assistants WHERE a.WorksAt.address.city = “New York”);

©Pearson Education Advantages of OODBMSs Enriched Modeling Capabilities. Extensibility. Removal of Impedance Mismatch. Applicability to Advanced Database Applications. Support for Schema Evolution. Support for Long Duration Transactions. More Expressive Query Language. Improved Performance.

©Pearson Education Disadvantages of OODBMSs Lack of Universal Data Model. Lack of Standards. Lack of Experience. Competition from ORDBMSs. Complexity. Lack of Support for Views. Lack of Support for Security.

©Pearson Education ORDBMSs An evolutionary approach to integrating the concept of the “object” into databases (OODBMS is more a revolutionary approach). RDBMSs currently dominant database technology with estimated sales $6 - $10 billion per year ($25 billion with tools sales included).. Some analysts believe the ORDBMS market will have a 50% larger share than the RDBMS.

©Pearson Education Advantages of ORDBMSs Resolves many of known weaknesses of RDBMS. Reuse and sharing: reuse comes from ability to extend server to perform standard functionality centrally; gives rise to increased productivity both for developer and end-user. Preserves significant body of knowledge and experience gone into developing relational applications.

©Pearson Education Disadvantages of ORDBMSs Complexity. Increased costs. Proponents of relational approach believe simplicity and purity of relational model are lost. Some believe RDBMS is being extended for what will be a minority of applications. OO purists not attracted by extensions either. SQL now extremely complex.

©Pearson Education SQL:2006 – Some New Object Features Type constructors for row types and reference types. User-defined types (distinct types and structured types) that can participate in supertype/subtype relationships. User-defined procedures, functions, methods, and operators. Reference types and object identity.

©Pearson Education Row types Sequence of field name/data type pairs that provides data type to represent types of rows in tables. Allows complete rows to be: stored in variables, passed as arguments to routines, returned as return values from function calls. Also allows column of table to contain row values.

©Pearson Education Example 17.4 – Use of row type CREATE TABLE DistributionCenter( dCenterNo CHAR(4), dAddress ROW(dstreet VARCHAR(60), dcityVARCHAR(20), dStateCHAR(2), zZipCode CHAR(5))); INSERT INTO DistributionCenter VALUES (‘D001’, ROW(‘8 Jefferson Way’, ‘Portland’, ‘OR’, ‘97201’));

©Pearson Education User-Defined Types (UDTs) SQL:2006 allows definition of UDTs. May be used in same way as built-in types. Subdivided into two categories: distinct types and structured types. Distinct type allows differentiation between same underlying base types: CREATE TYPE ActorNumberType AS VARCHAR(5) FINAL; CREATE TYPE StaffNumberType AS VARCHAR(5) FINAL; If we now try to treat an instance of one type as instance of the other, an error will be generated.

©Pearson Education UDTs – observer and mutator functions Value of an attribute can be accessed using common dot notation: p.nName p.name = ‘A. Smith’ SQL encapsulates each attribute through an observer (get) and a mutator (set) function. These functions can be redefined by user in UDT definition. FUNCTION name(p PersonType) RETURNS VARCHAR(15) RETURN p.name;

©Pearson Education UDTs – observer and mutator functions These mutator would be: FUNCTION name(p PersonType RESULT, newValue VARCHAR(15)) RETURNS PersonType BEGIN p.name=newValue RETURN p; END;

©Pearson Education UDTs – constructor functions A (public) constructor function is automatically defined to create new instances of type: SET p = NEW PersonType; The constructor function has same name as type, takes zero arguments, and returns a new instance with attributes set to their default values. User-defined constructor methods can be provided to initialize new instances. Must have same name as UDT but different parameters to public constructor.

©Pearson Education UDTs – constructor functions CREATE CONSTRUCTOR METHOD PersonType ( nm VARCHAR(15), DOB DATE) RETURNS PersonType BEGIN SET SELF.name = nm; SET SELF.DOB = DOB; RETURN SELF; END; SET p = NEW PersonType(‘John White’ ’27-May-1950’);

©Pearson Education Example 17.5 –Definition of new UDT CREATE TYPE PersonType AS (name VARCHAR(15), dateOfBirth DATE) INSTANTIABLE NOT FINAL INSTANCE METHOD age () RETURNS INTEGER, INSTANCE METHOD age (DOB DATE) RETURNS PersonType; CREATE INSTANCE METHOD age () RETURNS INTEGER FOR PersonType BEGIN RETURN /* age calculated from SELF.dateOfBirth */; END; CREATE INSTANCE METHOD age (DOB DATE) RETURNS PersonType FOR PersonType BEGIN SELF.dateOfBirth = /* code to set dateOfBirth from DOB*/; RETURN SELF; END;

©Pearson Education Subtypes/Supertypes UDTs can participate in subtype/supertype hierarchy using UNDER clause. Multiple inheritance is not supported. Subtype inherits all the attributes and behavior of its supertypes. Can define additional attributes and methods and can override inherited methods. Concept of substitutability supported: whenever instance of supertype expected instance of subtype can be used in its place.

©Pearson Education Example Subtypes CREATE TYPE StaffType UNDER PersonType AS ( staffNo VARCHAR(5), positionVARCHAR(10)DEFAULT ‘Assistant’, salary DECIMAL(7, 2), VARCHAR(20), dCenterNoCHAR(4)) INSTANTIABLE NOT FINAL REF IS SYSTEM GENERATED INSTANCE METHOD isManager () RETURNS BOOLEAN; CREATE INSTANCE METHOD isManager () RETURNS BOOLEAN BEGIN IF s.position = ‘Manager’ THEN RETURN TRUE; ELSE RETURN FALSE; END IF END)

©Pearson Education User-Defined Routines (UDRs) UDRs define methods for manipulating data. UDRs may be defined as part of a UDT or separately as part of a schema. An SQL-invoked routine may be a procedure, function, or method. May be externally provided in standard programming language or defined completely in SQL.

©Pearson Education UDRs Three types of method: constructor, initializes a newly created instance of UDT; instance, operates on specific instance of a UDT; static, operates at the UDT level. In first two cases, methods include an additional implicit SELF parameter of same type as UDT.

©Pearson Education UDRs Constructor method invoked using NEW expression. Instance method invoked using standard dot notation (p.name) or using generalized invocation format (p AS StaffType).name(). Static method invoked using “::” (StaffType::totalStaff())

©Pearson Education Reference types and object identity Reference types used to define relationships between row types and uniquely identify a row in a table. Reference type value can be stored in one table and used as direct reference to a row in some base table defined to be of this type (similar to C/C++ pointer type and OID of OODBMSs). Thus, references allow a row to be shared among multiple tables, and enable users to replace complex join definitions in queries with much simpler path expressions. REF IS SYSTEM GENERATED in CREATE TYPE indicates that actual values of associated REF type are provided by the system.

©Pearson Education Example 17.7 Table based on UDT CREATE TABLE Person ( info PersonType); or CREATE TABLE Person OF PersonType;

©Pearson Education Examples 17.8/9 – Subtables & object identity CREATE TABLE Staff OF StaffType UNDER Person ( REF IS staffID SYSTEM GENERATED); CREATE TABLE DistributionCenter( dCenterNoCHAR(4)NOT NULL, dStreetVARCHAR(60)NOT NULL, dCityVARCHAR(20)NOT NULL, dStateCHAR(2)NOT NULL, dZipCodeCHAR(5)NOT NULL, mgrStaffIDREF(StaffType) SCOPE Staff REFERENCES ARE CHECKED ON DELETE CASCADE, PRIMARY KEY (dCenterNo));

©Pearson Education Examples – Querying data SELECT s.name FROM Staff s WHERE s.position = ‘Manager’; SELECT s.name, s.age FROM Staff s WHERE s.isManager;

©Pearson Education Example – Deref operator SELECT d.mgrStaffID–>name AS name FROM DistributionCenter d WHERE d.dCenterNo = ‘D001’; SELECT DEREF(d.mgrStaffID) AS Staff FROM DistributionCenter d WHERE d.dCenterNo = ‘D001’;