Accessing Relational Databases via XML Schema

Chengfei Liu, Minyi Guo, Jixue LiuCaise Short Paper Proceedings 2003

Introduction

While XML has long served as the standard for data exchange on the web, the vast majority of enterprise data remains stored in relational database management systems (RDBMS). Bridging the gap between these two paradigms typically involves creating "XML views" of relational data. However, legacy approaches like SilkRoute and XPERANTO often struggle with two primary challenges: data redundancy caused by improper nesting and the computational complexity of translating queries across multiple layers of abstraction.

This paper proposes a streamlined architecture designed to treat relational databases as native XML sources. By automatically translating relational schemas into normalized XML schemas and converting XQuery expressions directly into SQL, the system maintains data integrity and avoids the pitfalls of redundant data representation.

System Architecture

The proposed system is built upon a three-part architecture that facilitates a direct "schema-to-schema" mapping:

  1. Schema Translator: This component converts a relational schema into an equivalent XML Schema (XSD). It categorizes relations into four distinct types—regular, component, supplementary, and association—based on their primary and foreign key structures. To mirror relational integrity constraints, it utilizes XML Schema features such as ID/IDREF for single keys and key/keyref for multi-attribute keys.
  2. Query Translator: This module takes XQuery expressions (specifically FLWR: For, Let, Where, Return) and translates them into SQL. The process involves "canonicalizing" the XQuery to move conditions into the WHERE clause, identifying the necessary relational tables, and generating appropriate SQL joins based on the path expressions used in the XML query.
  3. XML Document Generator: Once the SQL query is executed, the result is a "flat" relational table. This component applies a nest operator to re-format the flat data into the hierarchical structure defined by the target XML schema.

Normalization and Integrity Preservation

A core contribution of this research is the emphasis on normalization. The authors argue that a translated XML schema must be normalized to prevent the massive data duplication that occurs when relational data is nested naively. By identifying "component" relations (tables that logically belong to a parent entity), the system determines where nesting is appropriate.

Furthermore, unlike simpler mapping tools, this approach explicitly maps relational Primary Keys (PK) and Foreign Keys (FK) to XML Schema identity constraints. This ensures that the underlying rules and constraints of the database are respected even when the data is accessed via an XML interface.

Key Results and Query Logic

The primary outcome of this work is a formal set of mapping rules and a robust query translation algorithm.

  • Mapping Rules: The paper defines specific logic for handling different table relationships. For instance, if a table possesses a NOT-NULL foreign key and no circular dependencies, it can be safely nested to create a cleaner, more intuitive XML hierarchy.
  • XQuery to SQL Translation: The authors demonstrate how to decompose an XQuery path (e.g., Root/TableA/TableB) into necessary SQL joins (e.g., TableA JOIN TableB ON A.pk = B.fk).
  • Redundancy Elimination: The architecture achieves high levels of nesting—making the XML easier for developers to use—while introducing zero data redundancy, representing a significant improvement over earlier nesting algorithms like NeT.

Limitations and Future Work

While the architecture provides a logically sound framework for database access, it currently has several limitations:

  • Query Complexity: The translator is currently limited to basic XQuery expressions and does not yet support aggregate functions (such as count or sum) or complex grouping operations.
  • Performance Metrics: The paper focuses on the theoretical framework and mapping rules; it does not provide empirical benchmarking regarding the overhead of the translation layer or the execution speed of the generated SQL compared to hand-written queries.

Future research will focus on expanding the translator's capabilities to include more complex XQuery features and optimizing the document generation process for large-scale datasets.

Summary updated

BibTeX
@inproceedings{liu2003accessing,
  author = {Chengfei Liu and Minyi Guo and Jixue Liu},
  title = {{Accessing Relational Databases via XML Schema}},
  booktitle = {Caise Short Paper Proceedings},
  year = {2003},
}
Figure