object database concepts mis 409 john vance cassidy warren april 23, 2015

Post on 23-Dec-2015

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

OBJECT DATABASE CONCEPTS

MIS 409

John Vance

Cassidy Warren

April 23, 2015

OVERVIEW

• What’s an Object?

• Benefits, Reasons for and Characteristics of Objects and ODBMS

• ODBMS Features

• ODBMS vs RDMS

• OQL vs SQL

• Extensibility

• Inheritance

OVERVIEW

• Polymorphism

• Overloading

• Encapsulation

• Concurrency

• Complex Objects

• OODB’s and commercial systems

WHAT’S AN OBJECT?

Objects – User defined complex data types

Two components: State (value) and behavior (operations). Similar to program variable in programming language, except that it will typically have a complex data structure

Has specific operations defined by the programmer

BENEFITS OF OBJECTS

• Improve program reliability

• Simplify software maintenance

• Allows for reusability of code

• Maintain a direct correspondence between real-world and database objects

REASONS FOR OO DATABASES

• Need for more complex applications

• Need for additional data modeling features

• Increased use of object-oriented programming languages

CHARACTERISTICS OF AN OBJECT

An object is described by four characteristics

Identifier: a system-wide unique id for an object

Name: an object may also have a unique name in DB (optional)

Lifetime: determines if the object is persistent or transient

Structure: Construction of objects using type constructors

WHAT IS AN OBJECT DATABASE?

An object database (also object-oriented database) is a database model in which information is represented in the form of objects as used in object-oriented programming.

OBJECT DATABASE MGMT SYSTEM

(ODBMS)• ODBMS is a database management system (DBMS) that

supports the modeling and creation of data as objects.

• includes some kind of support for classes of objects and the inheritance of class properties and methods by

subclasses and their objects.

• Currently no widely agreed-upon standard for what constitutes an OODBMS, and OODBMS products are

considered to be still in their infancy.

• Object-relational database management system (ORDBMS) is more commonly encountered in available

products.

ODBMS FEATURES

• Designer can specify the structure of objects and their behavior (methods)

• Better interaction with object-oriented languages such as Java and C++

• Definition of complex and user-defined types

• Encapsulation of operations and user-defined methods

• Query Language

• Faster Data Access because joins are often not needed

ADVANTAGES OF ODBMS

• Designer can specify the structure of objects and their behavior (methods)

• Better interaction with object-oriented languages such as Java and C++

• Definition of complex and user-defined types

• Encapsulation of operations and user-defined methods

• Access to data can be faster because joins are often not needed

ODBMS AND RDBMS DIFFERENCES

• RDBMS have been around for more than 20 years, OODBMS are relatively new.

 

• RDBMS can handle >1010 records, OODBMS up to 107.

 

• OODBM good for storing complex descriptions (e.g., a plant schematic), RDMSs appropriate for simple, “flat” data.

• RDBMS control the DB market (>90%), OODBMS own <5% of the market.

• Most commercial RDBMS come with an “Object-Relational” extension which implements an object database on top of a RDBMS

RELATIONAL DATABASE OF A CAT

OBJECT DATABASE OF A CAT

SQL

• Structured Query Language, is a database computer language designed for managing data in relational database management systems (RDBMS), and originally based upon relational algebra.

OQL

• Object Query Language (OQL) is a query language standard for object-oriented databases modelled after SQL.

• Declarative query language

• Not computationally complete

• Syntax based on SQL (select, from, where)

• Additional flexibility (queries with user defined operators and types)

EXAMPLE OF OQL QUERY

The following is a sample query

“what are the names of the black product?”

Select distinct p.name

From products p

Where p.color = “black”Þ Valid in both SQL and OQL, but results are different.

RESULT OF QUERY (SQL)

Name

Ford MustangMercedes SLK

Product No. Name Color

P1 Ford Mustang Black

P2 Toyota Celica Green

P3 Mercedes SLK Black

RESULT:

- The statement queries a relational database.

=> Returns a table with rows.

RESULT OF QUERY (OQL)Product No. Name Color

P1 Ford Mustang Black

P2 Toyota Celica Green

P3 Mercedes SLK Black

String String

Ford Mustang Mercedes SLK

RESULT:

- The statement queries a object-oriented database

=> Returns a collection of objects.

OQL VS SQL

Key Differences Between OQL and SQL

OQL differs from SQL in that:

• OQL supports object referencing within tables. Objects can be nested within objects.

