Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases.

Slides:



Advertisements
Similar presentations
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
Advertisements

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.
XML: Extensible Markup Language
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 13 Introduction to SQL Programming Techniques.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 4- 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 8 The Enhanced Entity- Relationship (EER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Conceptual Data Modeling Using Entities and Relationships.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Enhanced Entity-Relationship (EER) Modeling.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
Fundamentals, Design, and Implementation, 9/e Chapter 16 Object-Oriented Database Processing.
The Enhanced Entity- Relationship (EER) Model
Object Oriented Databases - Overview
July 13, 2015ADBS: OODB1 Concepts for Object-Oriented Databases Chapter 20.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to- Relational Mapping.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Announcements Research Paper due Monday November 22.
Databases Illuminated Chapter 7 The Object-Oriented Model.
Chapter 4 Object and Object-Relational Databases (Part ½: Object-Oriented Concepts) Lecturer: H.Ben Othmen Department of Computer Science, Umm Al-Qura.
EER vs. UML Terminology EER Diagram Entity Type Entity Attribute
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 8 The Enhanced Entity- Relationship (EER) Model.
Chapter 14: Object-Oriented Data Modeling
Object and object-relational databases 1. Object databases vs. Object-relational databases Object databases Stores complex objects – Data + functions.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
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.
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
Chapter 21 B Mapping to ODL Copyright © 2004 Pearson Education, Inc.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
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.
Chapter 21 C OQL Copyright © 2004 Pearson Education, Inc.
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
Scaling Heterogeneous Databases and Design of DISCO Anthony Tomasic Louiqa Raschid Patrick Valduriez Presented by: Nazia Khatir Texas A&M University.
Copyright © 2004 Pearson Education, Inc.. Chapter 21 Object Database Standards, Languages, and Design.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
Chapter 2 Object-Relational DBMSs Chapter 28 in Textbook.
Object Relational Features
11-1 CHAPTER 11 Concepts for Object-Oriented Databases.
Object-Oriented Programming Chapter Chapter
Object-Relational Model. Review: Data Models Hierarchical Network ER (Pure) Relational (Pure) Object-oriented (ODMG) Object-relational (since SQL:1999)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Object-Oriented Database.
© Shamkant B. Navathe CC Enhanced Entity-Relationship Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
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,
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
ISBN Chapter 12 Support for Object-Oriented Programming.
OOPSLA Lab1 Chapter 7 Java Binding Prof. Hyoung-Joo Kim OOPSLA Lab. Dept. of Computer Engineering Seoul National University.
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
CSE202 Database Management Systems
ODMG Object Model, Object Definition Language (ODL)
Entity- Relationship (ER) Model
Object-Oriented Database Management System (ODBMS)
Object – Oriented Databases
Chapter 12 Outline Overview of Object Database Concepts
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Database System Concepts and Architecture.
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.
Presentation transcript:

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object and Object- Relational Databases

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Chapter 11 Outline  Overview of Object Database Concepts  Object-Relational Features: Object Database Extensions to SQL  The ODMG Object Model and the Object Definition Language ODL  Object Database Conceptual Design  The Object Query Language OQL  Overview of the C++ Language Binding in the ODMG Standard

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Object and Object-Relational Databases  Object databases (ODB)  Object data management systems (ODMS)  Meet some of the needs of more complex applications  Specify: Structure of complex objects Operations that can be applied to these objects

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Overview of Object Database Concepts  Introduction to object-oriented concepts and features  Origins in OO programming languages  Object has two components: State (value) and behavior (operations)  Instance variables Hold values that define internal state of object  Operation is defined in two parts: Signature or interface and implementation

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Overview of Object Database Concepts (cont’d.)  Inheritance Permits specification of new types or classes that inherit much of their structure and/or operations from previously defined types or classes  Operator overloading Operation’s ability to be applied to different types of objects Operation name may refer to several distinct implementations

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Object Identity, and Objects versus Literals  Unique identity  Implemented via a unique, system-generated object identifier (OID)  Immutable  Most OO database systems allow for the representation of both objects and literals (or values)

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Complex Type Structures for Objects and Literals  Structure of arbitrary complexity  Contain all necessary information that describes object or literal  Nesting type constructors  Construct complex type from other types  Most basic constructors:  Atom  Struct (or tuple)  Collection

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Complex Type Structures for Objects and Literals (cont’d.)  Collection types:  Set  Bag  List  Array  Dictionary  Object definition language (ODL)  Used to define object types for a particular database application

Copyright © 2011 Ramez Elmasri and Shamkant Navathe

Encapsulation of Operations and Persistence of Objects  Encapsulation  Related to abstract data types and information hiding in programming languages  Define behavior of a type of object based on operations that can be externally applied  External users only aware of interface of the operations  Divide structure of object into visible and hidden attributes

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Object Behavior/Operations  See figure 11.2

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Encapsulation of Operations  Object constructor  Used to create a new object  Destructor operation  Used to destroy (delete) an object  Modifier operations  Modify the states (values) of various attributes of an object  Retrieve information about the object  Dot notation used to apply operations to object

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Persistence of Objects  Transient objects  Exist in executing program  Disappear once program terminates  Persistent objects  Stored in database and persist after program termination  Naming mechanism  Reachability

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Type Hierarchies and Inheritance  Inheritance  Definition of new types based on other predefined types  Leads to type (or class) hierarchy  Type: type name and list of visible (public) functions  Format: TYPE_NAME: function, function,..., function

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Type Hierarchies and Inheritance (cont’d.)  Subtype  Useful when creating a new type that is similar but not identical to an already defined type  Example: EMPLOYEE subtype-of PERSON: Salary, Hire_date, Seniority STUDENT subtype-of PERSON: Major, Gpa

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Type Hierarchies and Inheritance (cont’d.)  Extent  Store collection of persistent objects for each type or subtype  Extents are subsets of the extent of class OBJECT  Persistent collection  Stored permanently in the database  Transient collection  Exists temporarily during the execution of a program

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Other Object-Oriented Concepts  Polymorphism of operations  Also known as operator overloading  Allows same operator name or symbol to be bound to two or more different implementations  Depending on type of objects to which operator is applied  Multiple inheritance  Subtype inherits functions (attributes and methods) of more than one supertype

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Other Object-Oriented Concepts (cont’d.)  Selective inheritance  Subtype inherits only some of the functions of a supertype

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Summary of Object Database Concepts  Object identity  Type constructor  Encapsulation of operations  Programming language compatibility  Type hierarchies and inheritance  Extents  Polymorphism and operator overloading

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Object-Relational Features: Object Database Extensions to SQL  Type constructors  Specify complex objects  Mechanism for specifying object identity  Encapsulation of operations  Provided through user-defined types (UDTs)  Inheritance mechanisms  Provided using keyword UNDER

Copyright © 2011 Ramez Elmasri and Shamkant Navathe User-Defined Types and Complex Structures for Objects  UDT syntax:  CREATE TYPE TYPE_NAME AS ( );  ROW TYPE  Directly create a structured attribute using the keyword ROW phone_no ROW ( area_code char (3), prefix_no char (3), number char (4), ),

Copyright © 2011 Ramez Elmasri and Shamkant Navathe User-Defined Types and Complex Structures for Objects (cont’d.)  Array type  Reference elements using [ ]  CARDINALITY function  Return the current number of elements in an array

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Object Identifiers Using Reference Types  Reference type  Create unique system-generated object identifiers  Examples: REF IS SYSTEM GENERATED REF IS ; Generation methods: SYSTEM GENERATED or DERIVED

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Creating Tables Based on the UDTs  INSTANTIABLE  Specify that UDT is instantiable  Causes one or more tables to be created

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Encapsulation of Operations  User-defined type  Specify methods (or operations) in addition to the attributes  Format: CREATE TYPE ( );

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Encapsulation of Operations (cont’d.)  Constructor function TYPE_T( )  Returns a new object of that type  Observer function A implicitly created for each attribute A  A(X) or X.A return the of attribute A  User defined functions can internal (SQL) or external  External functions written in a host language

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Specifying Inheritance and Overloading of Functions  Inheritance rules:  All attributes inherited  Order of supertypes in UNDER clause determines inheritance hierarchy  Instance of a subtype can be used in every context in which a supertype instance used  Subtype can redefine any function defined in supertype  NOT FINAL: subtypes are allowed to be defined

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Specifying Inheritance and Overloading of Functions (cont’d.)  When a function is called, best match selected based on types of all arguments  For dynamic linking, runtime types of parameters is considered

Copyright © 2011 Ramez Elmasri and Shamkant Navathe 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 (e.g, FK)  Dot notation: Build path expressions  –> Used for dereferencing SELECT E.Employee -> Name FROM EMPLOYMENT AS E WHERE E.Company -> Name = ‘Microsoft’;

Copyright © 2011 Ramez Elmasri and Shamkant Navathe The ODMG Object Model and the Object Definition Language ODL  ODMG object model  Data model for object definition language (ODL) and object query language (OQL)  Objects and Literals  Basic building blocks of the object model  Object has five aspects:  Identifier, name, lifetime, structure, and creation  Literal  Value that does not have an object identifier

Copyright © 2011 Ramez Elmasri and Shamkant Navathe The ODMG Object Model and the ODL (cont’d.)  Behavior refers to operations  State refers to properties  Interface  Specifies only behavior of an object type  Typically noninstantiable  Class  Specifies both state (attributes) and behavior (operations) of an object type  Instantiable

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Inheritance in the Object Model of ODMG  Behavior inheritance  Also known as IS-A or interface inheritance  Specified by the colon (:) notation  EXTENDS inheritance  Specified by keyword extends  Inherit both state and behavior strictly among classes  Multiple inheritance via extends not permitted

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Built-in Interfaces and Classes in the Object Model  Collection objects  Inherit the basic Collection interface  I = O.create_iterator()  Creates an iterator object for the collection  Collection objects further specialized into:  set, list, bag, array, and dictionary

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Built-in Interfaces and Classes in the Object Model (cont’d.)

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Atomic (User-Defined) Objects  Specified using keyword class in ODL  Attribute  Property; describes some aspect of an object  Relationship  Two objects in the database are related  Keyword inverse Single conceptual relationship in inverse directions  Operation signature:  Operation name, argument types, return value

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Extents, Keys, and Factory Objects  Extent  Contains all persistent objects of class  Key  One or more properties whose values are unique for each object in extent  Factory object  Used to generate or create individual objects via its operations

Copyright © 2011 Ramez Elmasri and Shamkant Navathe The Object Definition Language ODL  Support semantic constructs of ODMG object model  Independent of any particular programming language

Copyright © 2011 Ramez Elmasri and Shamkant Navathe

Object Database Conceptual Design  Differences between conceptual design of ODB and RDB, handling of:  Relationships  Inheritance  Philosophical difference between relational model and object model of data  In terms of behavioral specification

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Mapping an EER Schema to an ODB Schema  Create ODL class for each EER entity type  Add relationship properties for each binary relationship  Include appropriate operations for each class  ODL class that corresponds to a subclass in the EER schema  Inherits type and methods of its superclass in ODL schema

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Mapping an EER Schema to an ODB Schema (cont’d.)  Weak entity types  Mapped same as regular entity types  Categories (union types)  Difficult to map to ODL  An n-ary relationship with degree n > 2  Map into a separate class, with appropriate references to each participating class

Copyright © 2011 Ramez Elmasri and Shamkant Navathe The Object Query Language OQL  Query language proposed for ODMG object model  Simple OQL queries, database entry points, and iterator variables  Syntax: select... from... where... structure  Entry point: named persistent object  Iterator variable: define whenever a collection is referenced in an OQL query

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Query Results and Path Expressions  Result of a query  Any type that can be expressed in ODMG object model  OQL orthogonal with respect to specifying path expressions  Attributes, relationships, and operation names (methods) can be used interchangeably within the path expressions

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Other Features of OQL  Named query  Specify identifier of named query  OQL query will return collection as its result  If user requires that a query only return a single element use element operator  Aggregate operators  Membership and quantification over a collection

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Other Features of OQL (cont’d.)  Special operations for ordered collections  Group by clause in OQL  Similar to the corresponding clause in SQL  Provides explicit reference to the collection of objects within each group or partition  Having clause  Used to filter partitioned sets

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Overview of the C++ Language Binding in the ODMG Standard  Specifies how ODL constructs are mapped to C++ constructs  Uses prefix d_ for class declarations that deal with database concepts  Template classes  Specified in library binding  Overloads operation new so that it can be used to create either persistent or transient objects

Copyright © 2011 Ramez Elmasri and Shamkant Navathe Summary  Overview of concepts utilized in object databases  Object identity and identifiers; encapsulation of operations; inheritance; complex structure of objects through nesting of type constructors; and how objects are made persistent  Description of the ODMG object model and object query language (OQL)  Overview of the C++ language binding