XML Databases

XML Foundations (INFO 242)

Erik Wilde, UC Berkeley School of Information
2007-11-20
Creative Commons License

This work is licensed under a CC
Attribution 3.0 Unported License

Abstract

XML Databases are specialized databases for handling XML data. As their query language, they will often use XQuery, but they need additional technologies for updating and storing data. XQuery currently is a read-only language, so update facilities must be provided as an addition to XQuery querying capabilities. One of the big advantages of databases vs. file systems are optimized storage (and thus access) structures, and in the case of XML databases this means storing XML documents other than as text files.

Outline (Files vs. Databases)

  1. Files vs. Databases [3]
  2. XML Storage and Retrieval [5]
  3. XDBMS Access [7]
  4. Updating XDBMS [3]
  5. eXist [3]
  6. Conclusions [1]

Abstraction Layers

File-Based XQuery

File-based XQuery Processing

Database-Based XQuery

DB-based XQuery Processing

Outline (XML Storage and Retrieval)

  1. Files vs. Databases [3]
  2. XML Storage and Retrieval [5]
  3. XDBMS Access [7]
  4. Updating XDBMS [3]
  5. eXist [3]
  6. Conclusions [1]

Database Management

Level-Order Numbering

exist-index-old.png

Dewey Decimal Classification (DDC)

exist-index-new.png

Middle Insert with DDC

xdbms-middle-insert.png

T. Böhme, E. Rahm, Supporting Efficient Streaming and Insertion of XML Data in RDBMS, Proceedings of DIWeb 2004, June 2004

Dynamic Level Numbers (DLN)

xdbms-dln.png

T. Böhme, E. Rahm, Supporting Efficient Streaming and Insertion of XML Data in RDBMS, Proceedings of DIWeb 2004, June 2004

Outline (XDBMS Access)

  1. Files vs. Databases [3]
  2. XML Storage and Retrieval [5]
  3. XDBMS Access [7]
  4. Updating XDBMS [3]
  5. eXist [3]
  6. Conclusions [1]

JDBC

JDBC Type 1 & 2

JDBC Type 1 JDBC Type 2

JDBC Type 3 & 4

JDBC Type 3 JDBC Type 4

XML:DB API (XAPI)

Database Connection

XQJ Example

// establish a connection to the XQuery engine
XQConnection conn = xqds.getConnection();
// create an expression object that is later used to execute an XQuery expression
XQExpression expr = conn.createExpression();
// The XQuery expression to be executed
String es = "for $n in fn:doc('catalog.xml')//item" + " return fn:data($n/name)";
// execute the XQuery expression
XQResultSequence result = expr.executeQuery(es);
// process the result (sequence) iteratively
while (result.next()) {
	// retrieve the current item of the sequence as a String
	String str = result.getAtomicValue();
	System.out.println("Product name: " + str);
}
// free all resources allocated for the result
result.close();
// free all resources allocated for the expression
expr.close();
// free all resources allocated for the connection
conn.close();

HTTP Access

Outline (Updating XDBMS)

  1. Files vs. Databases [3]
  2. XML Storage and Retrieval [5]
  3. XDBMS Access [7]
  4. Updating XDBMS [3]
  5. eXist [3]
  6. Conclusions [1]

XQuery

XUpdate

XQuery Update Extensions

do insert <year>2005</year> after fn:doc("bib.xml")/books/book[1]/publisher
do delete fn:doc("bib.xml")/books/book[1]/author[last()]
do replace fn:doc("bib.xml")/books/book[1]/publisher with fn:doc("bib.xml")/books/book[2]/publisher

Outline (eXist)

  1. Files vs. Databases [3]
  2. XML Storage and Retrieval [5]
  3. XDBMS Access [7]
  4. Updating XDBMS [3]
  5. eXist [3]
  6. Conclusions [1]

Java XDBMS

Collections

Indexing

Outline (Conclusions)

  1. Files vs. Databases [3]
  2. XML Storage and Retrieval [5]
  3. XDBMS Access [7]
  4. Updating XDBMS [3]
  5. eXist [3]
  6. Conclusions [1]

XML Collections