Object Relational Features

Slides:



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

Object Databases Baochuan Lu. outline Concepts for Object Databases Object Database Standards, Languages, and Design Object-Relational and Extended-Relational.
ODMG Standard: Object Model1 OBJECT-ORIENTED DATABASE SYSTEMS ODMG Standard: Object Model Susan D. Urban and Suzanne W. Dietrich Department of Computer.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 SQL: Data Definition, Constraints, and Basic Queries and Updates.
Winter 2002Arthur Keller – CS 18012–1 Schedule Today: Feb. 19 (T) u Object-Relational Systems. u Read Sections 4.5, Assignment 5 due. Feb. 21.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 9: Object-Relational Databases
CS 104 Introduction to Computer Science and Graphics Problems Introduction to Database (2) Basic SQL 12/05/2008 Yang Song.
Fall 2001Arthur Keller – CS 18014–1 Schedule Nov. 13 (T) Object-Relational, O-R Queries. u Read Sections 4.5, Assignment 6 due. (No office hours.)
1 Object Oriented & Object Relational Databases Ranga Raju Vatsavai Teaching Mentor (Prof. Shekhar) CSci 5708 : Architecture and Implementation of Database.
Fundamentals, Design, and Implementation, 9/e Chapter 16 Object-Oriented Database Processing.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
Object Oriented Databases - Overview
Department of Computer Sciences Bahria University (Karachi Campus)
July 13, 2015ADBS: OODB1 Concepts for Object-Oriented Databases Chapter 20.
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.
Advanced Database CS-426 Week 13 – Object Relational Databases.
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Object-Based Databases. 2 Complex Data Types and Object Orientation Structured Data Types and Inheritance in SQL Table Inheritance Array and Multiset.
©Silberschatz, Korth and SudarshanDatabase System Concepts.
Database System Concepts ©Silberschatz, Korth and Sudarshan Database System Concepts Chapter 9: Object-Based Databases.
Chapter 12: Adding Functionality to Your Classes.
Data Structures Using C++ 2E Chapter 3 Pointers and Array-Based Lists.
Agenda  TMA03  M877 Block 3 Databases with Objects.
DBMS Lecture 9  Object Database Management Group –12 Rules for an OODBMS –Components of the ODMG standard  OODBMS Object Model Schema  OO Data Model.
Object-Based Databases Ghazal Mostofi Sadri. Outline 1.Overview 2.Complex Data Types 3.Structured Types and Inheritance in SQL 4.Table Inheritance 5.Array.
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
1 Advanced Databases (CM036): Lecture # 5 ( Object-Relational and Nested-Relational Databases) Introduction to Object-Relational features of Oracle 9i.
Overloading Binary Operators Two ways to overload –As a member function of a class –As a friend function As member functions –General syntax Data Structures.
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.
Winter 2006Keller, Ullman, Cushing12–1 Object-Relational Systems Object-oriented ideas enter the relational world. u Keep relation as the fundamental abstraction.
Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
Relational Database. Database Management System (DBMS)
Chapter Eleven Classes and Objects Programming with Microsoft Visual Basic th Edition.
Data Structures Using C++ 2E Chapter 3 Pointers. Data Structures Using C++ 2E2 Objectives Learn about the pointer data type and pointer variables Explore.
Pointer and Array Lists Chapter 3, Summary CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and.
Object relational database managmement systems (ORDBMS) Adapted by Edel Sherratt from originals by Nigel Hardy.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Chapter 2 Object-Relational DBMSs Chapter 28 in Textbook.
Chapter 10, Slide 1 ABSTRACT DATA TYPES Based on the fundamental concept of ABSTRACTION:  process abstraction  data abstraction Both provide:  information.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide Introduction Object Oriented (OO) Data Models since mid-90’s Reasons for creation of.
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
FEN NOEA/IT - Databases/ORDB1 Object-Relational Databases The Evolutionary Approach to Closing the Gap between Relational Tables and Object Models.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Object-Relational Model. Review: Data Models Hierarchical Network ER (Pure) Relational (Pure) Object-oriented (ODMG) Object-relational (since SQL:1999)
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.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
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.
Faeez, Franz & Syamim.   Database – collection of persistent data  Database Management System (DBMS) – software system that supports creation, population,
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
CSE202 Database Management Systems
ODMG Object Model, Object Definition Language (ODL)
Object – Oriented Databases
Object-Relational DBMSs
Chapter 12 Outline Overview of Object Database Concepts
Structured Types (9-12-2) Structured types allow composite attributes of E-R diagrams to be represented directly. Unnamed row types can also be used in.
Object – relational database
Presentation transcript:

