Professional Documents
Culture Documents
3.1
Unit Objectives
After completing this unit, you should be able to:
List the characteristics of an XML document that help determine the
right type of database
Define and describe content management databases
Compare relational database structures to XML document
structures
List the limitations of relational data tables with structured data
Define and describe what Object-Oriented databases provide
Describe the status of XML-based queries
Considerations
Start with what you are using the database for.
What type of application are you supporting? Is XML being used as
a transport between the database and the application?
Are you using legacy data?
Are you more interested in the data or in the document structure?
Are you storing Web pages or Web pages' content?
Is your data used by other, perhaps non-XML, applications?
Are you updating the DB from XML?
Document-centric
Extensive prose
Mixed content
Order significant
(especially for siblings)
Legacy data
Types of Databases
Remember: An XML document is a hierarchical,
ordered, and untyped document.
Relational Database (RDB) structures are not hierarchical. Much
of the world's current data exists in RDBs.
Object-Oriented Databases (OODB) are slow to catch on, but show
promise of storing XML data objects. Existing OODBs may have
complex relationships.
Native XML database or content-management systems are
designed specifically to store XML. Oriented towards the
document-oriented XML systems.
Existing database systems must use some type of attachment or
filter to deal with XML data. Many RDB vendors are building this
capability into their products.
Typical Java-based
Database Interchange Solution
Java Application
Connect to Database using JDBC
Retrieve an SQL result set (text string) containing
the XML document
XML
Apps
Database
back end
<department>
<dept-nbr>X333</dept-nbr>
<department-name>
XML developers
</department-name>
<employee>
<last>Smith</last>
<first>John</first>
<ID>250243</ID>
<dept-nbr>X333</dept-nbr>
</employee>
<employee>
<last>Adams</last>
<first>Tom</first>
<ID>432453</ID>
<dept-nbr>X333</dept-nbr>
</employee>
</department>
dept-nbr
X333
Z568
...
department-name
XML developers
Human Resources
Employee
ID
last
250243 Smith
first
John
dept-nbr
X333
...
...
X333
...
OR
XML_Table
Key
XML_Doc
X333 <department>
<dept-nbr>X333</dept-nbr>
<department-name>XML
developers</department-name>
<employee> <last>Smith</last> ...
Z568 <department>
<dept-nbr>Z568 ....
<department deptnbr="X333">
<department-name>
XML developers</department-name>
dept-nbr
X333
Z568
...
department-name
XML developers
Human Resources
Employee
ID
last
250243 Smith
first
John
dept-nbr
X333
...
...
X333
OR
<employeeID="432453" deptnbr="X333">
<last>Adams</last>
<first>Tom</first>
<phone>544-4444</phone>
<e-mail>tadams@XML5.com</e-mail>
</employee>
</department>
XML_Table
Key
XML_Doc
<department deptnbr="X333">
<department-name>
X333 XML developers</department-name>
<employee ID="250243"
deptnbr="X333">...
<department deptnbr="Z568">
Z568
<department-name>...
Object-Oriented Databases
Object-Oriented Database (OODB) features:
Persistence of objects.
Extend semantics of O-O programming languages.
Unification of data model and database structure.
Requires less code.
Ease of code base maintenance.
Relational Database (RDB) comparison:
Data structures must be flattened to fit joined tables.
Structures maintained in memory.
No built-in object management.
OODB real-world applications:
Risk analysis systems, telecom systems, WWW document
structures, design and manufacturing systems, hospital patient
record systems with complex data interrelationships.
XML Native
DB/Content-management Systems (1 of 2)
Can be good for document-oriented XML, much less useful for
data-oriented XML.
Good for less structured data which could result in many null
columns in an RDB.
Preserves physical structure of document.
No need for schema or DTD.
Limited to XML interfaces.
Do not use for data serving a variety of applications.
And provide very fast retrieval speed for entire documents.
Search for specific views of data likely to be slower then RDB.
Can only return data as XML.
XML Native
DB/Content-management Systems (2 of 2)
Two main categories:
Text-based storage
Model-based storage
UTF-8
Database
Unicode
CCSID
ASC II
EBCDIC
Probably not optimal schema for the other system, but good
starting point or good enough for your use.
Likely to ease mapping between the DB and XML documents.
Design time, not run time, activity.
More Information
Reference
Description
http://www-106.ibm.com/
developerworks/xml/library/
x-matters8/index.html
http://www.rpbourret.com/xml/
XMLAndDatabases.htm#intro
http://www.rpbourret.com/xml/
XML Database products by
XMLDatabaseProds.htm#xmlservers Ronald Bourret
http://www-106.ibm.com/
developerworks/library/x-struct/
http://www.xml.com/pub/a/2001/05/
09/dtdtodbs.html
Checkpoint Questions (1 of 2)
1. How can an XML document be stored in an RDB? (select all that
apply):
A. In a Table column (CLOB)
B. SGML
C. Decomposed into different columns/tables
D. Into a DTD file
E. Compressed into an integer column
2. While RDBs are row-based XML documents are:
A. Record based
B. Hierarchical
C. Obsolete
D. Rectangular
Checkpoint Questions (2 of 2)
3. I should use an RDB to store my XML if:
(select all that apply)
A. I have lots of proprietary file formats
B. I need to retrieve large number of documents based on a specific
element
C. I need to exchange data with a business partner
D. I need to represent my data in Esperanto
Unit Summary
In this unit we learned:
How to compare relational database structures to XML document
structures.
The limitations of relational data tables with structured data.
What Object-Oriented databases provide.
The status of XML-based queries.