Chapter 6. Mapping between XML and Relational Data

Denise Draper

XQuery operates on XML documents ”or to be more precise, on instances of an XML data model. Often we assume that these XML documents exist in files or as data in network messages. But in another very common scenario, documents are generated on demand by being translated or created from a different data representation. Relational databases are probably the most important of these different sources of data for XML applications.

This chapter explores the various methods for mapping between XML and relational data models. As of this writing, many relational database vendors have announced various kinds of support for XML, ranging from the ability to transmit results as XML to built-in implementations of XQuery or SQL/XML. In addition, many middleware vendors also provide support for mapping between XML and relational data. In this chapter we do not attempt to cover the specific vendor solutions, since they are in considerable flux. Instead, we focus on the underlying fundamentals: goals and requirements for mapping between XML and relational data; issues that arise when mapping, such as handling of datatypes and order; and when a particular technique can or cannot support update operations. We generally present these concepts from the perspective of a middle- tier solution that builds on top of a relational database. The same concepts are often also valid for implementations integrated within a relational database, but that particular perspective is covered in more detail in Chapter 7, "Integrating XQuery and Relational Database Systems."

We begin with some background, establishing the processing model that we assume and distinguishing different kinds of applications and data sources insofar as they affect mapping. Then we introduce the main representational dichotomy : storage of XML data as XML strings (called " LOB representation") or as individual fields or data items ("composed representation"). The largest part of the chapter delves into the common techniques for composed representations and their implications for supporting different application types. We take a special look at shredding , which is the name for the technique of extracting individual data items from an XML document in such a way that it can be recomposed. Finally, we cover the implementation principles for both LOB and composed representations in just enough detail to suggest the strengths and weaknesses of various approaches.

Our goal is to provide enough information so that readers can gauge their requirements, identify potential pitfalls, and stack these up against the various approaches, whether employed by some commercial software package, custom-built, or a combination of the two.



XQuery from the Experts(c) A Guide to the W3C XML Query Language
Beginning ASP.NET Databases Using VB.NET
ISBN: N/A
EAN: 2147483647
Year: 2005
Pages: 102

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net