Presentation is loading. Please wait.

Presentation is loading. Please wait.

2004.04.22 - SLIDE 1IS 257 – Spring 2004 Object-Oriented Database Development (Hoffer Chap 15) University of California, Berkeley School of Information.

Similar presentations


Presentation on theme: "2004.04.22 - SLIDE 1IS 257 – Spring 2004 Object-Oriented Database Development (Hoffer Chap 15) University of California, Berkeley School of Information."— Presentation transcript:

1 2004.04.22 - SLIDE 1IS 257 – Spring 2004 Object-Oriented Database Development (Hoffer Chap 15) University of California, Berkeley School of Information Management and Systems SIMS 257: Database Management

2 2004.04.22 - SLIDE 2IS 257 – Spring 2004 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 2004.04.22 - SLIDE 3IS 257 – Spring 2004 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 2004.04.22 - SLIDE 4IS 257 – Spring 2004 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 2004.04.22 - SLIDE 5IS 257 – Spring 2004 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 2004.04.22 - SLIDE 6IS 257 – Spring 2004 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 2004.04.22 - SLIDE 7IS 257 – Spring 2004 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 2004.04.22 - SLIDE 8IS 257 – Spring 2004 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 2004.04.22 - SLIDE 9IS 257 – Spring 2004 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 2004.04.22 - SLIDE 10IS 257 – Spring 2004 Generalization Hierarchy Employee No Name Address Date hired Date of Birth employee Contract No. Date Hired consultant Annual Salary Stock Option Salaried Hourly Rate Hourly calculateAge AllocateToContractcalculateStockBenefit calculateWage

11 2004.04.22 - SLIDE 11IS 257 – Spring 2004 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 2004.04.22 - SLIDE 12IS 257 – Spring 2004 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 2004.04.22 - SLIDE 13IS 257 – Spring 2004 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 2004.04.22 - SLIDE 14IS 257 – Spring 2004 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 2004.04.22 - SLIDE 15IS 257 – Spring 2004 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 2004.04.22 - SLIDE 16IS 257 – Spring 2004 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 2004.04.22 - SLIDE 17IS 257 – Spring 2004 Intelligent Database Systems They represent the evolution and merging of several technologies: –Automatic Information Discovery –Hypermedia –Object Orientation –Expert Systems –Conventional DBMS

18 2004.04.22 - SLIDE 18IS 257 – Spring 2004 Intelligent Database Systems Intelligent Databases Expert Systems Traditional Databases Hypermedia Automatic discovery Object Orientation

19 2004.04.22 - SLIDE 19IS 257 – Spring 2004 Intelligent Databases Intelligent Database Engine –OO support –Inference features –Global optimization –Rule manager –Explanation manager –Transaction manager –Metadata manager –Access module –Multimedia manager

20 2004.04.22 - SLIDE 20IS 257 – Spring 2004 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 2004.04.22 - SLIDE 21IS 257 – Spring 2004 Chapter 15: Object-Oriented Database Development Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden This Lecture uses the slides following from www.prenhall.com/hoffer

22 2004.04.22 - SLIDE 22IS 257 – Spring 2004 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 2004.04.22 - SLIDE 23IS 257 – Spring 2004 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 2004.04.22 - SLIDE 24IS 257 – Spring 2004 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 2004.04.22 - SLIDE 25IS 257 – Spring 2004 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 2004.04.22 - SLIDE 26IS 257 – Spring 2004 Defining Structures Structure = user-defined type with components struct struct keyword Example: struct Address { String street_address String city; String state; String zip; };

27 2004.04.22 - SLIDE 27IS 257 – Spring 2004 Defining Operations Return type Name Parentheses following the name Arguments within the parentheses

28 2004.04.22 - SLIDE 28IS 257 – Spring 2004 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 2004.04.22 - SLIDE 29IS 257 – Spring 2004 Figure 15-1 –UML class diagram for a university database The following slides illustrate the ODL implementation of this UML diagram

30 2004.04.22 - SLIDE 30IS 257 – Spring 2004 Figure 15-2 –ODL Schema for university database

31 2004.04.22 - SLIDE 31IS 257 – Spring 2004 Figure 15-2 –ODL Schema for university database class keyword begins the class definition.Class components enclosed between { and }

32 2004.04.22 - SLIDE 32IS 257 – Spring 2004 Figure 15-2 – ODL Schema for university database attribute has a data type and a name specify allowable values using enum

33 2004.04.22 - SLIDE 33IS 257 – Spring 2004 Figure 15-2 –ODL Schema for university database extent = the set of all instances of the class

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

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

36 2004.04.22 - SLIDE 36IS 257 – Spring 2004 Figure 15-2 –ODL Schema for university database relationship list indicates 1:N relationship to an ordered collection of instances of the other class

37 2004.04.22 - SLIDE 37IS 257 – Spring 2004 Figure 15-2 –ODL Schema for university database relationship indicates N:1 relationship to an instance of the other class

38 2004.04.22 - SLIDE 38IS 257 – Spring 2004 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 2004.04.22 - SLIDE 39IS 257 – Spring 2004 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 2004.04.22 - SLIDE 40IS 257 – Spring 2004 Figure 15-4 UML class diagram showing employee generalization class Employee extends Employee{ ( …………. …………. } Note: extends denotes subclassing

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

42 2004.04.22 - SLIDE 42IS 257 – Spring 2004 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 2004.04.22 - SLIDE 43IS 257 – Spring 2004 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 2004.04.22 - SLIDE 44IS 257 – Spring 2004 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 2004.04.22 - SLIDE 45IS 257 – Spring 2004 Table15-1 – ODBMS Products


Download ppt "2004.04.22 - SLIDE 1IS 257 – Spring 2004 Object-Oriented Database Development (Hoffer Chap 15) University of California, Berkeley School of Information."

Similar presentations


Ads by Google