1 / 45

Object-Oriented Database Development (Hoffer Chap 15)

Object-Oriented Database Development (Hoffer Chap 15). University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management. Lecture Outline. Review Object Oriented DBMS Inverted File and Flat File DBMS Object-Relational DBMS (revisited)

goldy
Download Presentation

Object-Oriented Database Development (Hoffer Chap 15)

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. Object-Oriented Database Development (Hoffer Chap 15) University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management

  2. Lecture Outline • Review • Object Oriented DBMS • Inverted File and Flat File DBMS • Object-Relational DBMS (revisited) • Intelligent DBMS • Object Oriented Database Development • Design using UML • Construction with ODL • Querying with OQL

  3. Lecture Outline • Review • Object Oriented DBMS • Inverted File and Flat File DBMS • Object-Relational DBMS (revisited) • Intelligent DBMS • Object Oriented Database Development • Design using UML • Construction with ODL • Querying with OQL

  4. Object-Oriented DBMS Basic Concepts • Each real-world entity is modeled by an object. Each object is associated with a unique identifier (sometimes call the object ID or OID)

  5. Object-Oriented DBMS Basic Concepts • Each object has a set of instance attributes (or instance variables) and methods. • The value of an attribute can be an object or set of objects. Thus complex object can be constructed from aggregations of other objects. • The set of attributes of the object and the set of methods represent the object structure and behavior, respectively

  6. Object-Oriented DBMS Basic Concepts • The attribute values of an object represent the object’s status. • Status is accessed or modified by sending messages to the object to invoke the corresponding methods

  7. Object-Oriented DBMS Basic Concepts • Objects sharing the same structure and behavior are grouped into classes. • A class represents a template for a set of similar objects. • Each object is an instance of some class.

  8. Object-Oriented DBMS Basic Concepts • A class can be defined as a specialization of of one or more classes. • A class defined as a specialization is called a subclass and inherits attributes and methods from its superclass(es).

  9. Object-Oriented DBMS Basic Concepts • An OODBMS is a DBMS that directly supports a model based on the object-oriented paradigm. • Like any DBMS it must provide persistent storage for objects and their descriptions (schema). • The system must also provide a language for schema definition and and for manipulation of objects and their schema • It will usually include a query language, indexing capabilities, etc.

  10. Generalization Hierarchy employee Employee No Name Address Date hired Date of Birth calculateAge Hourly Salaried consultant Hourly Rate Annual Salary Stock Option Contract No. Date Hired calculateWage calculateStockBenefit AllocateToContract

  11. Inverted File DBMS • Usually similar to Hierarchic DBMS in record structure • Support for repeating groups of fields and multiple value fields • All access is via inverted file indexes to DBS specified fields. • Examples: ADABAS DBMS from Software AG -- used in the MELVYL system

  12. Flat File DBMS • Data is stored as a simple file of records. • Records usually have a simple structure • May support indexing of fields in the records. • May also support scanning of the data • No mechanisms for relating data between files. • Usually easy to use and simple to set up

  13. Object Relational Data Model • Class, instance, attribute, method, and integrity constraints • OID per instance • Encapsulation • Multiple inheritance hierarchy of classes • Class references via OID object references • Set-Valued attributes • Abstract Data Types

  14. PostgreSQL Classes • The fundamental notion in Postgres is that of a class, which is a named collection of object instances. Each instance has the same collection of named attributes, and each attribute is of a specific type. Furthermore, each instance has a permanent object identifier (OID) that is unique throughout the installation. Because SQL syntax refers to tables, we will use the terms table and class interchangeably. Likewise, an SQL row is an instance and SQL columns are attributes.

  15. Creating a Class • You can create a new class by specifying the class name, along with all attribute names and their types: CREATE TABLE weather ( city varchar(80), temp_lo int, -- low temperature temp_hi int, -- high temperature prcp real, -- precipitation date date );

  16. Intelligent Database Systems • Intelligent DBS are intended to handle more than just data, and may be used in tasks involving large amounts of information where analysis and “discovery” are needed. The following is based on “Intelligent Databases” by Kamran Parsaye, Mark Chignell, Setrag Khoshafian and Harry Wong AI Expert, March 1990, v. 5 no. 3. Pp 38-47

  17. Intelligent Database Systems • They represent the evolution and merging of several technologies: • Automatic Information Discovery • Hypermedia • Object Orientation • Expert Systems • Conventional DBMS

  18. Intelligent Database Systems Automatic discovery Expert Systems Intelligent Databases Hypermedia Object Orientation Traditional Databases

  19. Intelligent Databases • Intelligent Database Engine • OO support • Inference features • Global optimization • Rule manager • Explanation manager • Transaction manager • Metadata manager • Access module • Multimedia manager

  20. Lecture Outline • Review • Object Oriented DBMS • Inverted File and Flat File DBMS • Object-Relational DBMS (revisited) • Intelligent DBMS • Object Oriented Database Development • Construction with ODL • Design using UML • Querying with OQL

  21. Chapter 15:Object-Oriented Database Development Modern Database Management 6th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden This Lecture uses the slides following from www.prenhall.com/hoffer

  22. Object Definition Language (ODL) • Corresponds to SQL’s DDL (Data Definition Language) • Specify the logical schema for an object-oriented database • Based on the specifications of Object Database Management Group (ODMG)

  23. Defining a Class • class – keyword for defining classes • attribute – keyword for attributes • operations – return type, name, parameters in parentheses • relationship – keyword for establishing relationship

  24. Defining an Attribute • Value can be either: • Object identifier OR Literal • Types of literals • Atomic – a constant that cannot be decomposed into components • Collection – multiple literals or object types • Structure – a fixed number of named elements, each of which could be a literal or object type • Attribute ranges • Allowable values for an attribute • enum – for enumerating the allowable values

  25. Kinds of Collections • Set – unordered collection without duplicates • Bag – unordered collection that may contain duplicates • List – ordered collection, all the same type • Array – dynamically sized ordered collection, locatable by position • Dictionary – unordered sequence of key-value pairs without duplicates

  26. Defining Structures Structure = user-defined type with components struct keyword Example: struct Address { String street_address String city; String state; String zip; };

  27. Defining Operations • Return type • Name • Parentheses following the name • Arguments within the parentheses

  28. Defining Relationships • Only unary and binary relationships allowed • Relationships are bi-directional • implemented through use of inverse keyword • ODL relationships are specified: • relationship indicates that class is on many-side • relationship set indicates that class is on one-side and other class (many) instances unordered • relationship list indicates that class is on one-side and other class (many) instances ordered

  29. Figure 15-1 –UML class diagram for a university database The following slides illustrate the ODL implementation of this UML diagram

  30. Figure 15-2 –ODL Schema for university database

  31. Figure 15-2 –ODL Schema for university database class keywordbegins the class definition.Class components enclosed between { and }

  32. attribute has a data type and a name Figure 15-2 – ODL Schema for university database specify allowable values using enum

  33. Figure 15-2 –ODL Schema for university database extent = the set of all instances of the class

  34. Figure 15-2 –ODL Schema for university database Operation definition: return type, name, and argument list. Arguments include data types and names

  35. relationship sets indicate 1:N relationship to an unordered collection of instances of the other class inverse establishes the bidirectionality of the relationship Figure 15-2 –ODL Schema for university database

  36. relationship list indicates 1:N relationship to an ordered collection of instances of the other class Figure 15-2 –ODL Schema for university database

  37. relationship indicates N:1 relationship to an instance of the other class Figure 15-2 –ODL Schema for university database

  38. Figure 15-3 – UML class diagram for an employee project database (a) Many-to-many relationship with an association class Note: In order to capture special features of assignment, this should be converted into two 1:N relationships

  39. Figure 15-3 – UML class diagram for an employee project database (b) Many-to many relationship broken into two one-to-many relationships class Employee { (extent employees key emp_id) …………. attribute set (string) skills_required; }; Note: key indicates indentifier (candidate key) Note: attribute set indicates a multivalued attribute

  40. Figure 15-4 UML class diagram showing employee generalization class Employee extends Employee{ ( …………. …………. } Note: extends denotes subclassing

  41. Note: abstract class denotes non-instantiable (complete constraint) abstract class Student extends Employee{ ( …………. abstract float calc_tuition(); } Note: abstract operationdenotes no method (no implementation) of calc_tuition at the Student level Figure 15-5 –UML class diagram showing student generalization

  42. Creating Object Instances • Specify a tag that will be the object identifier • MBA699 course (); • Initializing attributes: • Cheryl student (name: “Cheryl Davis”, dateOfBirth:4/5/77); • Initializing multivalued attributes: • Dan employee (emp_id: 3678, name: “Dan Bellon”, skills {“Database design”, “OO Modeling”}); • Establishing links for relationship • Cheryl student (takes: {OOAD99F, Telecom99F, Java99F});

  43. Querying Objects in the OODB • Object Query Language (OQL) • ODMG standard language • Similar to SQL-92 • Some differences: • Joins use class’s relationship name: • Select x.enrollment from courseofferings x, x.belongs_to y where y.crse_course = “MBA 664” and x.section = 1; • Using a set in a query • Select emp_id, name from employees where “Database Design” in skills;

  44. Current ODBMS Products • Rising popularity due to: • CAD/CAM applications • Geographic information systems • Multimedia • Web-based applications • Increasingly complex data types • Applications of ODBMS • Bill-of-material • Telecommunications navigation • Health care • Engineering design • Finance and trading

  45. Table15-1 – ODBMS Products

More Related