Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

29
Mark Graves Leveraging Existing DBMS Storage for XML DBMS
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    243
  • download

    3

Transcript of Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Page 1: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Mark Graves

Leveraging Existing DBMS Storage for XML DBMS

Page 2: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

This presentation is Copyright 2001, 2002 by Mark Graves and contains material Copyright 2002 by Prentice Hall PTR. All rights reserved.

Page 3: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

AgendaAgenda

DBMS ArchitectureExternal InterfaceData ModelStorage Systems

– Overview– Fine-grained RDBMS storage– Coarse-grained RDBMS storage– Medium-grained RDBMS storage

Page 4: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

XML DBMSXML DBMS

Create a DBMS to capture XMLAccess of document & elementsShould support:

– Storage– Querying– Editing

Page 5: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

DBMS ArchitectureDBMS Architecture

Page 6: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

External InterfaceExternal Interface

User Interface -- HTML or JavaURLs -- command accessJava API -- used by servletCommand-line interfaceXML -- taglib, SOAP

Page 7: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Data ModelsData Models

Type ConstructorsOperationsConstraintsExamples: relational, Entity-

relational, object

Page 8: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

XML Data Model -- TypesXML Data Model -- Types

Document has one name and one (root) element.

Element has– type name (which is a string),– collection of attributes, and – ordered collection of (interspersed) character data

and elements.

Attribute has a name and a value (both strings).

Character data has a value (a string).

Page 9: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

XML Data Model -- ConstraintsXML Data Model -- Constraints

Each document name may occur only once. (Thus, the document names are unique and may be queried.)

All elements other than the document element have an element node as a parent. The document element has no parent. (Thus, the elements form a tree.)

No attribute name may appear more than once in an element.

Page 10: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

XML Data Model -- OperationsXML Data Model -- Operations

Add and DeleteRetrieveReplaceSearch

Page 11: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Operations -- Add and DeleteOperations -- Add and Delete

Add a document to the database. Delete a document from the database. Add an element to a specific location in the

document. Delete an element from a specific location in the

document. Add an attribute to an element.

Delete an attribute from an element.

Page 12: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Operations -- RetrieveOperations -- Retrieve

Retrieve a document from the database given its name. Retrieve an element from a specific location in the document. Retrieve all the elements and character data from a document in

document order (in effect, regenerate the document). Retrieve an attribute from an element given its name. Retrieve the nth child of an element.

Retrieve all children of an element.

Retrieve the text of the character data.

Retrieve the parent element of the character data.

Page 13: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Operations -- ReplaceOperations -- Replace

Replace an element at a specific location with another element or character data.

Replace character data at a specific location with other character data or elements.

Replace the value of an attribute in an element given its name.

Set the text of the character data.

Page 14: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Operations -- SearchOperations -- Search Search for all documents in the database given a particular set of constraints.

Search for all elements in a document that satisfy a particular set of constraints.

Search the document for character data that matches a particular set of constraints (such as matching a string).

Element type name equals (or does not equal) some value.

Attribute name equals (or does not equal) some value.

Character data equals (or does not equal) some value.

Element has a specified number of children (or less than, or greater than, or not equal to).

Character data contains a specified string as a substring.

Query constraint consists of two query constraints that must both be true (or either be true).

Query constraint consists of one query constraint that must not be true.

Page 15: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Storage System Storage System (Internal Interface)(Internal Interface)

Native storeObject-orientedComplex flat-fileRelational DBMS

Page 16: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Leveraged Storage SystemsLeveraged Storage Systems

Page 17: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

RDBMS ImplementationRDBMS Implementation

Use a Relational DBMS to store XML documents

Strategies– fine-grained -- store every piece of data

separately (completely parsed)– coarse-grained -- store entire document

together (no parsing)– medium-grained -- store some elements

in coarse-grained storage, other in fine-grained storage (partial parsing)

Page 18: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Fine-grained StorageFine-grained Storage

Approach: Completely parse data and store each element, attribute, and character data value in a relational table.

Design– Conceptual Schema– Logical Schema (unnormalized & normalized)

– Physical SchemaImplementation (Java)

Page 19: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Conceptual SchemaConceptual Schema

Page 20: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Fine-grained Logical SchemaFine-grained Logical Schema

Document(name DOC_NAME, root ELEMENT) Element(doc DOCUMENT, parent ELEMENT, tag

ELE_NAME) Attribute(doc DOCUMENT, element ELEMENT,

name ATTR_NAME, value ATTR_VALUE) CharData(doc DOCUMENT, element ELEMENT,

value CDATA) Child(doc DOCUMENT, element ELEMENT, index

NUMBER, child_class CHILD_CLASS, child CHILD_NODE)

Page 21: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Fine-grained Logical SchemaFine-grained Logical Schema

Page 22: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Fine-grained Physical SchemaFine-grained Physical Schema

Page 23: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Fine-grained CommandsFine-grained Commands

Retrieve a document (with or without XML header)

Store a documentDelete a documentList documents in database

Page 24: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Fine-grained ImplementationFine-grained Implementation

Page 25: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Coarse-grained StorageCoarse-grained Storage

Approach: Store each document in its entirety

Logical Schema:– Document (name STRING, body TEXT)

Physical Schema:

Page 26: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Medium-grained StorageMedium-grained Storage

Use both fine-grained (parsed) and coarse-grained (unparsed) storage as appropriate within a document

Slice pointsMultiple slice pointsSpecifying slice points

– element type name– element type name & attributes

Page 27: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Dictionary ExampleDictionary Example

<dictionary>

<entry number="1" name="aardvark">

...

</entry>

<entry number="2" name="aadax">

...

</entry>

.

.

.

<entry number="1200" name="zebra">

...

</entry>

<dictionary>

Page 28: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Dictionary ExampleDictionary Example

DOCUMENT ID ELEMENT ID VALUE1 1 <dictionary>

<proxy document=”1” element=”2”/> <proxy document=”1” element=”3”/> … <proxy document=”1” element=”1201”/></dictionary>

1 2 <entry number=”1” name=”aardvark”> …</entry>

… … …1 1201 <entry number=”1200” name=”zebra”>

…</entry>

Page 29: Mark Graves Leveraging Existing DBMS Storage for XML DBMS.

Medium-grained Physical SchemaMedium-grained Physical Schema