Cơ sở dữ liệu - Chapter 18: Object database management systems
Objects can be accessed only through their interfaces.
Classes can be reused rather than just individual procedures.
More complex classes can be defined using simpler classes.
Provides a form of data independence.
61 trang |
Chia sẻ: huyhoang44 | Lượt xem: 624 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Cơ sở dữ liệu - Chapter 18: Object database management systems, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Chapter 18Object Database Management Systems OutlineMotivation for object database management Object-oriented principles Architectures for object database management Object database definition and manipulation in SQL:2003Object database definition and manipulation in Oracle 10gMotivation: Complex DataMost relational DBMSs support only a few data types. Many business applications require large amounts of complex data such as images, audio, and video. Integration of complex data with simple data drives the demand for object database technologyMotivation: Type System MismatchIncreasing use of database access in procedural codeDifferent data types used in programming languages versus DBMSsData type mismatch makes software more difficult to develop. A relational DBMS cannot perform elementary operations on complex data. Application Examples Dental Office Support Real Estate Listing Service Auto Insurance Claims Object-Oriented PrinciplesAn object is a combination of data and procedures. A class is a prototype that defines the variables and methods common to all objects of the class.Three underlying principles: encapsulation, inheritance and polymorphism.Encapsulation Objects can be accessed only through their interfaces. Classes can be reused rather than just individual procedures. More complex classes can be defined using simpler classes.Provides a form of data independence. Bond Class Example CLASS Bond {// VARIABLES: ATTRIBUTE Float IntRate; ATTRIBUTE Date Maturity;// METHODS: Float Yield();// Computes the Bond’s Yield };Inheritance Sharing of data and code among similar classes (classes and subclasses). Inherit variables and methods from parent classesUse methods and variables of ancestor classesProvides an improved organization of software and incremental reusability. Inheritance Examples Multiple Inheritance Example Polymorphism Ability to choose among multiple implementations BenefitsIncremental modification of codeSmaller vocabulary of method namesRequesting a method execution involves sending a message to an objectClient-server processing and object-oriented computing are closely related. Processing a Message BindingAssociating an implementation with a messageStatic bindingPerformed at compile-timeMore efficient but less flexibleDynamic bindingPerformed at run-time (late binding)More flexible but less efficientStrong Type CheckingComplex expressions can involve many methods and objectsIncompatibility errors common in codeAbility to ensure that programming code contains no incompatibility errors An important kind of error checking for object-oriented codingProgramming Languages versus DBMSs Programming languages have used object-oriented principles for many years.Programming languages emphasize software maintenance and code reusability.Object DBMSs are more recent.Relax encapsulation to reference an object’s data in a query. Simpler inheritance mechanisms in DBMSsObject Database Architectures Adding object-oriented features to a DBMS is a good ideaMany approaches about the features to add and how features should be added. Some approaches provide small extensions that leave object features outside the DBMS.Other approaches involve a complete rewrite of the DBMS to accommodate objectsMarketplace will determine best approachesLarge Objects and External Software Large object storage along with external software to manipulate large objectsBLOB and CLOB data typesThe large object approach is simple to implement and universal. The large object approach suffers from serious performance drawbacks. Large Object Architecture Specialized Media Servers Dedicated server manages complex dataApplication programming interface (API) to access complex data. Good performance for specific kinds of complex dataLimited range of operations supported Poor performance when combining simple and complex dataSpecialized Media Server Architecture Object database middleware Middleware to manage complex data stored outside of a database along with traditional data stored in a database Integrate complex data stored on PCs and remote servers with relational databases Possible performance problems because of a lack of integration with a DBMS. Object Middleware Approach Object-Relational DBMSA relational DBMS extended with an object query processor for user-defined data types User-defined types for complex dataUser-defined functions in SQL statementsSQL:2003 standardGood integration of complex data with reliability of relational DBMSComponent Architecture for Object Relational DBMSs Typical User-Defined TypesAudio VideoTextImageSpatialTime seriesXMLOther Object FeaturesSubtable families Reference and row data typesNested tablesObject-Oriented DBMS A new kind of DBMS designed especially for objects. Object-oriented DBMSs have an object query processor and an object kernel.The Object Data Management Group (ODMG) provides the standard for object-oriented DBMSs.Component Architecture for Object-Oriented DBMSs Summary of Architectures Market niche for each architecture Simpler architectures less popular over timeObject database middleware coexist with other approachesObject-relational approach dominates object-oriented approachSQL:2003 Object FeaturesVery large standardCore language partParts and packages for non core featuresDetails about basic and enhanced object supportTwo levels of conformanceSQL:2003 PartsCore parts (1,2,11): framework, foundation, schemasNon core partsCall level interfacePersistent stored modulesManagement of external dataObject level bindingsXML specificationsSQL:2003 PackagesEnhanced data-time facilitiesEnhanced integrity managementBasic object supportEnhanced object supportActive databasesOLAP facilitiesUser-Defined Types Bundles data and proceduresSupport definition of structured types, not just extensions of standard typesUse as data types for columns in tables, passed as parameters, and returned as values User-defined functions can be used in expressions in the SELECT, the WHERE, and the HAVING clauses. User-Defined Type Example Explicit MethodsReturn single values and use input parametersImplicit first parameter: part of user-defined typeCREATE METHOD statement for method bodyMutation methods: change valuesProcedures and functions not associated with typesImplicit MethodsAutomatically exist for all user-defined typesConstructor method: creates an empty instanceObserver methods: retrieve valuesMutation methods: change valuesUser-Defined Type Usingan Array Example 2: Triangle type using an ARRAYCREATE TYPE Triangle AS( Corners Point ARRAY[3], Color INTEGER ) METHOD Area() RETURNS FLOAT, -- Computes the area METHOD Scale (Factor FLOAT) RETURNS Triangle -- Computes a new triangle scaled by factorNOT FINAL;User-Defined Type Using a Multiset Example 3: Polygon type using an ARRAYCREATE TYPE Triangle AS( Corners Point MULTISET, Color INTEGER ) METHOD Area() RETURNS FLOAT, -- Computes the area METHOD Scale (Factor FLOAT) RETURNS Polygon -- Computes a new polygon scaled by factorNOT FINAL;Table Definitions Traditional style: foreign keys to link tablesTyped tables: supports object identifiers and object referencesRow type constructor: supports rows as variables and parameters Row Type Usage User-Defined Type UsageSubtable Families A table can be declared as a subtable of another table. A subtable inherits the columns of its parent tables.SQL:2003 limits inheritance for tables to single inheritance. Set inclusion determines the relationship of a table to its subtables. Subtable ExampleSubtable Side EffectsSubtable insert: corresponding row is inserted into each ancestor table.Parent update: column updated in all direct and indirect subtablesInherited column update: column is changed in each ancestor tableDeletion: every corresponding row in both parent and subtables is also deleted. Manipulating Complex Objects and Subtable Families Path expressions to manipulate columns with row references.References to methods in expressions using the dot notation Testing membership in a specific table without being a member of any subtables. Using the ROW Keyword Obtaining Object Identifiers Path Expression Example Oracle 10g Object FeaturesSupports most parts of the SQL:2003 object packagesUser-defined typesTyped tablesOther object featuresUser-Defined Type Example Inheritance Typed Tables Inheritance for Typed Tables Inserting into Typed Tables Path Expressions Other Object FeaturesType substitutability for subtablesHierarchical viewsNested tablesXML supportType Substitution and Hierarchical ViewsType substitution: row or column can contain type X or subtypes of XHierarchical views: views with inheritanceLimitations for managing set inclusion relationshipsMust manage storage model for hierarchical viewsDifficult to use reference types and subtype columnsNested Table SupportUtility of nested tables is not clear for business databasesOracle 10g featuresTABLE and NESTED TABLE constructorsQuery results can include nested tables.Comparison operators for nested tablesSet operators for nested tablesViews with nested tablesXML Document SupportPart 14 of SQL:2003Oracle 10g featuresXMLType in columnsXML schema supportXML/SQL dualityXML query operatorsOptimization with query rewriteSummaryThree principles of object-oriented computing guide the development of object DBMSs.A number of object DBMS architectures are commercially available.SQL:2003 supports definition and manipulation of object relational databases.Oracle 10g is a significant implementation of the SQL:2003 object packages
Các file đính kèm theo tài liệu này:
- chapter18_rev_1362.ppt