Download DataBase Development and Implementation Lec17 - Object Oriented Databases and more Study notes Database Management Systems (DBMS) in PDF only on Docsity! DBDI 30/05/2007 Lecture-17 / OODBs 1 DBDI/ Lecture 17 Object Oriented Databases Mr. Alun Butler & Dr. Ala Al-Zobaidie The slides are based on the textbook Database Systems by Thomas Connolly & Carolyn Begg 30/05/2007 DBDI / OODB 2 Lecture - Objectives • Advanced database applications. • Unsuitability of RDBMSs for advanced database applications. • Object-oriented concepts. • Problems of storing objects in relational database. • The next generation of database systems. 30/05/2007 DBDI / OODB 3 Advanced Database Applications • Computer-Aided Design (CAD) • Computer-Aided Manufacturing (CAM) • Computer-Aided Software Engineering (CASE) • Network Management Systems • Office Information Systems (OIS) and Multimedia Systems • Digital Publishing • Geographic Information Systems (GIS) • Interactive and Dynamic Web sites • Other applications with complex and interrelated objects and procedural data. 30/05/2007 DBDI / OODB 4 Interactive and Dynamic Web Sites • Consider web site with online catalog for selling clothes. Web site maintains a set of preferences for previous visitors to the site and allows a visitor to: – obtain 3D rendering of any item based on color, size, fabric, etc; – modify rendering to account for movement, illumination, backdrop, occasion, etc; – select accessories to go with the outfit, from items presented in a sidebar; • Need to handle multimedia content and to interactively modify display based on user preferences and user selections. Also have added complexity of providing 3D rendering. 30/05/2007 DBDI / OODB 5 Weaknesses of RDBMSs • Poor Representation of "Real World" Entities – Normalization leads to relations that do not correspond to entities in "real world". • Semantic Overloading – Relational model has only one construct for representing data and data relationships: the relation. – Relational model is semantically overloaded. 30/05/2007 DBDI / OODB 6 Weaknesses of RDBMSs • Poor Support for Integrity and Enterprise Constraints • Homogeneous Data Structure – Relational model assumes both horizontal and vertical homogeneity. – Many RDBMSs now allow Binary Large Objects (BLOBs). DBDI 30/05/2007 Lecture-17 / OODBs 2 30/05/2007 DBDI / OODB 7 Weaknesses of RDBMSs • Limited Operations – RDBMs only have a fixed set of operations which cannot be extended. • Difficulty Handling Recursive Queries – Extremely difficult to produce recursive queries. – Extension proposed to relational algebra to handle this type of query is unary transitive (recursive) closure, operation. i.e. tuples are transitively deduced 30/05/2007 DBDI / OODB 8 Example - Recursive Query Find all managers who, directly or indirectly, manage staff member S005? Problem: you do not know # recursion levels in hierarchy! e.g. change S005 above to any individual ! Solution => embedded SQL 30/05/2007 DBDI / OODB 9 Weaknesses of RDBMSs • Impedance Mismatch – Most DMLs lack computational completeness. – To overcome this, SQL can be embedded in a high-level 3GL. – This produces an impedance mismatch - mixing different programming paradigms. – Estimated that as much as 30% of programming effort and code space is expended on this type of conversion. 30/05/2007 DBDI / OODB 10 Weaknesses of RDBMSs • Other Problems with RDBMSs – Transactions are generally short-lived and concurrency control protocols not suited for long-lived transactions. – Schema changes are difficult. – RDBMSs are poor at navigational access. 30/05/2007 DBDI / OODB 11 Object-oriented concepts • Abstraction, encapsulation, information hiding. • Objects and attributes. • Object identity. • Methods and messages. • Classes, subclasses, superclasses, and inheritance. • Overloading. • Polymorphism and dynamic binding. 30/05/2007 DBDI / OODB 12 Advantages of OIDs • They are efficient. • They are fast. • They cannot be modified by the user. • They are independent of content. DBDI 30/05/2007 Lecture-17 / OODBs 5 30/05/2007 DBDI / OODB 25 History of Data Models 30/05/2007 DBDI / OODB 26 Objectives / 2 • Issues underlying ODBMSs. • Advantages and disadvantages. • OODBMS Manifesto. • Object-oriented database design. 30/05/2007 DBDI / OODB 27 Object-Oriented Data Model No one agreed object data model. One definition: Object-Oriented Data Model (OODM) – Data model that captures semantics of objects supported in object-oriented programming. Object-Oriented Database (OODB) – Persistent and sharable collection of objects defined by an ODM. Object-Oriented DBMS (OODBMS) – Manager of an ODB. 30/05/2007 DBDI / OODB 28 Origins of the Object-Oriented Data Model 30/05/2007 DBDI / OODB 29 Single-Level v. Two-Level Storage Model • Traditional programming languages lack built-in support for many database features. • Increasing number of applications now require functionality from both database systems and programming languages. • Such applications need to store and retrieve large amounts of shared, structured data. 30/05/2007 DBDI / OODB 30 Single-Level v. Two-Level Storage Model • With a traditional DBMS, programmer has to: – decide when to read and update objects. – write code to translate between application’s object model and the data model of the DBMS. – perform additional type-checking when object is read back from database, to guarantee object will conform to its original type. DBDI 30/05/2007 Lecture-17 / OODBs 6 30/05/2007 DBDI / OODB 31 Single-Level v. Two-Level Storage Model • Difficulties occur because conventional DBMSs have two-level storage model: storage model in memory, and database storage model on disk. • In contrast, OODBMS gives illusion of single-level storage model, with similar representation in both memory and in database stored on disk. – Requires clever management of representation of objects in memory and on disk (called “pointer swizzling”). 30/05/2007 DBDI / OODB 32 Two-level Storage Model for RDBMS 30/05/2007 DBDI / OODB 33 Single-level Storage Model for OODBMS 30/05/2007 DBDI / OODB 34 Pointer Swizzling Techniques The action of converting object identifiers (OIDs) to main memory pointers. • Aim is to optimize access to objects. • Should be able to locate any referenced objects on secondary storage using their OIDs. • Once objects have been read into cache, want to record that objects are now in memory to prevent them from being retrieved again. 30/05/2007 DBDI / OODB 35 Pointer Swizzling Techniques • Could hold lookup table that maps OIDs to memory pointers. • Pointer swizzling attempts to provide a more efficient strategy by storing memory pointers in the place of referenced OIDs, and vice versa when the object is written back to disk. 30/05/2007 DBDI / OODB 36 No Swizzling • Easiest implementation is not to do any swizzling. • Objects faulted into memory, and handle passed to application containing object’s OID. • OID is used every time the object is accessed. • System must maintain some type of lookup table so that object’s virtual memory pointer can be located and then used to access object. • Inefficient if same objects are accessed repeatedly. • Acceptable if objects only accessed once. DBDI 30/05/2007 Lecture-17 / OODBs 7 30/05/2007 DBDI / OODB 37 OODBMS Manifesto • Complex objects must be supported. • Object identity must be supported. • Encapsulation must be supported. • Types or Classes must be supported. • Types or Classes must be able to inherit from their ancestors. • Dynamic binding must be supported. • The DML must be computationally complete. 30/05/2007 DBDI / OODB 38 OODBMS Manifesto • The set of data types must be extensible. • Data persistence must be provided. • The DBMS must be capable of managing very large databases. • The DBMS must support concurrent users. • DBMS must be able to recovery from hardware/software failures. • DBMS must provide a simple way of querying data. 30/05/2007 DBDI / OODB 39 OODBMS Manifesto • The manifesto proposes the following optional features: – Multiple inheritance, type checking and type inferencing, distribution across a network, design transactions and versions. • No direct mention of support for security, integrity, views or even a declarative query language. 30/05/2007 DBDI / OODB 40 Advantages of OODBMSs • Enriched Modeling Capabilities. • Extensibility. • Removal of Impedance Mismatch. • More Expressive Query Language. • Support for Schema Evolution. • Support for Long Duration Transactions. • Applicability to Advanced Database Applications. • Improved Performance. 30/05/2007 DBDI / OODB 41 Disadvantages of OODBMSs • Lack of Universal Data Model. • Lack of Experience. • Lack of Standards. • Query Optimization compromises Encapsulation. • Object Level Locking may impact Performance. • Complexity. • Lack of Support for Views. • Lack of Support for Security. 30/05/2007 DBDI / OODB 42 Object-Relational DBMSs – Objectives /3 • How relational model has been extended to support advanced database applications. • Features proposed in third-generation database system manifestos from CADF and Darwen/Date. • Object-oriented features in SQL3. • How OODBMSs and ORDBMSs compare in terms of data modeling, data access, and data sharing.