• Not all SQL keywords are supported within OQL. Keywords that are not relevant to Netcool/Precision IP have been removed from the syntax.

• OQL can perform mathematical computations within OQL statements.

OQL /SQL COMPARISON

OQL SQL

ObjectCollectionNavigationFilterLink

TupleTable JoinQueryKey

Queries look very similar in SQL and OQL, sometimes they are the sameBut, the results they give are very different

EXTENSIBILITY

• Ability of a software system (such as a database system) to allow and accept significant extension of its capabilities, without major rewriting of code or changes in its basic architecture

• Database extensibility is a term that refers to the ability to extend a database schema.

• Static database extensibility involves the use of predefined columns.

• Dynamic database extensibility involves adding columns to a table or creating an extension table with records that have a one-to-one relationship with records in a base table.

EXTENSIBILITY (PT. 2)

• Advanced database extensibility involves creating new tables whose records have a one-to-many or a many-to-one relationship with records in a standard base table.

• Database Extensibility usually drives GUI customization, enabling System Administrators to enhance screens to display new fields to users.  Often, System Administrators can use drag-and-drop facilities to place new fields onto data entry screens, and determine the field order for both the standard and custom fields.

CLASS HIERARCHY

• a classification of object types, denoting objects as the instantiations of classes inter-relating the various classes by relationships such as "inherits", "extends“.

• When a method is invoked on an object it is first looked for in the object's class, then the superclass of that class, and so on up the hierarchy until it is found.

TYPE AND CLASS HIERARCHY

INHERITANCE

• Inheritance is a relationship between classes where one class is the parent(base/superclass/ancestor/etc.) class of another child (subclass).

• Objects inherit attributes from parent objects.

• a way to form new classes (instances of which are called objects) using classes that have already been defined.

EXAMPLE OF INHERITANCE

TYPE_NAME: function, function, …, function

Ex:

• PERSON: Name, Adress, Birthdate, Age, SSN

• TEACHER: subtype of PERSON: Salary, HireDate

• STUDENT: suptype of PERSON: Major, GPA

BENEFITS OF INHERITANCE

• Overriding

• Code re-use

• One of the earliest motivations for using inheritance was the re-use of code which already existed in another class. This practice is usually called implementation inheritance.

INHERITANCE CONCEPTS/TERMS

• Extents-In most OO Databases, the collection of objects in an extent have the same type or class.

• Persistant Collection- Holds a collection of objects that is stored permanently in the database and therefore can be accessed and shared by multiple programs.

• Transient Collection- exists temporarily during the execution of a program but is not kept when the program terminates

TYPES OF INHERITANCE

• Multiple Inheritance

• when T is a subtype of two (or more) types, T inherits the functions (attributes and methods) of both supertypes

• Selective Inheritance

• a subtype inherits only some of the functions of a supertype

• an EXCEPT clause may be used to list the functions in a super type that are not to be inherited by the subtype

MULTIPLE INHERITANCE EXAMPLE

• ENGINEERING _MANAGER would be a subtype of MANAGER and ENGINEER

• ENGINEERING_MANAGER inherits functions of BOTH supertypes, MANAGER and ENGINEER

POLYMORPHISM

• Allows two methods to use the same name but have different behavior. Methods for one object can be defined, then the operation specification (methods) can be shared with other objects.

In other words:

• is the ability of one type, A, to appear as and be used like another type, B.

OPERATION POLYMORPHISM

• operation name may refer to several different implementations depending on the type of object it is applied to

• several operations same name different implementation (output of function)

EXAMPLE OF OVERLOADING• Print(object O)

• Print(text_object T)

• Print(image_object P)

•Print(objectO) is a method that prints.

•Print(text_objectT) is an OVERLOADED method that prints text.

•Print(image_objectP) is an OVERLOADED method that prints pictures.

Operation Specification:

USES OF POLYMORPHISM

• The primary usage of polymorphism in industry is the ability of objects belonging to different types to respond to method, field, or property calls of the same name, each one according to an appropriate type-specific behavior.

• The programmer (and the program) does not have to know the exact type of the object in advance, and so the exact behavior is determined at run time (this is called late binding or dynamic binding).

INHERITANCE W/ POLYMORPHISM

• Inheritance combined with polymorphism allows class B to inherit from class A without having to retain all features of class A; it can do some of the things that class A does differently.

