1 / 46

Database and Information Systems

Database and Information Systems. Beyond RDBMS Lectures based on material from Phil Trinder (HW) , Connelly & Begg textbook Monica Farrow G30 email : monica@macs.hw.ac.uk. Topics. Impedance mismatch Persistence OR Mapping Frameworks Limitations of RDBMS OODBMS ORDBMS.

ronalee
Download Presentation

Database and Information Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Database and Information Systems Beyond RDBMS Lectures based on material from Phil Trinder (HW) , Connelly & Begg textbook Monica Farrow G30 email : monica@macs.hw.ac.uk DBIS: Beyond RDBMS

  2. Topics • Impedance mismatch • Persistence • OR Mapping Frameworks • Limitations of RDBMS • OODBMS • ORDBMS DBIS: Beyond RDBMS

  3. Basic Object Relational Mapping Programming code and SQL e.g. ODBC/JDBC DBIS: Beyond RDBMS

  4. Introduction • The situation is that : • Relational databases are highly commercially successful (Oracle, DB2, SQL Server, etc) • Most databases are relational • SQL is not computationally complete • Most programming languages are now object-oriented • Therefore many applications use a RDBMS as their data store while using an object-oriented programming language for development • This requires some form of SQL within the programming language DBIS: Beyond RDBMS

  5. Flattening • For anything other than extremely simple systems, it is likely that good OO program design requires : • Converting the ResultSet which is returned by the query into an object • Using the functionality provided by the object’s class to process the results • Objects must be mapped to tables in the database (‘flattened’) and vice versa • It is estimated that as much as 30% of programming effort and code space is expended on this type of conversion DBIS: Beyond RDBMS

  6. Impedance mismatch • This is the term used for the complexity introduced by constructing programs using these two different systems, relational databases and object-oriented programming • http://service-architecture.com/object-oriented-databases/articles/impedance_mismatch.html • http://www.agiledata.org/essays/impedanceMismatch.html DBIS: Beyond RDBMS

  7. Impedance mismatch • Constructing programs this way is arduous and error-prone • Relational model uses set operations, Java has OO model with iteration, one record at a time • Data structures need to be constructed from the relations before manipulations, and flattened before storage • Relational Domains may differ from class types • The relational model does not support inheritance • ‘Many to many’ relationships are unlikely to map directly to classes • SQL and Java cannot be simply combined • SQL queries cannot be always be statically checked and may produce errors DBIS: Beyond RDBMS

  8. Persistence • One of the most critical tasks that applications have to perform is to save and restore data • Persistence is the storage of data from an application’s working memory so that it can be restored when the application is run again DBIS: Beyond RDBMS

  9. Object-Relational Mapping Frameworks • Much effort has been put in recently to making object-relational mapping more convenient • The framework handles the mapping of the objects to relational database tables where they are actually stored • Selected objects are initially marked as being persistent • thereafter, changes in those objects are transparently changed in the database • the programmer does not have to write code specifically to update the database • Examples • Hibernate, Castor, OJB, JDO…. DBIS: Beyond RDBMS

  10. OR Mapping Frameworks contd • Using a framework provides: • Transparent persistence • Object classes do not contain db details • The programmer can work only with objects • no SQL statements in the code • Could be used with different database • Easier to code • Mapping of objects to database tables is defined, usually in XML descriptor files • An extra ‘persistance layer’ is automatically inserted between the compilation and execution DBIS: Beyond RDBMS

  11. OR Mapping Frameworks DBIS: Beyond RDBMS

  12. RDBMS advantages • There are advantages in using a Relational Database Management System • The relational database has a strong theoretical foundation which supported the development of SQL • Simple • Suitable for Online Transaction Processing, which is used by many business applications • Supports data independence DBIS: Beyond RDBMS

  13. Advanced Database Applications • Many advanced database applications are unsuitable for the relational model • Computer-Aided Design/Manufacturing (CAD/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. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  14. RDBMS Limitations • Impedance Mismatch (discussed) • Entity may be fragmented into many relations, needing joins (which is costly) during query processing • Semantic overloading • Only one construct (the relation) for modelling relations AND relationships • Poor at navigational access from record to record • Good for access by specifying criteria • Not enough support for integrity and business constraints • Referential integrity not always supported • Business constraints may need specifying within DBMS or application DBIS: Beyond RDBMS

  15. RDBMS Limitations continued • Homogeneous data structure • All rows must contain the same columns • All columns must come from same domain • Values must be atomic • Now some RDBMS permit Binary Large Objects (BLOBs), suitable for multimedia or other unstructured object • Limited operations • SQL does not permit new business-specific operations • E.g. intersection of lines, mathematical formulae • SQL cannot perform recursive queries • Not designed for long transactions – 2-phase locking is unsuitable • Difficult to alter the schema DBIS: Beyond RDBMS

  16. Example of complex data structure : Bill of Material Cake BasePart Icing Mixture Water Sugar Eggs Fruit ConsistsOf CompositePart Complex data structures can be more easily represented in OOPL (graph) © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  17. Persistence through Object Serialization • Simple persistence method which provides a program the ability to read or write a whole object to and from a stream of bytes • Allows Java objects to be encoded into a byte stream suitable for streaming to a file on disk or over a network. The bytes can be rebuilt into a live object in the future. • The class must implement the Serializable interface (java.io.Serializable) • Simple, but does not support DBMS features such as multi-users, partial retrieval, transactions, recovery etc DBIS: Beyond RDBMS

  18. Persistence through Object Serialization DBIS: Beyond RDBMS

  19. Using Databases • There are essentially three approaches which have been developed for the management of object storage in databases: • the Object-Oriented Database Management System (OODBMS) • Extend OO programming language with persistence • the Object-Relational Database Management System (ORDBMS) • Extend relational system with object features • Object Relational Mapping • Already discussed DBIS: Beyond RDBMS

  20. Object Oriented Database Management Systems OODBMS http://service-architecture.com/object-oriented-databases/articles/index.html http://www.odbms.org/downloads.html DBIS: Beyond RDBMS

  21. Object Data Model DBIS: Beyond RDBMS

  22. OODBMS Manifesto • To establish agreement on what an OODBMS is, (Atkinson et al. 1990) propose the following 13 rules: • Object characteristics • Complex objects must be supported. • Object identity must be supported.. • Encapsulation must be supported.. • Types and classes must be supported. • Types and classes must be able to inherit from their ancestors. • Dynamic binding must be supported • The DML must be computationally complete. • The set of data types must be extensible. DBIS: Beyond RDBMS

  23. OODBMS Manifesto contd • DBMS characteristics • Data persistence must be provided • The DBMS must be capable of managing very large databases • The DBMS must accept concurrent users. • The DBMS must be capable of recovery from hardware and software failures. • The DBMS must provide a simple way of querying data. DBIS: Beyond RDBMS

  24. The ODMG Proposed Standard • One of the crucial factors in the commercial success of RDBMSs is the relative standardisation of the data model • The Object Data Management Group (ODMG) was formed by a group of industry representatives to define a proposed standard for the object data model. • It includes an Object Definition Language (ODL) and Object Query Language (OQL) • It is still far from being as widely recognised as the relational database standards. DBIS: Beyond RDBMS

  25. Object Identity • In an OODb, an object is identified by an object identifier (oid), and objects are related by storing the oid of one object in another. • The crucial distinction between oids and addresses is that an oid is not related to the object’s physical location, whereas an address is. • The object’s physical location changes between main memory and the database, managed by the DBMS • The object identifier is not visible to the user or database programmer DBIS: Beyond RDBMS

  26. Using an OODBMS • The programmer defines the persistent data • Subsequently, they do not have to know about • Format of data storage • Transfer of persistant data between main memory and database • This happens transparently and is managed by the OODBMS • The programmer can start and commit transactions DBIS: Beyond RDBMS

  27. Advantages of OODBMSs • Enriched Modelling 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. DBIS: Beyond RDBMS

  28. 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. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  29. When to use • In general, RDBMSs are probably more suitable for databases with a variety of query and user interface requirements • i.e. most mainstream business applications • OODBMSs are appropriate for applications with complex, irregular data, where data access will follow predictable patterns • e.g CAD/CAM systems, manufacturing databases DBIS: Beyond RDBMS

  30. OODBMS Users • The Chicago Stock Exchange - managing stock trades • CERN in Switzerland - large scientific data sets • Radio Computing Services – automating radio stations (library, newsroom, etc) • Adidas – content for web site and CD-ROM catalogue • Federal Aviation Authority – passenger and baggage traffic simulation • Electricite de France – managing overhead power lines DBIS: Beyond RDBMS

  31. Object Relational Database Management Systems ORDBMS DBIS: Beyond RDBMS

  32. Market Share • RDBMSs currently dominant database technology with estimated sales $6 - $10 billion per year ($25 billion with tools sales included). • OODBMS market still small, but still finds new applications areas. • Some analysts expect OODBMS market to grow at a faster rate than total database market, but unlikely to overtake relational systems. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  33. ORDBMSs • Vendors of RDBMSs conscious of threat and promise of OODBMS. • Agree that RDBMSs not currently suited to advanced database applications, and added functionality is required. • Reject claim that extended RDBMSs will not provide sufficient functionality or will be too slow to cope adequately with new complexity. • Can remedy shortcomings of relational model by extending model with OO features. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  34. ORDBMSs - Features • OO features being added include: • user-extensible types • encapsulation • inheritance • polymorphism • dynamic binding of methods • complex objects including non-1NF objects • object identity © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  35. ORDBMSs - Features • However, there is no single extended relational model • All models: • share basic relational tables and query language • all have some concept of ‘object’ • some can store methods (or procedures or triggers) • Some analysts predict ORDBMS will have 50% larger share of market than RDBMS. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  36. The Object Relational Model DBIS: Beyond RDBMS

  37. SQL:2003 - New OO Features • Type constructors for row types and reference types • User-defined types (distinct types and structured types) that can participate in supertype/subtype relationships • User-defined procedures, functions, methods, and operators • Type constructors for collection types (arrays, sets, lists, and multisets) • Support for large objects – BLOBs and CLOBs • Recursion © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  38. ORDB Example - Oracle User defined type CREATE TYPE Name AS OBJECT ( first_name CHAR (15), last_name CHAR (15), middle_initial CHAR (1); MEMBER PROCEDURE initialize,; Code to define operations – here simply a class constructor CREATE TYPE BODY Name AS MEMBER PROCEDURE initialize IS BEGIN first_name := NULL; last_name := NULL; middle_initial := NULL; END initialize; END; DBIS: Beyond RDBMS

  39. ORDB Example contd - Oracle Using the new type in a table CREATE TABLE person( person_ID NUMBER; person_name Name, PRIMARY KEY (person_ID)); DBIS: Beyond RDBMS

  40. Stonebraker’s View © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  41. Advantages of ORDBMSs • Resolves many of known weaknesses of RDBMS • Reuse and sharing: • reuse comes from ability to extend server to perform standard functionality centrally; • gives rise to increased productivity both for developer and end-user. • Preserves significant body of knowledge and experience gone into developing relational applications. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  42. Disadvantages of ORDBMSs • Complexity • Increased costs • Proponents of relational approach believe simplicity and purity of relational model are lost • Some believe RDBMS is being extended for what will be a minority of applications • OO purists not attracted by extensions either • SQL now extremely complex. © Pearson Education Limited 1995, 2005 DBIS: Beyond RDBMS

  43. Data modelling comparison ORDBMS/OODBMS DBIS: Beyond RDBMS

  44. Data sharing comparison ORDBMS/OODBMS DBIS: Beyond RDBMS

  45. DBIS: Beyond RDBMS

  46. Summary • Relational databases are widely established • An application needs programming capability as well as just a relational database • There is an impedance mismatch between the objects in an object-oriented program and relations in the database • OR Mapping frameworks handle the mapping from object to relation • Object-oriented databases occupy a niche in the market. The data in the application persists from one run to the next. • Many relational databases now have been extended to support OOP concepts DBIS: Beyond RDBMS

More Related