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.

Slides:



Advertisements
Similar presentations
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ©Silberschatz, Korth and SudarshanDatabase.
Advertisements

©Silberschatz, Korth and Sudarshan9.1Database System Concepts Chapter 9: Object-Relational Databases Nested Relations Complex Types and Object Orientation.
DB and DBMS Adapted from Silberschatz, Korth and Sudarshan.
Chapter 9: Object-Relational Databases
-Software School of Hunan University-
1 Introduction to Web Application Introduction to Data Base.
©Silberschatz, Korth and Sudarshan8.1Database System Concepts Chapter 8: Object-Oriented Databases Need for Complex Data Types The Object-Oriented Data.
Fundamentals, Design, and Implementation, 9/e Chapter 16 Object-Oriented Database Processing.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 22: Object-Based.
Advanced Database CS-426 Week 13 – Object Relational Databases.
Object-Based Databases. 2 Complex Data Types and Object Orientation Structured Data Types and Inheritance in SQL Table Inheritance Array and Multiset.
Object-Relational Databases By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
22.1Database System Concepts - 6 th Edition Chapter 22: Object-Based Databases Complex Data Types and Object Orientation Structured Data Types and Inheritance.
©Silberschatz, Korth and SudarshanDatabase System Concepts.
Database System Concepts ©Silberschatz, Korth and Sudarshan Database System Concepts Chapter 9: Object-Based Databases.
Chapter 4 The Relational Model.
Agenda  TMA03  M877 Block 3 Databases with Objects.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-02,03 Introduction –Data Models Lectured by, Jesmin Akhter.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Lecture 17 Object relational databases. 2 Example Table Creation based on UDT CREATE TABLE Person ( info PersonType, CONSTRAINT DOB_Check CHECK(dateOfBirth.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
1 Advanced Databases (CM036): Lecture # 5 ( Object-Relational and Nested-Relational Databases) Introduction to Object-Relational features of Oracle 9i.
Object-Based Databases Jose Reyes Jose. Overview Object-relational data model extends the relational data model by providing a richer type system including.
Chapter 3: Relational Model I Structure of Relational Databases Structure of Relational Databases Convert a ER Design to a Relational Database Convert.
Database Management System Lecture 4 The Relational Database Model- Introduction, Relational Database Concepts.
ADVANCED DATABASE SYSTEMS DR. FATEMEH AHMADI- ABKENARI SEPTEMBER Object Databases.
©Silberschatz, Korth and Sudarshan9.1Database System Concepts Chapter 9: Object-Oriented Databases Nested Relations Complex Types and Object Orientation.
Chapter 3: Relational Model  Structure of Relational Databases  Normal forms (chap. 7)  Reduction of an E-R Schema to Relational (Sect. 2.9)  Relational.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ©Silberschatz, Korth and SudarshanDatabase.
Relational Database. Database Management System (DBMS)
3 & 4 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Keys Consists of one or more attributes that determine other.
Slide Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Object Relational Features
FEN NOEA/IT - Databases/ORDB1 Object-Relational Databases The Evolutionary Approach to Closing the Gap between Relational Tables and Object Models.
© 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)
Data Modeling Using the Entity-Relationship (ER) Data Model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Other Topics 1: Object.
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 Relational Model. 2 Relational Model Terminology u A relation is a table with columns and rows. –Only applies to logical structure of the database,
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
Experience with XML Schema Ashok Malhotra Schema Usage  Mapping XML Schema and XML documents controlled by the Schema to object classes and instances.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 8 Object-Relational Database.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module C: Beyond Relational.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database.
Chapter 9: Object-Relational Databases Nested Relations Complex Types and Object Orientation Querying with Complex Types Creation of Complex Values and.
Database System Concepts, 5th Ed. ©Sang Ho Lee Chapter 9: Object-Based Databases.
Object-Oriented Databases. Outline Why object-oriented databases? Why relational and object-relational databases are not enough? Current major activities.
Object Relational Databases
Mapeo Objeto Relacional
Object Relational and Extended Relational Databases
Tables and Their Characteristics
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
Chapter 12 Outline Overview of Object Database Concepts
Module 1 Part 2: Object-Based Databases
Need for Complex Data Types
Chapter 9: Object-Based Databases
Chapter 9: Object-Relational Databases
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.
Chapter 22: Object-Based Databases
Chapter 9: Object-Based Databases
Chapter 9: Object-Based Databases
Chapter 29: Object-Based Databases
Chapter 9: Object-Based Databases
Chapter 9: Object-Based Databases
Object – relational database
Chapter 29: Object-Based Databases
Presentation transcript:

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 and Multiset Types in SQL 6.Object-Identity and Reference Types in SQL 7.Persistent Programming Languages

Overview Relational data models deal with simple data types. Two obstacles: 1.Dealing with complex data types such as: – Nested record structures – Multi-valued attributes – Inheritance 2.Difficulty in accessing database data from object-oriented programs (C++ or Java) The solution: – Object-relational database systems based on object-relational data model

Complex Data Types Objective:  To represent E-R model concepts (composite attributes, multivalued attributes, etc )without a complex translation to the relational model. Composite Attributes such as: – Address ( street, city, state, postal_code ) Multivalued Attributes such as: – Telephone (PhNo_1, PhNo_2, …, PhNo_n )

1NF Relation & Non-1NF Relation First Normal Form (1NF): – All attributes have atomic domains. – Viewing the database as a set of records Viewing the database as a set of objects or entities leads to a non-1NF relation Example: a library application – Book title – List of authors: Array-Valued domain – Publisher: Having 2 subfields; name & branch – Set of keywords: Set-Valued domain Non-1NF books relation, books

4NF version of the relation books Authors (title, author, position) Keywords (title, keyword) Books4 (title, pub_name, pub_branch) The use of nested relations leads to an easier-to-understand model.

Structured Types in SQL:1999 User-Defined Types – create type Name as (firstname varchar(20), lastname varchar(20)) final; – create type Address as (street varchar(20), city varchar(20), zipcode varchar(9)) not final; Using these types in a table: – create table person ( name Name, address Address, dateOfBirth date); Final: No subtypes Not Final: Can have Subtypes

User-Defined Row Types Named row type: – create type PersonType as ( name Name, address Address, dateOfBirth date) not final – create table person of PersonType; Unnamed row type: – create table person_r ( name row (firstname varchar(20), lastname varchar(20)), address row (street varchar(20), city varchar(20), zipcode varchar(9)), dateOfBirth date); Query example: – select name.lastname, address.city from person;

Methods create type PersonType as ( name Name, address Address, dateOfBirth date) not final method ageOnDate(onDate date) returns interval year; create instance method ageOnDate (onDate date) returns interval year for PersonType begin return onDate − self.dateOfBirth; end Query example: – select name.lastname, ageOnDate (current date) from person;

Constructor Functions create function Name (firstname varchar(20), lastname varchar(20)) returns Name begin set self.firstname = firstname; set self.lastname = lastname; end insert into Person values (new Name(’John’, ’Smith’), new Address(’20 Main St’, ’New York’, ’11001’), date ’ ’);

Type Inheritance create type Person (name varchar(20), address varchar(20)); Subtypes: – create type Student under Person (degree varchar(20), department varchar(20)); – create type Teacher under Person (salary integer, department varchar(20)); Subtypes can redefine methods by using overriding method in place of method in the method declaration.

Multiple Type Inheritance create type TeachingAssistant under Student, Teacher; Renaming to avoid a conflict between the two occurrences of department: – create type TeachingAssistant under Student with (department as student_dept), Teacher with (department as teacher_dept); A value of a structured type must have exactly one most-specific type.

Table Inheritance create table people of Person; Subtables : – create table students of Student under people; – create table teachers of Teacher under people; Multiple Table Inheritance: – create table teaching_assistants of TeachingAssistant under students, teachers;

Consistency Requirements Tuples in a subtable and parent table correspond if they have the same values for all inherited attributes. The consistency requirements for subtables: 1.Each tuple of the supertable can correspond to at most one tuple in each of its immediate subtables. 2.SQL has an additional constraint that all the tuples corresponding to each other must be derived from one tuple (inserted into one table).

Array and Multiset Types in SQL create type Publisher as (name varchar(20), branch varchar(20)); create type Book as (title varchar(20), author_array varchar(20) array [10], pub_date date, publisher Publisher, Keyword_set varchar(20) multiset); create table books of Book;

Creating and Accessing Collection Values Array – array[’Silberschatz’, ’Korth’, ’Sudarshan’] Multiset – multiset[’computer’, ’database’, ’SQL’] Creating a tuple – (’Compilers’, array[’Smith’, ’Jones’], new Publisher(’McGraw-Hill’, ’New York’), multiset[’parsing’, ’analysis’]) Insertion – insert into books values (’Compilers’, array[’Smith’, ’Jones’], new Publisher(’McGraw-Hill’, ’New York’), multiset[’parsing’, ’analysis’]);

Querying Collection-Valued Attributes select title from books where ’database’ in (unnest(keyword_set)); select author_array[1], author_array[2], author_array[3] from books where title = ’Database System Concepts’;

Unnesting Unnesting: – The transformation of a nested relation into a form with fewer (or no) relationvalued attributes. Example: – select title, A.author, publisher.name as pub_name, publisher.branch as pub_branch, K.keyword from books as B, unnest(B.author_array) as A(author), unnest (B.keyword_set) as K(keyword);

Nesting Nesting: – The reverse process of transforming a 1NF relation into a nested relation Example: – select title, author, Publisher(pub name, pub branch) as publisher, collect(keyword) as keyword set from flat books group by title, author, publisher;

Object-Identity and Reference Types in SQL An attribute of a type can be a reference to an object of a specified type: – create type Department ( name varchar(20), head ref(Person) scope people); create table departments of Department; The restriction of the scope of a reference to tuples of a table is mandatory in SQL, and it makes references behave like foreign keys. The self-referential attribute is an attribute which stores the identifier of the tuple: – create table people of Person ref is person_id system generated; Path expression: – select head−>name, head−>address from departments;

Persistent Programming Languages A persistent data: a data which continues to exist even after the program that created it has terminated. A persistent programming language is a programming language extended with constructs to handle persistent data. Persistence of Objects – Persistence by class – Persistence by creation – Persistence by marking – Persistence by reachability

Thank You