Object – Oriented Databases

Slides:



Advertisements
Similar presentations
OO databases 1 Object Oriented databases. OO databases 2 Developing OODBMS - motivation motivation more and more application areas require systems that.
Advertisements

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.
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.
Object-Oriented Databases v OO systems associated with – graphical user interface (GUI) – powerful modeling techniques – advanced data management capabilities.
Object-Oriented Databases
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
Object Oriented Databases - Overview
July 13, 2015ADBS: OODB1 Concepts for Object-Oriented Databases Chapter 20.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
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.
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
Exam 2 Review Dr. Bernard Chen Ph.D. University of Central Arkansas.
Advanced Database CS-426 Week 2 – Logic Query Languages, Object Model.
Data Modeling Using the Entity-Relationship Model
Programming Languages and Paradigms Object-Oriented Programming.
Chapter 4 The Relational 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.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
Chapter 21 A Object Data Model - Intro Copyright © 2004 Pearson Education, Inc.
Chapter 21 B Mapping to ODL Copyright © 2004 Pearson Education, Inc.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
Object-Oriented Database Management Systems (ODBMS)
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
ADVANCED DATABASE SYSTEMS DR. FATEMEH AHMADI- ABKENARI SEPTEMBER Object Databases.
Database Management COP4540, SCS, FIU Database Modeling A Introduction to object definition language (ODL)
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
1 CS457 Object-Oriented Databases Chapters as reference.
ITEC 3220A Using and Designing Database Systems Instructor: Prof Z. Yang Course Website: 3220a.htm
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
ITEC 3220A Using and Designing Database Systems Instructor: Gordon Turpin Course Website: Office: CSEB3020.
Chapter 2 Object-Relational DBMSs Chapter 28 in Textbook.
Object Relational Features
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.
Exam 1 Review Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
© D. Wong Security and User Authorization in SQL 8.7 pp. 410  Authorization ID = user name  Special authorization ID: PUBLIC  Privileges for:
AND OBJECT-ORIENTED DATABASES OBJECT-RELATIONAL DATABASES.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Object-Oriented Database.
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.
Chapter 20 Concepts for Object-Oriented Databases Copyright © 2004 Pearson Education, Inc.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
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,
Chapter 21 Object Database Standards, Languages, and Design Copyright © 2004 Pearson Education, Inc.
Data Modeling Using the Entity- Relationship (ER) Model
Concepts for Object Databases
CSE202 Database Management Systems
Logical Database Design and the Rational Model
ODMG Object Model, Object Definition Language (ODL)
OBJECTS & DATABASES Arnaud Sahuguet – CIS-550.
Object-Oriented Database Management System (ODBMS)
Object-Oriented Databases
Object-Relational DBMSs
Chapter 12 Outline Overview of Object Database Concepts
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.
ITEC 3220A Using and Designing Database Systems
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 15: Object-Oriented Database Development
4/27/2019.
Object – relational database
Object Database Standards, Languages, and Design
Presentation transcript:

Object – Oriented Databases Technological Education Institution of Larisa in collaboration with Staffordshire University Larisa 2007-2008 Dr. Theodoros Mitakos

Agenda Object Database Concepts Standards, Languages and Design Overview of SQL and its Object – Relational Features.

The need for OO-Databases Traditional DBMS have shortcomings when complex database applications must be designed and implemented (CAD/CAM, GIS, multimedia, scientific applications) These applications have requirement such as complex structures or objects, longer duration transactions, new types for storing images and non standard application specific operations.

Benefits of using OO Databases Flexibility to handle requirements (structure and operations) Use of object-oriented languages in developing software applications

Object oriented concepts An object has two components: state (value) and behavior (operations). Objects in an OOPL exist only during program execution (transient objects) An OO database can extend the existence of objects so that they are stored permanently and hence the objects persist beyond program termination and can be retrieved later and shared by other programs.

Object oriented concepts Object identity Type constructors Encapsulation of operations Programming language compatibility Type hierarchies and inheritance Extends Support for complex objects Polymorphism and operator overloading Versioning

Differences with relational database OO provide unique system generated OID for each object. In relational model each relation must have a primary key. Objects can have a structure of arbitrary complexity. In Rdbs information about a complex object is scattered over many relations or objects. Instance variables hold the values that define the internal state of the object. An instance variable is similar to the concept of an attribute in the relational model, except that instance variables may be encapsulated within the object and thus are not necessarily visible to external users. The insistence on complete encapsulation in early OO data models led to the argument that relationships should not be explicitly represented but should instead be described by defining appropriate methods that locate related objects. OO systems provide capabilities for dealing with multiple versions of the same object. In addition they permit schema evolution which occurs when type declarations are changed or when new types or relations are created. Schema evolution operations are already defined in the relational SQL standard.

