Wednesday 25 May 2011

Data Mapping Tutorials and Guides for XML and Relational Databases

Data mapping is sometimes an inevitable task for developers, although it can be difficult to know where to start. Application and project changes can lead to the decision to shift data models and systems, such as changing from XML to other database platforms. If you've ever been faced with the task of transferring data between XML and database systems such as MySQL, you'll know the sheer number of decisions that sometimes need to be made.

Of course there are database systems in which XML data can be modelled natively, however the trickier case is where a different model is going to be used, for example relational. This kind of XML database mapping initially involves creating a relational database design that effectively models the same set of data that the original XML was structured for. This needs to include all of the same information as well as reflecting the relationships between data items, and as with so many design tasks, there is never only one right answer.

There are lots of software and Web application tools that automate the process of importing XML data into a database. It's really up to developers to decide whether this is going to be appropriate or effective in any particular project. The focus of the resources listed here is more on manually creating a relational model designed to accommodate data that is already stored in XML, with the XML model perhaps represented using an XSD (XML Schema Definition).

Here are some useful resources I came across reading about the topic:

O'Reilly XML.com - Mapping DTDs to Databases
I've found this an excellent site generally for anything to do with XML. This section runs through the key principles and considerations in mapping from an XML structure such as one represented in a DTD, to an object relational system.

W3C - XML Database Mapping
This may be a pretty old document but it makes an interesting read, exploring some of the major concepts in translating data between XML and database structures.

XML and Databases - Ronald Bourret
This is one of the best resources I've found on this topic. It's a very thorough guide to just about every imaginable angle on XML and databases, including both table based and object relational mapping.

O'Reilly XML.com - Storing XML in Relational Databases
Another one from the O'Reilly XML.com site, this piece discusses various approaches taken by major applications and vendors including Oracle, Microsoft, IBM and Sybase.

MySQL Developer Zone - Using XML in MySQL 5.1 and 6.0
Naturally this is specific to MySQL, so if that's the platform you happen to be targeting there's some useful info in here. Topics include XPath, importing and exporting XML data.

Oracle XML DB Developer's Guide - XML Schema Storage and Query: Basic
This contains Oracle specific info but there is also some interesting general material on data mapping, including mapping data types from XML Schema to database and SQL types.

International DB2 User Group (IDUG) - Converting XML to Relational Data
A thorough and balanced explanation of XML to relational data conversion, with a particular focus on shredding, including a well reasoned weighing up of when it is and isn't likely to be suitable.

IBM DeveloperWorks - XML Matters: Putting XML in context with hierarchical, relational, and object-oriented models
The DeveloperWorks site is always a good resource for very specific technical subjects like this. This article takes a high-level, abstract but still accessible view, discussing the conceptual aspects of each model with relation to importing XML data.

Lorentz Center - Structured Mapping of XMLType
Again, this is specific to Oracle and other technologies, but there is a fair amount of generally useful info within it. Particularly helpful sections cover XML Schema and various topics on mapping to SQL.

Kitebird - Using XML with MySQL
This is focused on MySQL but again covers some of the central issues in mapping between XML and any database system. The subjects are covered from a few different angles here, including importing XML into MySQL using different techniques.

Finally here are a couple of mine:
Using XML Schemas (XSDs) to Create Database Tables
XML Database Mapping Using XSD (XML Schema)

So that's it, this is one topic I must admit I've found it difficult to discover useful material on. I don't personally have much experience in using any of the software and application tools for this type of activity, but I suspect a manual redesign will probably always be the most successful approach in switching from XML to relational database systems.

No comments:

Post a Comment