Oracle XDB, Release 9iR2 - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

Oracle XDB, Release 9iR2

Description:

C., 'Design and Performance Evaluation of Alternative XML storages' ... [4] Tatarinov, I., Ives, Z. G., Halevy, A. Y., Weld, D. S., 'Updating XML', SIGMOD 2001 ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 39
Provided by: Jagann
Category:
Tags: 9ir2 | xdb | oracle | release | weld

less

Transcript and Presenter's Notes

Title: Oracle XDB, Release 9iR2


1
(No Transcript)
2
Oracle XDB, Release 9iR2
Prepared for IT620 January 20 , 2003
3
Talk Outline
  • Background
  • Key Advantages
  • XMLType
  • Using XML DB
  • Pointers to More Information

4
Background

5
So far we covered
  • 1 Tian, F., DeWitt, D. J., Chen, J., Zhang. C.,
    Design and Performance Evaluation of Alternative
    XML storages
  • 2 Shanmugasundaram, J., Tufte, K., Zhang, .,
    He, G., DeWitt, D. J., Naughton, J. F.,
    Relational Databases for Querying XML Documents
    Limitations and Opportunities, VLDB 1999.
  • 3 Bohannon, P., Freire, J., Roy, P., Simeon,
    J., From XML Schema to Relations A Cost-based
    Approach to XML Storage, ICDE 2002.
  • 4 Tatarinov, I., Ives, Z. G., Halevy, A. Y.,
    Weld, D. S., Updating XML, SIGMOD 2001

6
A look at Oracle XDB
  • How Oracle has responded to supporting XML?
  • Enhancements to Oracle RDBMS
  • Additional tools/utilities

7
What is Oracle XDB?
  • Oracle XDB refers to set of features in the
    Oracle Server for XML. It includes
  • A high performance XML storage and retrieval
    technology (based on W3C XML data model)
  • New standard access methods for navigating and
    querying XML

8
Oracle XDB Key Benefits

9
Benefits
  • Prior to Oracle XDB
  • Structured Data stored in Tables
  • Unstructured Data stored as files or BLOBs
  • With Oracle XDB
  • Both structured and unstructured data stored
    based on standard W3C XML data model.
  • Provides complete transparency and
    interchangeability between XML and SQL metaphors
  • Allows XML operations over table
  • Allows SQL operations over XML documents

10
Benefits
  • SQL operations over XML documents include
  • Piecewise updates
  • Indexing
  • Search
  • Multiple views on data

11
Benefits
  • XML Repository
  • Allows centralized management of content such as
    collection of purchase orders/insurance claims, a
    large technical manual, etc.
  • Allows organizing and annotating the content via
    foldering
  • Allows maintaining relationships between pieces
    of the content
  • Provides Access Control, FTP, and Web-based
    Distributed Authoring and Versioning (WebDAV)
    protocol support with versioning
  • XML documents can still be manipulated with file
    abstractions even though stored in Oracle RDBMS

12
Benefits
  • XML DB provides high performance and scalability
    for operations on complex XML documents.
  • XML DB enables data and documents from disparate
    systems to be accessed (via gateways and external
    tables)

13
XMLType

14
XMLType
  • A Oracle supplied type that can be used as a
    columns datatype
  • XMLType column supports two storage options
  • Unstructured Storage using Large Objects (LOBs)
    or files maintains accuracy of the original XML
  • Structured storage maintains Document Object
    Model (DOM).
  • Hybrid storage

15
XMLType
  • Maintains DOM fidelity by enhancing Oracle SQL
    object support. The native extensions include
  • Supporting ordering of child elements and
    attributes
  • Distinguishing elements and attributes
  • Supporting declaring unstructured content in
    schema (contentmixed or ltanygt)
  • Supporting undeclared data in instance of a XML
    document, such as processing instructions, etc.
  • Supporting enumerated lists
  • Native XMLTYPE instances contain hidden columns
    to hold extra information, which can be accessed
    via APIs such as extract

16
XMLType Storage
  • XMLType column can be changed from one storage to
    other via SQL Export/Import Utility.
  • Applications will still work the same.

17
Conceptual XMLType Model
  • XMLType, which represents a XML document is
    viewed as collection of
  • Elements and attributes
  • Elements in turn can be
  • Complex types consisting of elements and
    attributes
  • Simple types consisting of scalar values

18
Mapping XMLType to Structured Storage
  • Complex type maps to an Oracle Object type
  • Each child element and attribute defined by the
    complexType maps to an attribute of the SQL
    object type.
  • If a child element in the complexType is itself a
    complexType, the datatype of the corresponding
    SQL attribute will be the appropriate SQL Object
    type.
  • If the child element is a simpleType or
    attribute, then the datatype of the corresponding
    SQL attribute will be a primitive SQL data type.

19
XMLType Structured Storage Options (for
collections)
  • CLOBS. If a complexType is defined with
    xdbSQLTypeCLOB
  • Inline VARRAYS. Default. Stored as as a set of
    serialized objects in-line as part of the SQL
    object for the parent element
  • Nested Object Tables. The members of the
    collection are stored in a nested object table.

20
XMLType Structured Storage Options (for
collections)
  • Separate XMLType Table. The members of the
    collection are stored as a separate XMLType
    table. The Parent SQL object contains an array of
    refs. All datatype is XML
  • Creating multiple XMLType columns
  • Linking from a child to corresponding parent
  • Separate XMLType Table with Link Table. The
    members of the collection are stored as a
    separate XMLType table. An link table is created
    which cross references which member in the child
    table are linked to which members of the parent.