Object identity An OO database system provides a unique identity to each independent object stored in the database. This unique identity is typically implemented via a unique, system generated object identifier, or OID. The value of an OID is not visible to an external user, but it is used internally by the system to identify each object uniquely and to create and manage interobject references.The OID can be assigned to program variables of the appropriate type when need. The main property required for an OID is that it be immutable; that is the OID value of a particular object should not change. In addition each OID must used only once. OIDs do not depend on any attribute values of an object since the value of an attribute may be changed or corrected.

Object Structure In OO databases the state of a complex object may be constructed from other objects (or other values) by using type constructors. One formal way of representing such objects is to view each object as a triple (i,c,v) where i is a unique object identifier, c is a type constructor and v is the object state. The three most basic constructors are atom, tuple and set. The type constructors set, list, array, and bag are called collection types. The main characteristic of a collection type is that the state of an object will be a collection of objects that may be unordered, or ordered. The tuple type constructor is often called structured type

Example o1=(i1,atom,’Houston’) o2=(o2,atom,’Belaire’) o3 = (i3, set, {o1,o2}) o4 = (i4, atom,' Research’) o5 = (i5, tuple,<DNAME:i5, LOCATIONS:i4>) An object definition language (ODL) that incorporates the preceding type constructors can be used to define the particular types for a particular database application.

More OO concepts The concept of encapsulation is one of the main characteristics of OO languages and systems. It is also related to the concepts of abstract data types and information hiding in programming languages. In traditional database models and systems this concept was not applied since it is customary to make the structure of database objects visible to users and external programs.

The external users of an object are only made aware of the interface of the object type, which defines the name and arguments of each operation. The implementation is hidden from the external users; it includes the definition of the internal data structures of the object and the implementation of the operations that access the structures. In OO terminology the interface part of each operation is called the signature, and the operation implementation is called a method. Typically a method is invoked by sending a message to the object to execute the corresponding method. The term class is often used to refer to an object type definition, along with the definition of the operations for that type. Typical operations include the object constructor operation, which is used to create a new object, and the destructor operation which is used to destroy an object.

Persistence An OODBMS is often closely coupled with an OOPL. The OOPL is used to specify the method implementations as well as other application code. An object is typically created by some executing application program by invoking the object constructor operation. (Transient – Persistent objects). The typical mechanisms for making an object persistent is naming and reachability. The naming mechanism involves giving an object a unique persistent name through which it can be retrieved by this and other programs The reachability mechanism works by making the object reachable from some persistent object.

Inheritance In most database applications, there are numerous objects of the same type or class. Hence, OO databases must provide a capability for classifying objects based on their type, as do other database systems. But in OO databases a further requirement is that the system permit a further requirement is that the system permits the definition of new types based on other predefined types leading to type or class hierarchy

Example PERSON: Name, Address, Birthdate, Age, SSN EMPLOYE subtype of PERSON: Salary, HireDate, Seniority STUDENT subtype of PERSON: Major, GPA

Polymorphism OO systems provide for polymorphism of operations which is also known as operator overloading. This concept allows the same operator name or symbol to be bound to two or more different implementations of the operator, depending on the type of objects to which the operator is applied. Example the operator (+).

Multiple Inheritance Multiple inheritance in a type hierarchy occurs when a certain subtype T is a subtype of two or more types and hence inherits the functions (attributes and methods) of both supertypes. This leads to a the creation of a type lattice rather than a type hierarchy. One problm that can occur with multiple inheritance is that the supertypes from which the subtype inherits may have distinct functions of the same name, creating an ambiguity. Selective inheritance occurs when a subtype inherits only some of the functions of a supertype.

Versions Many database applications that use OO systems require the existence of several versions of the same object e.g. consider two programmers working to update the same software module concurrently. In this case two versions, in addition to the original module, are needed. The programmers can update their own versions of the same software module concurrently. This is referred to as concurrent engineering. However, it eventually becomes necessary to merge these two versions together so that the new version can include the changes made by both programmers. During merging, it is also necessary to make sure that their changes are compatible. The problem of merging and reconciling changes made o two different versions is typically left to the application developers, who know the semantics of the application

The need for a standard Interoperability which refers to the ability of an application to access multiple distinct system. Portability is defined as the capability to execute a particular application program on different systems with no or minimal modifications to the program itself. In the object database field portability would allow a program written to access one ODBMS to access another ODBMS package as long as the two ODBMS support the standard.

The object model of ODMG ODMG (Object Database Management Group) is a consortium of ODBMS vendors The standard is made up of several parts The object model The definition language The object query language And the bindings to object-oriented programming languages

The model Literal: A value that does not have an object identifier (atomic, collection, structured) The notation of ODMG uses the keyword interface where the keywords type and class was used. It describes the visible attributes, relations and operations. They are not instantiable but they serve o define operations that can be inherited by the user specified class declarations that form the database schema and are used for creating application objects. The keyword class is used for user specified class declarations.

Interface Object { … Boolean same_as(Object other_object); Object copy(); Void delete(); }; Operations are applied to objects using the dot notation O.same_as(p) Arrow notation o->same_as(p)

User defined objects Class Employee (extend all_employees Key ssn) { Attribute string name; Attribute string ssn; Attribute date birthdate; Attribute enum gender{M,F} sex; Relationship department works_for; Inverse Department::has_emps; Void reassign_emp(in string new_dname) Raises(dname_not_valid) }

Characteristics of the model Behavior refers to operations State refers to properties (attributes and relationships) The extend contains all persistent objects of that class A key consists of one or more properties whose values are constrained to be unique for each object in the extend. A relation is a property that specifies that two objects in the database are related together (only binary relationships are represented explicitly in the model). The keyword inverse specifies that these two properties specify a single conceptual relationship in inverse directions. The operation signature can specify the names of exceptions that can ccur during operation execution. Factory object: an object that can be used to generate or create individual objects via its operations. Interface objectfactory{ Object new(); }

Graphical notation for representing ODL schemas Interface Person Class Student Relationships 1:1 1:N M:N inheritance Interface (is-a) Class inheritance using extends

A part of a database has_faculty has majors offers Person Works_in Department Person Works_in Offered by Course Majors_in Completed sections faculty Student Has sectinos Registered_in students advises Section on_committee_of Of course advisor GradStudent CurrSection committee Reistered_students

The object query language OQL Iterator variable an extend name SELECT d.dname FROM d in departments WHERE d.college=“Engineering” SELECT f.rank FROM f in csdepartment.has_faculty SELECT struct(last_name:s.name.lnam, first_name: s.name.fname, gpa:s.gpa) FROM s in csdepartment.has_majors WHERE s.class =“senior” ORDER BY gpa DESC Path expression

OTHER FEATURES Specifying views Extracting Single Elements Collection operators

Mapping an EER Schema to an ODB Schema Step 1: Create an ODL class for each for EER entity subclass. The type of the ODL class should include all the attributes of the EER class. Multivalued attributes is declared by using the set, bag or list constructor. Composite attributes are mapped into a tuple constructor Step 2: Add relationship properties or reference attributes for each binary relationship into the ODL classes that participate in the relationship. Depending on the cardinality ratio of the binary relationship the relationship properties or reference attributes may be single valued or collection types Step 3: Include appropriate operations for each class. These are not available from the EER schema and must be added to the database design by referring to the original requirements. Step 4: An ODL class that corresponds to a subclass in the EER schema inherits the type and methods of its superclass in the ODL schema

Mapping an EER Schema to an ODB Schema Step 5: Weak entity can be mapped in the same way as regular entity types. Step 6: Categories (union types) in an EER schema are difficult to map to ODL. It is possible to create a mapping similar to the EER-to-relational mapping by declaring a class to represent the category and defining 1:1 relationships between the category and each of its superclasses. Step 7: An n-ary relation with degree n>2 can be mapped into a separate class, with appropriate references to each participating class.

Object –Relational Support in SQL 99 Type constructors CREATE TYPE Addr_type AS ROW ( Street VARCHAR (45), City VARCHAR(25), Zip CHAR(5) ); CREATE TYPE Emp_type AS ROW ( Name VARCHAR (35), Addr Addr_type, Age INTEGER

Object Identifiers CREATE TABLE Employee OF Emp_type REF IS emp_id SYSTEM GENERATED; The above example illusrates how the user can specify that system generated object identifiers for individual rows in a table should be created.

Encapsulation of operations in SQL In SQL a construct similar to class definition is provided whereby the user can create a named user-defined type with its own behavioral specification by specifying method in addition to attributes. CREATE TYPE Addr_type As ( Street VARCHAR (45), City VARCHAR(25), Zip CHAR(5) ) METHOD apt_no() RETURNS CHAR(8); The code for implementing the method has to be written. We refer to the method implementation by specifying the file that contains the code for the method as follows: METHOD CREATE FUNCTION apt_no() RETURNS CHAR(8) FOR Addr_type AS EXTERNAL NAME ‘x/y/apto.class’ LANGUAGE ‘java’; In this example the implementation is in java language and the code is stored in the specified path name.

Inheritance and overloading of Functions in SQL SQL Rulles dealing with inheritance All attribute are inherited The order of supertypes in the UNDER clause determines the inheritance hierarchy. An instance of a subtype can be used in every context in which a supertype instance is used A subtype can redefine any function that is defined in its supertype, with the restriction that the signature be the same When a function is called, the best match is selected based on the types of all arguments For dynamic linking, the runtime types of parameters is considered.

Example CREATE TABLE real_estate_info ( Property real_estate, Owner CHAR(25), Price MONEY, ); CREATE TABLE american_real_estate UNDER real_estate_info; CREATE TABLE georgia_real_estete UNDER american_real_estate;

Unstructured Complex Objects in SQL SQL has new data types for binary large objects (LOBS). Two variations exist for binary large objects (BLOBs) and character large objects (CLOBs). SQL proposes LOB manipulation within the DBMS without having to use external files.