• If a Dog is commanded to speak(), it may emit a bark, while if a Pig is asked to speak(), it may respond with an oink. Both inherit speak() from Animal, but their subclass methods override the methods of the superclass, known as overriding polymorphism. Adding a walk method to Animal would give both Pig and Dog objects the same walk method. (Different speak, same walk method)

OVERRIDING

• allows a subclass to provide a specific implementation of a method that is already provided by one of its superclasses. The implementation in the subclass overrides (replaces) the implementation in the superclass.

• Subclass OVERRIDES Superclass

AGGREGATION

• Aggregation is an abstraction through which relationships are treated as higher-level entities. It is an increasingly important operation in today’s relational database management systems.

• Aggregation processing in today’s database management systems closely resembles the batch processing of the 1960’s.

AGGREGATION EXAMPLE

• A small business needs to keep track of its computer systems. They want to recorded information such as model and serial number for each system and its components.

INCORRECT MODEL (WITH IMPROVEMENT)

• The incorrect model puts all the information into a single class type. This class contains a set of repeated attributes.

• The improved model will accommodate the addition of more types of components (a scanner, perhaps), a system with more than one monitor or printer, or a replacement component on the shelf that don’t belong to any system right now.

BETTER MODEL (WITH UML AGGREGATION)

UML allows us to show the association in a more semantically correct way. The system is an aggregation of components. In UML, aggregation is shown by an open diamond on the end of the association line that points to the parent (aggregated) class. There is an implied multiplicity on this end of 0..1, with multiplicity of the other end shown in the diagram as usual. To describe this association, we would say that each system is composed of one or more components and each component is part of zero or one system.

ENCAPSULATION

• An attribute of object design.

• All the data is contained and hidden in the object.

• Can also be defined as the “internal representation of an object.”

• Typical keywords of languages such as Java & C++ (public & private)

ENCAPSULATION EXAMPLE

CONCURRENCY

• A property of computers where multiple things are done at once.

• Time-Shared threads or physical separate processors.

• Used in many mathematical model designs and computations.

• Programming practices and comparisons to parallel programming

CONCURRENCY IN DATABASES

• Database concurrency controls ensure that transactions occur in an ordered fashion.

• Main job of these controls is to protect transactions issued by different users/applications from the effects of each other.

• Must preserve the four characteristics of database transactions: atomicity, isolation, consistency and durability.

FOUR CHARACTERISTICS (ACID)

• Atomicy – success or failure

• Isolation – processes or transactions cannot interfere with one another

• Consistency – ensuring that a transaction maintains integrity during execution

• Durability – ability to survive crashes

COMPLEX OBJECTS

• Simple objects + constructors.

• Simple objects include integers, characters, byte strings, and booleans.

• Examples: arrays and lists.

OBJECT ORIENTED DATABASE MANAGEMENT SYSTEMS

• Object Store

• O2

• Gemstone

• Versant

• Ontos

• DB/Explorer ODBMS

• Poet

• Objectivity /DB

• EyeDB

• Ozone

• Zope

• FramerD

ORACLE OBJECTSAbout Oracle Objects

Advantages of Objects

ABOUT ORACLE OBJECTS

• User-defined types that make it possible to model real-world entities

• New Object Types built from:

• Previously created object types

• Object references

• Collect types

MORE ABOUT ORACLE OBJECTS

• Oracle objects can work with complex data

• Images

• Audio

• Video

ADVANTAGES OF ORACLE OBJECTS…

• Like raw databases, data is stored in rows in columns but the interaction with database is with objects and entities that you have created

• Objects Can Encapsulate Operations Along with Data

• Efficiency

• Represent Part-Whole Relationships

CURRENTLY USING OODBMS TO HANDLE CRITICAL DATA

• Chicago Stock Exchange via Versant

• Radio Computing Services, the largest radio software company in the world

• Large Hadron Collider at CERN

• Stanford Linear Accelerator Center

• Ajou University Medical Center in South Korea

SUMMARY

• OODBMS store information as objects, unlike Relational databases that are table-oriented

• OODBMS store complex data without mapping relational rows and columns

• OQL vs SQL

• OODBMS allow for more complex applications

SUMMARY

• What’s an Object?

• Benefits, Reasons for and Characteristics of Objects and ODBMS

• ODBMS Features

• ODBMS vs RDMS

• OQL vs SQL

• Extensibility

• Inheritance

SUMMARY

• Polymorphism

• Overloading

• Encapsulation

• Concurrency

• Complex Objects

• OODB’s and commercial systems

top related