21
XMLType Benefits
  • XML Schema SupportAllows W3C standard XML schema
    based generation of tables and types
  • XPath Search Specify elements to query via Xpath
    expressions. Can be combined with other SQL
    (conform to emerging ANSI SQLX standard)
  • XPath Indexes Use XPath to specify part of
    document to be indexed to speed up XPath searches
  • XML Piecewise UpateAllows identifying individual
    elements and attributes for update via XPath
    expressions. Piecewise Update performed

22
XMLType Benefits
  • XML Operators New operators like XMLTABLE (to
    cast a list of nodes returned by XPATH into a
    table), to make XML queries and on-the-fly XML
    generation easy
  • XSL Transformation for XMLType Uses XSLT to
    transform XML documents via SQL operators
  • XPath Views Create XML views to create permanent
    aggregations of various XML document fragments or
    relational tables

23
XMLType Benefits
  • Lazy XML Load XMLType provides a virtual DOM it
    only loads rows as they are requested, throwing
    away previously referenced section of documents
    if memory usage grows. Results in high
    scalability for concurrent users dealing with
    large XML documents
  • Schema Caching Structural information (e.g.,
    element tags, datatypes, etc.) kept in a schema
    cache. Improves perofrmance and scalability of
    large XML documents, as well as for a large
    collection

24
Using XML DB

25
Creating XMLType Columns
  • Problem Store Purchase Orders marked up in XML
    as a column of a table

CREATE TABLE orders (order_info
XMLTYPE) XMLSCHEMA http//www.oracle.com/xdb/orde
rSchema.xsd ELEMENT Purchase Order
26
Creating an XML Schema
  • Using XML Schema editing environment using XML
    Spy (see http//www.altova.com for details)
  • It allows you to specify annotations with the
    schema that controls mapping of the schema to
    database storage.

ltxsdattribute namecustomerId typedecimal
SQLnamecustomer_id, SQLtypenumber /gt
27
Registering an XML Schema
  • DBMS_XMLSCHEMA.registerSchema() used to register
    the XML schema

dbms_xmlschema.registerSchema(
'http//www.oracle.com/xdb/orderSchema.xsd',
source)
28
Registering an XML Schema
  • Registration parses/validates the schema and
    generates needed object types, etc.

CREATE TYPE purchaseOrderItem as
OBJECT() CREATE TYPE purchaseOrderItems as
VARRAY() OF pruchaseorderItem CREATE TYPE
purchaseOrder as OBJECT( customerId
number, customerName varchar2(2000), orderDate
date, shipDate date, Items
purchaseOrderItems )
29
Loading XML documents
  • Via INSERTs

INSERT INTO orders VALUES(
XMLType( 'lt?xml version"1.0"?gt
ltPO

pono"1"gt
ltPNAMEgtPO_1lt/PNAMEgt


lt/POgt
) )
  • Via XML Repository (drag and drop)
  • inserted to default table specified as part of
    XML schema definition

30
Querying XML documents
  • existsNodetests the XMLType instance to see if a
    node matching the specified XPath expression
    exists

SELECT order_info FROM orders WHERE
existsNode (order_info, /PO/PNAME) gt 0

31
Querying XML documents
  • extractreturns document consisting of an XML
    document fragment with those elements and
    attributes matching the XPath expression

SELECT extract(order_info,/PO/PNAME) FROM
orders Output ltPNAMEgtPO_1lt/PNAMEgt

32
Querying XML documents
  • extractValuereturns a scalar value corresponding
    to the result of the XPath evaluation on the
    XMLType instance

SELECT extractValue(order_info,/PO/PNAME) FROM
orders Result PO_1 SELECT Count() from
orders WHERE extractValue(order_info,/PO/PNAME)
PO_1 Result 1
33
Updating XML documents
  • Complete UpdatePerformed by replacing it.

UPDATE orders SET order_info
XMLType( 'lt?xml version"1.0"?gt
ltPO

pono"1"gt
ltPNAMEgtPO_2lt/PNAMEgt


lt/POgt
)
34
Updating XML documents
  • Path-based Updatecan be specified using
    UPDATEXML SQL function.

UPDATE orders SET order_info UPDATEXML(
order_info,
'/PO/CUSTNAME/text()',

'John)
35
Unstructured vs. Structured Storage
  • Unstructured
  • Fast Storage and Retrieval
  • Slower Operations
  • Allows great flexibility in handline varying
    content
  • Larger memory requirement due to need to
    parse/validate etc.
  • Structured
  • Incurs shredding/reconstruction overhead
  • Faster Operations as directly mapped to
    object-relational storage
  • Relies on Object-relational and hence suited more
    for uniform content
  • Minimal memory requirement

36
Unstructured vs. Structured Storage
  • Unstructured
  • Can create function-based indexes on Xpath
    expressions or inverted indices
  • Update does complete rewrite
  • Larger space requirement
  • Coarse-grain control
  • Structured
  • Can create native indexes on columns
    corresponding to attributes as well as inverted
    indices
  • Performs piece-wise updates
  • Less storage requirement as avoids storing tags
  • Fine grain control (subpart can be unstructured)

37
For more Information
  • Main Page http//otn.oracle.com/tech/xml/doc.html
  • Oracle9i XML Database Developer's Guide - Oracle
    XML DB, Release 2 (9.2) http//otn.oracle.com/docs
    /products/oracle9i/doc_library/release2/appdev.920
    /a96620/toc.htm

38
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com