Presentation is loading. Please wait.

Presentation is loading. Please wait.

OBJECT DATABASE CONCEPTS MIS 409 John Vance Cassidy Warren April 23, 2015.

Similar presentations


Presentation on theme: "OBJECT DATABASE CONCEPTS MIS 409 John Vance Cassidy Warren April 23, 2015."— Presentation transcript:

1 OBJECT DATABASE CONCEPTS MIS 409 John Vance Cassidy Warren April 23, 2015

2 OVERVIEW What’s an Object? What’s an Object? Benefits, Reasons for and Characteristics of Objects and ODBMS Benefits, Reasons for and Characteristics of Objects and ODBMS ODBMS Features ODBMS Features ODBMS vs RDMS ODBMS vs RDMS OQL vs SQL OQL vs SQL Extensibility Extensibility Inheritance Inheritance

3 OVERVIEW Polymorphism Polymorphism Overloading Overloading Encapsulation Encapsulation Concurrency Concurrency Complex Objects Complex Objects OODB’s and commercial systems OODB’s and commercial systems

4 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

5 BENEFITS OF OBJECTS Improve program reliability Improve program reliability Simplify software maintenance Simplify software maintenance Allows for reusability of code Allows for reusability of code Maintain a direct correspondence between real-world and database objects Maintain a direct correspondence between real-world and database objects

6 REASONS FOR OO DATABASES Need for more complex applications Need for more complex applications Need for additional data modeling features Need for additional data modeling features Increased use of object-oriented programming languages Increased use of object-oriented programming languages

7 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

8 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.

9 OBJECT DATABASE MGMT SYSTEM (ODBMS) ODBMS is a database management system (DBMS) that supports the modeling and creation of data as objects. 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. 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. 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. Object-relational database management system (ORDBMS) is more commonly encountered in available products.

10 ODBMS FEATURES Designer can specify the structure of objects and their behavior (methods) Designer can specify the structure of objects and their behavior (methods) Better interaction with object-oriented languages such as Java and C++ Better interaction with object-oriented languages such as Java and C++ Definition of complex and user-defined types Definition of complex and user-defined types Encapsulation of operations and user-defined methods Encapsulation of operations and user-defined methods Query Language Query Language Faster Data Access because joins are often not needed Faster Data Access because joins are often not needed

11 ADVANTAGES OF ODBMS Designer can specify the structure of objects and their behavior (methods) Designer can specify the structure of objects and their behavior (methods) Better interaction with object-oriented languages such as Java and C++ Better interaction with object-oriented languages such as Java and C++ Definition of complex and user-defined types Definition of complex and user-defined types Encapsulation of operations and user-defined methods Encapsulation of operations and user-defined methods Access to data can be faster because joins are often not needed Access to data can be faster because joins are often not needed

12 ODBMS AND RDBMS DIFFERENCES RDBMS have been around for more than 20 years, OODBMS are relatively new. RDBMS have been around for more than 20 years, OODBMS are relatively new. RDBMS can handle >1010 records, OODBMS up to 107. 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. 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 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 Most commercial RDBMS come with an “Object-Relational” extension which implements an object database on top of a RDBMS

13 RELATIONAL DATABASE OF A CAT

14 OBJECT DATABASE OF A CAT

15 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. Structured Query Language, is a database computer language designed for managing data in relational database management systems (RDBMS), and originally based upon relational algebra.

16 OQL Object Query Language (OQL) is a query language standard for object-oriented databases modelled after SQL. Object Query Language (OQL) is a query language standard for object-oriented databases modelled after SQL. Declarative query language Declarative query language Not computationally complete Not computationally complete Syntax based on SQL (select, from, where) Syntax based on SQL (select, from, where) Additional flexibility (queries with user defined operators and types) Additional flexibility (queries with user defined operators and types)

17 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.

18 RESULT OF QUERY (SQL) Name Ford Mustang Mercedes SLK Product No. NameColor P1Ford MustangBlack P2Toyota CelicaGreen P3Mercedes SLKBlack RESULT: - The statement queries a relational database. => Returns a table with rows.

19 RESULT OF QUERY (OQL) Product No. NameColor P1Ford MustangBlack P2Toyota CelicaGreen P3Mercedes SLKBlack String Ford MustangMercedes SLK RESULT: - The statement queries a object-oriented database => Returns a collection of objects.

20 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. 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. 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 can perform mathematical computations within OQL statements.

21 OQL /SQL COMPARISON OQLSQL Object Collection Navigation Filter Link Tuple Table Join Query Key  Queries look very similar in SQL and OQL, sometimes they are the same  But, the results they give are very different

22 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 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. Database extensibility is a term that refers to the ability to extend a database schema. Static database extensibility involves the use of predefined columns. 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. 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.

23 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. 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. 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.

24 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“. 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. 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.

25 TYPE AND CLASS HIERARCHY

26 INHERITANCE Inheritance is a relationship between classes where one class is the parent (base/superclass/ancestor/etc.) class of another child (subclass). 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. 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. a way to form new classes (instances of which are called objects) using classes that have already been defined.classes objectsclasses objects

27 EXAMPLE OF INHERITANCE TYPE_NAME: function, function, …, function TYPE_NAME: function, function, …, functionEx: PERSON: Name, Adress, Birthdate, Age, SSN PERSON: Name, Adress, Birthdate, Age, SSN TEACHER: subtype of PERSON: Salary, HireDate TEACHER: subtype of PERSON: Salary, HireDate STUDENT: suptype of PERSON: Major, GPA STUDENT: suptype of PERSON: Major, GPA

28 BENEFITS OF INHERITANCE Overriding Overriding Code re-use 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. 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.

29 INHERITANCE CONCEPTS/TERMS Extents-In most OO Databases, the collection of objects in an extent have the same type or class. 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. 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 Transient Collection- exists temporarily during the execution of a program but is not kept when the program terminates

