The VLDB Journal

, Volume 18, Issue 4, pp 857–883

Query translation from XPath to SQL in the presence of recursive DTDs


    • University of Edinburgh
    • Bell Laboratories
  • Jeffrey Xu Yu
    • The Chinese University of Hong Kong
  • Jianzhong Li
    • Harbin Institute of Technology
  • Bolin Ding
    • The Chinese University of Hong Kong
  • Lu Qin
    • The Chinese University of Hong Kong
Regular Paper

DOI: 10.1007/s00778-008-0131-0

Cite this article as:
Fan, W., Yu, J.X., Li, J. et al. The VLDB Journal (2009) 18: 857. doi:10.1007/s00778-008-0131-0


We study the problem of evaluating xpath queries over xml data that is stored in an rdbms via schema-based shredding. The interaction between recursion (descendants-axis) in xpath queries and recursion in dtds makes it challenging to answer xpath queries using rdbms. We present a new approach to translating xpath queries into sql queries based on a notion of extended XPath expressions and a simple least fixpoint (lfp) operator. Extended xpath expressions are a mild extension of xpath, and the lfp operator takes a single input relation and is already supported by most commercial rdbms. We show that extended xpath expressions are capable of capturing both dtd recursion and xpath queries in a uniform framework. Furthermore, they can be translated into an equivalent sequence of sql queries with the lfp operator. We present algorithms for rewriting xpath queries over a (possibly recursive) dtd into extended xpath expressions and for translating extended xpath expressions to sql queries, as well as optimization techniques. The novelty of our approach consists in its capability to answer a large class of xpath queries by means of only low-end rdbms features already available in most rdbms, as well as its flexibility to accommodate existing relational query optimization techniques. In addition, these translation algorithms provide a solution to query answering for certain (possibly recursive) xml views of xml data. Our experimental results verify the effectiveness of our techniques.


XML databaseXPathSQLRecursive DTDQuery translation

Copyright information

© Springer-Verlag 2009