Object Relational Features ADVANCED DATABASES Object Relational Features Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria University (Karachi Campus) Khawaja.mohiuddin@bimcs.edu.pk https://sites.google.com/site/khawajamcs Contents for this lecture are taken from: Chapter 10 of “Database Systems: Models, Languages …”, 6th Ed.” by Elmasri and Navathe (Chapter 11 of “Fundamentals of Database Systems” 6th Ed. by Elmasri and Navathe)

Objectives To explain what Object-relation databases are To cover the Object Database extensions to SQL To understand how UDTs are declared To go over examples of following Object Database concepts: Inheritance Encapsulation Reference Type Instantiability Referencing and dereferencing attributes

Object-Relational Databases Relational DBMS (RDBMS) vendors recognized need to add object database features. The resulting database systems characterized as Object-Relational Database Systems or ORDBMS. SQL first specified by Chamberlin and Boyce (1974), underwent enhancements and standardization in 1989 and 1992. New standard, initially called SQL3 and later known as SQL:99 Starting with SQL3 version, features from object databases were incorporated into the SQL standard. At first, these extensions were known as SQL/Object SQL standard 2008 for RDBMSs includes many ODBMS features - originally known as SQL/Object - now have merged into main SQL specification known as SQL/Foundation.

Object-Relational Features: Object Database Extensions to SQL Relational model with object database enhancements referred to as the object-relational model. Type constructors Specify complex objects Includes the row type (tuple or struct) constructor and array type set, list, and bag constructors were included later in the standard Mechanism for specifying object identity included Encapsulation of operations Provided through user-defined types (UDTs) May include operations also Inheritance mechanisms Provided using keyword UNDER

User-Defined Types (UDT) and Complex Structures for Objects To allow the creation of complex-structured objects To separate the declaration of a type from creation of a table Can be used as either the type for an attribute or as the type for a table UDT within UDT (complex structure for objects in a table) UDT syntax: CREATE TYPE TYPE_NAME AS (<component declarations>);

