1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

21
1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs

Transcript of 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

Page 1: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

1

CS 430Database Theory

Winter 2005

Lecture 17: Objects, XML, and DBMSs

Page 2: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

2

Topics

Object-Oriented DBMS (ODBMS) Object-Relational DBMS (ORDBMS) XML and Databases

Page 3: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

3

Object-Oriented DBMS

Motivation: Deal with shortcomings of traditional RDBMS for applications with complex data. E.g.: CAD (Computer Aided Design) Experiment Data GIS (Geographic Information System) Multi-Media

Page 4: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

4

Object-Oriented DBMS

Additional Motivation: Tight Integration with O-O Programming Languages Avoid the “Impedance Mismatch” Example: Write a C++ program. Fetch and Update

data in DBMS in response to program actions on corresponding objects in memory “Swizzling” pointers: Map between pointers in memory

and pointers in database

Page 5: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

5

ODBMS Features

Object Identifiers (OIDs) Provide globally unique identifiers, immutable across all

objects Class Inheritance Object operations or methods Direct representation of relations and collections

Include specific collection types Versioning in the database

E.g. versions of parts of a design

Page 6: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

6

ODBMS Standards

Object Data Management Group (ODMG) standard

Includes: Object Definition Language (ODL) Object Query Language (OQL) C++ Language Binding

Page 7: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

7

ODBMS Issues

Ad Hoc Query May have to write program to navigate database

to find desired data Does encapsulation block ad hoc operation?

Views? Integrity

Generally enforced by methods that update the database

No declarative description of integrity constraints

Page 8: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

8

ODBMS Summary

“The Object-Oriented Database System Manifesto” “This paper attempts to define an object-oriented

database system. It describes the main features and characteristics that a system must have to qualify as an object-oriented database system.”

http://www-2.cs.cmu.edu/People/clamen/OODBMS/Manifesto/htManifesto/Manifesto.html

Page 9: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

9

ODBMS Summary (continued) ODBMS is good for providing persistent

storage for an individual application ODBMSs have lost battle for shared data

storage Textbook: Last ODBMS reference is 1997, most

are 1986-1993 (Textbook copyright is 2004). If necessary, mapping ER Model to ODBMS

Model is straight forward

Page 10: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

10

Object/Relational DBMS (ORDBMS)Michael Stonebreaker: Taxonomy of DBMSs

RDBMS ORDBMS

File System

ODBMS

Query

Complex

Simple

DataComplexSimple

Page 11: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

11

Object/Relational Concept

Provide alternative to ODBMS for complex data Extend RDBMS approach

“Third Generation Database Manifesto” Written in response to OODB Manifesto http://portal.acm.org/citation.cfm?id=390001

Page 12: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

12

SQL-99 Support for ORDBMS Row Types, Array Types Object Identity Mechanisms

Includes a REF (Reference) Type Inheritance (Sub/Super Tables) Methods and Encapsulation Application Packages

Standardized packages of extensions for new kinds of data

SQL/MM (Multi-Media)

Page 13: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

13

Some Implementations

Informix Universal Server Extension of Stonebreaker’s Postgres work at

U.C. Berkeley Uses “Data Blades” to support complex data

types Oracle Data Cartridges IBM Relational Extenders All provide add-in extensions to base

RDBMS capabilities

Page 14: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

14

Extension Implementation

Add new operations and/or syntax to Query Language Integration with Query Language Parser

Integrate into Query Optimizer Rewrite rules: E.g. NOT( X <= 20 ) is equivalent to

(X > 20) Provide necessary costing formulas

Specialized storage and index structures E.g. Quad-Trees for 2d data

Page 15: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

15

Extension Issues

Mechanisms for linking extensions into base DBMS Java Virtual Machine “Sandbox” is attractive

Where are methods executed in a client/server environment Server: Uses shared resource Client: May require extra data movement

External functions (called from Queries) executing queries in database

Page 16: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

16

Chris Date’s “Two Great Blunders”An Alternative View on ORDBMS Blunder One: Rows are not Objects

However, Values are Objects (Domains are Classes)

Blunder Two: Mixing pointers (e.g. References) and Relations

However, this is a criticism of the direction of SQL-99 extensions to RDBMS Not a call for ODBMS or something else

Page 17: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

17

Object-Relational Summary

This appears to be the future direction for the DBMS community

SQL-99 adopted many of these concepts Next version will continue to grow these concepts

Not clear (at least to me) exactly how the Microsoft NewFS will relate to these concepts

Page 18: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

18

XML and Database

XML is coming to dominate worlds of data exchange and document formatting

How do you integrate XML in to your data bases?

Page 19: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

19

DB Relevant XML Standards

XML Schema Provide better description of XML documents than

basic XML DTDs XPath

Standard way to describe nodes in XML documents

XQuery Standard Query Language for XML documents

Page 20: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

20

Three Approaches to Putting XML into a Database One: Store XML document as a text BLOB Two: “XML Column”

Provide an XML object class for database values An ORDBMS extension

Good for storing complete already existing documents

Good for archives (e.g. legal record) Problematic when operating on or updating parts

of documents (as opposed to whole document)

Page 21: 1 CS 430 Database Theory Winter 2005 Lecture 17: Objects, XML, and DBMSs.

21

Three Approaches to Putting XML into a Database Three: “Shred and Publish” or “XML Collection”

Shred XML document content into a standard Relational Database

Publish query results as XML documents Only works when

Documents conform strictly to DTDs or Schemas There is no requirement to keep original document intact (e.g.

store tags) Good when parts of document are queried and updated Issue: Mapping of Relations in database (a network) in

XML tag structure (a hierarchy)