30 TYPES OF INHERITANCE Multiple Inheritance Multiple Inheritance when T is a subtype of two (or more) types, T inherits the functions (attributes and methods) of both supertypes when T is a subtype of two (or more) types, T inherits the functions (attributes and methods) of both supertypes Selective Inheritance Selective Inheritance a subtype inherits only some of the functions of a supertype 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 an EXCEPT clause may be used to list the functions in a super type that are not to be inherited by the subtype

31 MULTIPLE INHERITANCE EXAMPLE ENGINEERING _MANAGER would be a subtype of MANAGER and ENGINEER ENGINEERING _MANAGER would be a subtype of MANAGER and ENGINEER ENGINEERING_MANAGER inherits functions of BOTH supertypes, MANAGER and ENGINEER ENGINEERING_MANAGER inherits functions of BOTH supertypes, MANAGER and ENGINEER

32 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. 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. is the ability of one type, A, to appear as and be used like another type, B.

33 OPERATION POLYMORPHISM operation name may refer to several different implementations depending on the type of object it is applied to 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) several operations same name  different implementation (output of function)

34 EXAMPLE OF OVERLOADING Print(object O) Print(object O) Print(text_object T) Print(text_object T) Print(image_object P) 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:

35 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 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). 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).

36 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. 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) 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)

37 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. 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 Subclass OVERRIDES Superclass

38 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 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 processing in today’s database management systems closely resembles the batch processing of the 1960’s.

39 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. 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.

40 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 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. 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.

41 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.

42 ENCAPSULATION An attribute of object design. An attribute of object design. All the data is contained and hidden in the object. All the data is contained and hidden in the object. Can also be defined as the “internal representation of an object.” Can also be defined as the “internal representation of an object.” Typical keywords of languages such as Java & C++ (public & private) Typical keywords of languages such as Java & C++ (public & private)

43 ENCAPSULATION EXAMPLE ENCAPSULATION EXAMPLE

44 CONCURRENCY A property of computers where multiple things are done at once. A property of computers where multiple things are done at once. Time-Shared threads or physical separate processors. Time-Shared threads or physical separate processors. Used in many mathematical model designs and computations. Used in many mathematical model designs and computations. Programming practices and comparisons to parallel programming Programming practices and comparisons to parallel programming

45 CONCURRENCY IN DATABASES Database concurrency controls ensure that transactions occur in an ordered fashion. 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. 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. Must preserve the four characteristics of database transactions: atomicity, isolation, consistency and durability.

46 FOUR CHARACTERISTICS (ACID) Atomicy – success or failure Atomicy – success or failure Isolation – processes or transactions cannot interfere with one another Isolation – processes or transactions cannot interfere with one another Consistency – ensuring that a transaction maintains integrity during execution Consistency – ensuring that a transaction maintains integrity during execution Durability – ability to survive crashes Durability – ability to survive crashes

47 COMPLEX OBJECTS Simple objects + constructors. Simple objects + constructors. Simple objects include integers, characters, byte strings, and booleans. Simple objects include integers, characters, byte strings, and booleans. Examples: arrays and lists. Examples: arrays and lists.

48 OBJECT ORIENTED DATABASE MANAGEMENT SYSTEMS Object Store Object Store O2 O2 Gemstone Gemstone Versant Versant Ontos Ontos DB/Explorer ODBMS DB/Explorer ODBMS Poet Poet Objectivity /DB Objectivity /DB EyeDB EyeDB Ozone Ozone Zope Zope FramerD FramerD

49 ORACLE OBJECTS About Oracle Objects Advantages of Objects

50 ABOUT ORACLE OBJECTS User-defined types that make it possible to model real-world entities User-defined types that make it possible to model real-world entities New Object Types built from: New Object Types built from: Previously created object types Previously created object types Object references Object references Collect types Collect types

51 MORE ABOUT ORACLE OBJECTS Oracle objects can work with complex data Oracle objects can work with complex data Images Images Audio Audio Video Video

52 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 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 Objects Can Encapsulate Operations Along with Data Efficiency Efficiency Represent Part-Whole Relationships Represent Part-Whole Relationships

53 CURRENTLY USING OODBMS TO HANDLE CRITICAL DATA Chicago Stock Exchange via Versant Chicago Stock Exchange via Versant Radio Computing Services, the largest radio software company in the world Radio Computing Services, the largest radio software company in the world Large Hadron Collider at CERN Large Hadron Collider at CERN Stanford Linear Accelerator Center Stanford Linear Accelerator Center Ajou University Medical Center in South Korea Ajou University Medical Center in South Korea

54 SUMMARY OODBMS store information as objects, unlike Relational databases that are table-oriented OODBMS store information as objects, unlike Relational databases that are table-oriented OODBMS store complex data without mapping relational rows and columns OODBMS store complex data without mapping relational rows and columns OQL vs SQL OQL vs SQL OODBMS allow for more complex applications OODBMS allow for more complex applications

55 SUMMARY What’s an Object? What’s an Object? Benefits, Reasons for and Characteristics of Objects and ODBMS Benefits, Reasons for and Characteristics of Objects and ODBMS ODBMS Features ODBMS Features ODBMS vs RDMS ODBMS vs RDMS OQL vs SQL OQL vs SQL Extensibility Extensibility Inheritance Inheritance

56 SUMMARY Polymorphism Polymorphism Overloading Overloading Encapsulation Encapsulation Concurrency Concurrency Complex Objects Complex Objects OODB’s and commercial systems OODB’s and commercial systems


Download ppt "OBJECT DATABASE CONCEPTS MIS 409 John Vance Cassidy Warren April 23, 2015."

Similar presentations


Ads by Google