Download presentation
Presentation is loading. Please wait.
1
© 2007 by Prentice Hall 1 Chapter 15 (Web): Object-Oriented Database Development Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden
2
Chapter 15-Web © 2007 by Prentice Hall 2 Objectives Definition of terms Definition of terms Create object-oriented database schemas in ODL Create object-oriented database schemas in ODL Transform UML class diagrams to ODL schemas Transform UML class diagrams to ODL schemas Identify type specifications for attributes, arguments, and operation return values Identify type specifications for attributes, arguments, and operation return values Create objects and specify their attribute values Create objects and specify their attribute values Understand object-oriented database implementation steps Understand object-oriented database implementation steps Understand OQL syntax and semantics Understand OQL syntax and semantics Use OQL to formulate queries Use OQL to formulate queries Understand object-oriented database applications Understand object-oriented database applications
3
Chapter 15-Web © 2007 by Prentice Hall 3 Object Definition Language (ODL) Corresponds to SQL’s DDL (Data Definition Language) Corresponds to SQL’s DDL (Data Definition Language) Specify the logical schema for an object- oriented database Specify the logical schema for an object- oriented database Based on the specifications of Object Database Management Group (ODMG) Based on the specifications of Object Database Management Group (ODMG)
4
Chapter 15-Web © 2007 by Prentice Hall 4 Defining a Class class–keyword for defining classes class–keyword for defining classes attribute– keyword for attributes attribute– keyword for attributes operations– return type, name, parameters in parentheses operations– return type, name, parameters in parentheses relationship– keyword for establishing relationship relationship– keyword for establishing relationship See page 558
5
Chapter 15-Web © 2007 by Prentice Hall 5 Defining an Attribute Value can be either: Value can be either: Object identifier OR Literal Object identifier OR Literal Types of literals Types of literals Atomic–a constant that cannot be decomposed into components Atomic–a constant that cannot be decomposed into components Collection–multiple literals or object types Collection–multiple literals or object types Structured–a fixed number of named elements, each of which could be a literal or object type Structured–a fixed number of named elements, each of which could be a literal or object type Attribute ranges Attribute ranges Allowable values for an attribute Allowable values for an attribute enum–for enumerating the allowable values enum–for enumerating the allowable values
6
Chapter 15-Web © 2007 by Prentice Hall 6 Kinds of Collections Set–unordered collection without duplicates Set–unordered collection without duplicates Bag–unordered collection that may contain duplicates Bag–unordered collection that may contain duplicates List–ordered collection, all the same type List–ordered collection, all the same type Array–dynamically sized ordered collection, locatable by position Array–dynamically sized ordered collection, locatable by position Dictionary– unordered sequence of key-value pairs without duplicates Dictionary– unordered sequence of key-value pairs without duplicates
7
Chapter 15-Web © 2007 by Prentice Hall 7 Defining Structures Structure = user-defined type with components struct keyword Example: struct Address { String street_address; String city; String state; String zip; };
8
Chapter 15-Web © 2007 by Prentice Hall 8 Defining Operations Return type Return type Name Name Parentheses following the name Parentheses following the name Arguments within the parentheses Arguments within the parentheses
9
Chapter 15-Web © 2007 by Prentice Hall 9 Defining Relationships Only unary and binary relationships allowed Only unary and binary relationships allowed Relationships are bidirectional Relationships are bidirectional implemented through use of inverse keyword implemented through use of inverse keyword ODL relationships are specified: ODL relationships are specified: relationship indicates that class is on many-side relationship indicates that class is on many-side relationship set indicates that class is on one-side and other class (many) instances unordered 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 relationship list indicates that class is on one-side and other class (many) instances ordered
10
Chapter 15-Web © 2007 by Prentice Hall 10 ODL Schema for Representing Generalization The extends keyword is used to represent generalization
11
Chapter 15-Web © 2007 by Prentice Hall 11 Creating Object Instances Specify a tag that will be the object identifier Specify a tag that will be the object identifier MBA699 course (); MBA699 course (); Initializing attributes: Initializing attributes: Cheryl student (name: “Cheryl Davis”, dateOfBirth:4/5/77); Cheryl student (name: “Cheryl Davis”, dateOfBirth:4/5/77); Initializing multivalued attributes: Initializing multivalued attributes: Dan employee (emp_id: 3678, name: “Dan Bellon”, skills {“Database design”, “OO Modeling”}); Dan employee (emp_id: 3678, name: “Dan Bellon”, skills {“Database design”, “OO Modeling”}); Establishing links for relationship Establishing links for relationship Cheryl student (takes: {OOAD99F, Telecom99F, Java99F}); Cheryl student (takes: {OOAD99F, Telecom99F, Java99F});
12
Chapter 15-Web © 2007 by Prentice Hall 12 Querying Objects in the OODB Object Query Language (OQL) Object Query Language (OQL) ODMG standard language ODMG standard language Similar to SQL Similar to SQL Some differences: Some differences: Joins use class’s relationship name: 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; 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 Using a set in a query Select emp_id, name from employees where “Database Design” in skills; Select emp_id, name from employees where “Database Design” in skills;
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.