Why Object-Oriented DBMS? Abstract data types Interface with host programming language (the impedance mismatch). Object identity: (peter, 40, {(john, 15,

Slides:



Advertisements
Similar presentations
Chapter 6 Structures and Classes. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Learning Objectives Structures Structure types Structures.
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
Object Oriented Database Group 4 Mathieu Metz Palani Kumaresan Napa Gavinlertvatana Kristine Pei Keow Lee Prabhu Ramachandran.
SQL Introduction Standard language for querying and manipulating data Structured Query Language Many standards out there: SQL92, SQL2, SQL3. Vendors support.
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.
ADVANCED DATABASE SYSTEMS DR. FATEMEH AHMADI- ABKENARI 1 Object Databases.
SQL*PLUS, PLSQL and SQLLDR Ali Obaidi. SQL Advantages High level – Builds on relational algebra and calculus – Powerful operations – Enables automatic.
Object Databases Baochuan Lu. outline Concepts for Object Databases Object Database Standards, Languages, and Design Object-Relational and Extended-Relational.
--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-Orientation in Query Languages By: Toan Nguyen Class: CS 157A.
End of SQL: Triggers, Impedance Mismatch and Transactions February 6 th, 2004.
Fundamentals, Design, and Implementation, 9/e Chapter 7 Using SQL in Applications.
1 Object Oriented & Object Relational Databases Ranga Raju Vatsavai Teaching Mentor (Prof. Shekhar) CSci 5708 : Architecture and Implementation of Database.
Programs with SQL Host language + Embedded SQL Preprocessor Host Language + function calls Host language compiler Host language program Preprocessor Host.
Other Data Models. Text New edition (DBS the complete book): Chapter 4 Old edition (First course in DBS): –Section 2.1 –Section –Section 2.4.1,
Embedded SQL Direct SQL is rarely used: usually, SQL is embedded in some application code. We need some method to reference SQL statements. But: there.
Object Oriented Databases - Overview
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
1 Announcements Research Paper due Monday November 22.
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.
Chapter 4 Object and Object-Relational Databases (Part ½: Object-Oriented Concepts) Lecturer: H.Ben Othmen Department of Computer Science, Umm Al-Qura.
Object and object-relational databases 1. Object databases vs. Object-relational databases Object databases Stores complex objects – Data + functions.
Database Design April 3, Projects, More Details Goal: build a DB application. (almost) anything goes. Groups of 3-4. End of week 2: groups formed.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Programming Languages
Agenda  TMA03  M877 Block 3 Databases with Objects.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 7-1 David M. Kroenke’s Chapter Seven: SQL for Database Construction and.
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
ORDBS1 Object Relational Database Systems: 1. Introduction 2. Objects in SQL3 3. Comparison of ODL/OQL and SQL3 Approaches CIS 671.
Why Object-Oriented DBMS? Abstract data types (relational data model is too simple). Interface with host programming language Managing large number of.
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
ADVANCED DATABASE SYSTEMS DR. FATEMEH AHMADI- ABKENARI SEPTEMBER Object Databases.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 18 Object- Oriented Database Processing.
Object Definition Language
Object Definition Language
CSE 6331 © Leonidas Fegaras OODB1 Object-Oriented Databases and the ODMG Standard.
Database Design Why do we need it? – Agree on structure of the database before deciding on a particular implementation. Consider issues such as: –What.
Object Relational Features
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
Different Constraint Types Type Where Declared When activated Guaranteed to hold? Attribute with attribute on insertion not if CHECK or update subquery.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
Object-Relational Model. Review: Data Models Hierarchical Network ER (Pure) Relational (Pure) Object-oriented (ODMG) Object-relational (since SQL:1999)
Row Types in SQL-3 Row types define types for tuples, and they can be nested. CREATE ROW TYPE AddressType{ street CHAR(50), city CHAR(25), zipcode CHAR(10)
AND OBJECT-ORIENTED DATABASES OBJECT-RELATIONAL DATABASES.
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.
Constraining Attribute Values Constrain invalid values –NOT NULL –gender CHAR(1) CHECK (gender IN (‘F’, ‘M’)) –MovieName CHAR(30) CHECK (MovieName IN (SELECT.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 8 Object-Relational Database.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
IST 210 Object Oriented Database. IST 210 Object-Oriented Concepts  Abstract Data Types  Class definition, provides extension to complex attribute types.
1 Chapter 8 Object-oriented Query Languages. 2 Object-oriented query language OQL (Object Query Language) –ODMG (Object Database Management Group) –ODMG-93.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
Why Object-Oriented DBMS?
Object-Oriented Databases and the ODMG Standard
SQL Environment.
Database Design Oct. 3, 2001.
Database Design Why do we need it? Consider issues such as:
Chapter 12 Outline Overview of Object Database Concepts
CPSC-310 Database Systems
ISC321 Database Systems I Chapter 10: Object and Object-Relational Databases: Concepts, Models, Languages, and Standards Spring 2015 Dr. Abdullah Almutairi.
Chapter 15: Object-Oriented Database Development
Presentation transcript:

Why Object-Oriented DBMS? Abstract data types Interface with host programming language (the impedance mismatch). Object identity: (peter, 40, {(john, 15, {})}) (susan, 41, {(john, 15, {})}) – Same son? Maybe, maybe not. Managing large number of objects: –Encapsulation, reusability, modularity, protection, less distinction between program and data, type extensibility Semantic networks: the world is actually a complex hierarchy (types versus classes).

SQL Doesn’t Work in Scotland Select name From Employee Where name > “Mc” and name < “Md” OrderBy name Doesn’t work for the McAndish clan: (they’re all the same!) McAndish MacAndish M’Andish Comparison based on ASCII Other countries are even more problematic.

Programs with SQL Host language + Embedded SQL Preprocessor Host Language + function calls Host language compiler Host language program Preprocessor Host language compiler

Cursors EXEC SQL DECLARE cursorName CURSOR FOR SELECT …. FROM …. WHERE …. ; EXEC SQL OPEN cursorName; while (true) { EXEC SQL FETCH FROM cursorName INTO :variables; if (NO_MORE_TUPLES) break; /* do something with values */ } EXEC SQL CLOSE cursorName;

Two Approaches to OO 1. Build object-oriented database systems: ODMG standard: --> Object Query Language. Products are mainly object storage systems. Only O 2 supports OQL (and is not doing that well). 2. Object-relational systems: Add OO features to SQL (in SQL3) Row types and abstract data types. Various subsets are supported my most relational vendors. The difference: How important is a relation to you? How important is SQL to you?

Object Definition Language Resembles C++ (and Smalltalk). Basic design paradigm in ODL: –Model objects and their properties. For abstraction purposes: –Group objects into classes. What qualifies as a good class? –Objects should have common properties.

ODL Class Declarations Interface { attributes: ; relationships ; methods (in, out, exceptions) }

Example Interface Interface Movie { attribute string title; relationship Set stars inverse Star::starredIn; float lengthInHours raises(noLengthFound); starNames (out Set ); otherMovies (in Star, out Set raises (noSuchStar)); } Note: defining signature, not implementation. Overloading allowed.

Type System Basic types: Atomic types (e.g., string, integer, …) Enumeration types (Monday, Tuesday, Wednesday….) Constructors: can be applied without limitations. Set: (1, 5, 6) Bag: (1, 1, 5, 6, 6 ) List: (1, 5, 6, 1, 6 ) Collection types Array: Integer[17] Struct: (name: string, address: string) struct( name: “John”, childrenAges: bag (1,1,2,2)) Declaring types for objects

OQL: Object Query Language SELECT can construct new objects, arbitrary structures FROM tuple variables can range over any collection; may have subqueries. WHERE pretty much the same as in SQL

Path Expressions Path expressions are needed in order to access components of objects. Attributes: a.p is the value of the attribute a of p. Relationships: a.p is the object or collection of objects related to a by p. Methods: a.p is the result of applying p to a (perhaps with a parameter). Also possible to have longer expressions: a.father.wife.child.father.wife….

Select-From-Where in OQL (simple) Example: SELECT s.name FROM Movies m, m.stars s WHERE m.title = “Sleepless in Seattle” Note: this looks a lot more procedural than SQL.

Complications in the FROM Clause SELECT a.phoneNumber FROM Movies m, (SELECT m.address FROM m.stars WHERE m.city=“Los Angeles”) AS a WHERE m.title = “Sleepless in Seattle” The FROM clause can contain arbitrary subqueries that return collections.

Complex Output Types The SELECT clause can create complex structures: SELECT Struct: (address: a, phoneNumber: a.phoneNumber) FROM Movies m, (SELECT m.address FROM m.stars WHERE m.city=“Los Angeles”) AS a WHERE m.title = “Sleepless in Seattle”

Interface with Host Language OQL is much more tightly integrated with the host language. OQL produces objects (of various types). One can simply assign the objects as values to variables with the appropriate types. No need for special interface. ELEMENT: turns a bag of one element into the single element: var1 = ELEMENT (SELECT m FROM Movies m WHERE title=“sleepless in Seattle”);

Row Types in SQL-3 Row types define types for tuples, and they can be nested. CREATE ROW TYPE AddressType{ street CHAR(50), city CHAR(25), zipcode CHAR(10) } CREATE ROW TYPE PersonType{ name CHAR(30), address AddressType, phone phoneNumberType }

Relations as Row Types CREATE TABLE Person OF TYPE PersonType; Recall: row types can be nested! Accessing components of a row type: (double dots) SELECT Person.name, Person.address..city FROM Person WHERE Person.address..street LIKE ‘%Mountain%’

References We can define attributes of a row type to reference objects of other row types: CREATE ROW TYPE Company( name char(30), address addressType, president REF(PersonType) ); Following references: SELECT president->name FROM Company WHERE president->address..city=“Seattle”

Abstract Data Types in SQL3 Row types provide a lot of the functionality of objects: allow us to modify objects (unlike OQL), but do not provide encapsulation. We can modify objects arbitrarily using SQL3 commands. In OQL: we can query, but not modify only via methods. Abstract data types: are used as components of tuples. CREATE TYPE ( list of attributes and their types optional declaration of the comparison functions: =, < declaration of methods for the type );

Address ADT CREATE TYPE AddressADT ( street CHAR(50), city CHAR(20), EQUALS addrEq, LESS THAN addrLT FUNCTION fullAddr (a: AddressADT) RETURNS CHAR(100); :z CHAR(10); BEGIN :z = findZip(:a.street, :a.city); RETURN (….) END; DECLARE EXTERNAL findZip CHAR(50) CHAR(20) RETURNS CHAR(10) LANGUAGE C; ); Encapsulation is obtained by making methods public/private

Differences Between OODB Approaches Programming environment: much more closely coupled in OQL/ODL than in SQL3. Changes to objects are done via the programming language in OQL, and via SQL statements in SQL3. Role of relations: still prominent in SQL 3 Row types are really tuples, ADT’s describe attributes. In OQL: sets, bags and structures are fundamental. Encapsulation: exists in OQL; not really supported by row types in SQL3, but are supported by ADT’s.