User-Defined Types and Complex Structures for Objects (cont’d.) UDT example: CREATE TYPE STREET_ADDR_TYPE AS ( NUMBER VARCHAR (5), STREET_NAME VARCHAR (25), APT_NO VARCHAR (5), SUITE_NO VARCHAR (5) ); CREATE TYPE USA_ADDR_TYPE AS ( STREET_ADDR STREET_ADDR_TYPE, CITY VARCHAR (25), ZIP VARCHAR (10) CREATE TYPE USA_PHONE_TYPE AS ( PHONE_TYPE VARCHAR (5), AREA_CODE CHAR (3), PHONE_NUM CHAR (7) ); CREATE TYPE PERSON_TYPE AS ( NAME VARCHAR (35), SEX CHAR, BIRTH_DATE DATE, PHONES USA_PHONE_TYPE ARRAY[4], ADDR USA_ADDR_TYPE .

User-Defined Types and Complex Structures for Objects (cont’d.) ROW TYPE Directly create a structured attribute using the keyword ROW if a UDT does not have any operation CREATE TYPE USA_ADDR_TYPE AS ( STREET_ADDR ROW ( NUMBER VARCHAR (5), STREET_NAME VARCHAR (25), APT_NO VARCHAR (5), SUITE_NO VARCHAR (5) ), CITY VARCHAR (25), ZIP VARCHAR (10) );

User-Defined Types and Complex Structures for Objects (cont’d.) Array type Reference elements using [] Example: PHONES USA_PHONE_TYPE ARRAY[4] PHONES[1] refers to the first location value in a PHONES attribute CARDINALITY function Returns the current number of elements in an array PHONES[CARDINALITY (PHONES)] refers to the last element in the array Dot notation: ADDR.CITY refers to the CITY component of an ADDR attribute

Object Identifiers Using Reference Types Create unique system- generated object identifiers. Example: REF IS SYSTEM GENERATED CREATE TYPE PERSON_TYPE AS ( NAME VARCHAR (35), SEX CHAR, BIRTH_DATE DATE, PHONES USA_PHONE_TYPE ARRAY [4], ADDR USA_ADDR_TYPE INSTANTIABLE NOT FINAL REF IS SYSTEM GENERATED INSTANCE METHOD AGE() RETURNS INTEGER; CREATE INSTANCE METHOD AGE() RETURNS INTEGER FOR PERSON_TYPE BEGIN RETURN /* CODE TO CALCULATE A PERSON’S AGE FROM TODAY’S DATE AND SELF.BIRTH_DATE */ END; );

Object Identifiers Using Reference Types (cont’d.) Reference type (cont’d.) Complete Syntax is: REF IS <OID_ATTRIBUTE> <VALUE_GENERATION_METHOD>; <OID_ATTRIBUTE> is user declared attribute name to indentify individual tuples in a table The options for <VALUE_GENERATION_METHOD> are: SYSTEM GENERATED - system will automatically generate a unique identifier for each tuple DERIVED - user provided primary key value to identify tuples is applied

Creating Tables Based on the UDTs INSTANTIABLE Specify that UDT is instantiable (see PERSON_TYPE declaration) Causes one or more tables to be created UDTs STREET_ADDR_TYPE and USA_ADDR_TYPE are noninstantiable, and hence can only be used as types for attributes, but not as a basis for table creation CREATE TABLE PERSON OF PERSON_TYPE REF IS PERSON_ID SYSTEM GENERATED; Create a table PERSON based on the PERSON_TYPE UDT Attribute PERSON_ID will hold the system-generated object identifier whenever a new PERSON record (object) is created and inserted in the table

Encapsulation of Operations User-defined type Specify methods (or operations) in addition to the attributes Format: CREATE TYPE <TYPE-NAME> ( <LIST OF COMPONENT ATTRIBUTES AND THEIR TYPES> <DECLARATION OF FUNCTIONS (METHODS)> ); Example: method Age() of type PERSON_TYPE

Encapsulation of Operations (cont’d.) Constructor function TYPE_T( ) Returns a new object of that type Observer function X.A Returns the value of attribute A of TYPE_T if X is of type TYPE_T Mutator function Sets the value of the attribute to a new value User Defined functions (Internal Functions) Format INSTANCE METHOD <NAME> (<ARGUMENT_LIST>) RETURNS <RETURN_TYPE>;

Encapsulation of Operations (cont’d.) External functions Written in a host language, with only their signature (interface) appearing in the UDT definition Format DECLARE EXTERNAL <FUNCTION_NAME> <SIGNATURE> LANGUAGE <LANGUAGE_NAME>; Categories of attributes and functions PUBLIC (visible at the UDT interface) PRIVATE (not visible at the UDT interface) PROTECTED (visible only to subtypes)

Specifying Inheritance and Overloading of Functions Inheritance rules: All attributes inherited (phrase NOT FINAL must be included) Order of supertypes in UNDER clause determines inheritance hierarchy Instance of a subtype can be used in every context in which a supertype instance is used Subtype can redefine any function defined in supertype When a function is called, best match selected based on types of all arguments For dynamic linking, runtime types of parameters is considered

Specifying Inheritance and Overloading of Functions (cont’d.) Example of inheritance of types: CREATE TYPE EMPLOYEE_TYPE UNDER PERSON_TYPE AS ( JOB_CODE CHAR (4), SALARY FLOAT, SSN CHAR (11) INSTANTIABLE NOT FINAL ); CREATE TYPE MANAGER_TYPE UNDER EMPLOYEE_TYPE AS ( DEPT_MANAGED CHAR (20) INSTANTIABLE ); Example of inheritance of tables: CREATE TABLE EMPLOYEE OF EMPLOYEE_TYPE UNDER PERSON; CREATE TABLE MANAGER OF MANAGER_TYPE UNDER EMPLOYEE;

Specifying Relationships via Reference Component attribute of one tuple may be a reference to a tuple of another table Specified using keyword REF Keyword SCOPE Specify name of table whose tuples referenced Concept is similar to foreign key Dot notation Build path expressions that refer to the component attribute of tuples and row types

Specifying Relationships via Reference –> Used for dereferencing for an attribute whose type is REF SELECT E.Employee–>NAME FROM EMPLOYMENT AS E WHERE E.Company–>COMP_NAME = ‘ABCXYZ’; In SQL, –> is has the same meaning assigned to it in the C programming language. Thus, if r is a reference to a tuple and a is a component attribute in that tuple, then r –> a is the value of attribute a in that tuple.

Conclusion In this Lecture, we… To explain what Object-relation databases are To cover the Object Database extensions to SQL To understand how UDTs are declared To go over examples of following Object Database concepts: Inheritance Encapsulation Reference Type Instantiability Referencing and dereferencing attributes