X2S: Translating XPath into Efficient SQL Queries

  • Jun Gao
  • Dongqing Yang
  • Yunfeng Liu
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3289)


Translating XPath into SQL queries is necessary if XML documents are stored in relational databases. Although most of the current methods can translate XPath into equivalent SQL queries, they seldom focus on the efficiency of the translated SQL queries. This paper proposes a method called X2S to handle the problem. X2S is based on the extended relational encoding, which can deal with the operators in XPath efficiently. X2S also exploits DTD to rewrite the XPath logically before the SQL translation. The goal of the rewriting is to eliminate the wildcards of the XPath, to remove the ancestor/descendant relationship and to shorten the length of the XPath. An estimation cost model is used to choose one with the lowest cost from the candidate SQL statements. The experimental results demonstrate that the SQL queries generated by X2S outperform those from other methods significantly.


Range Query Transition Rule Main Path Tree Automaton XPath Query 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Dehaan, D., Toman, D., Consens, M.P., Tamer Ozsu, M.: A Comprehensive XQuery to SQL Translation Using Dynamic Interval Encoding. In: Proc. of SIGMOD, pp. 623–634 (2003)Google Scholar
  2. 2.
    Florescu, D., Kossman, D.: A Performance Evaluation of Alternative Mapping Schemes for Storing XML Data in a Relational Database. In: Rapport de Recherche No.3680 INRIA, Rocquencourt, France (May 1999)Google Scholar
  3. 3.
    Shanmugasundaram, J., Gang, H., Tufte, K., Zhang, C., Dewitt, D., Naughton, J.: Relational Database for Querying XML Documents: Limitation and Opportunities. In: Proc. of VLDB, pp. 302–314 (1999)Google Scholar
  4. 4.
    Grust, T., Keulen, M., Teubner, J.: Teach a relational DBMS to watch its step. In: Proc. of VLDB, pp. 524–535 (2003)Google Scholar
  5. 5.
    Krishnamurthy, R., Kaushik, R., Naughton, J., Chakaravarthy, V.: Recursive XML Schema, Recursive XML Queries and Relational Storage: XML-to-SQL Query translation. In: Proc. of ICDE (2004)Google Scholar
  6. 6.
    Krishnamurthy, R., Kaushik, R., Naughton, J.: XML-SQL Query Translation Literature: The State of the Art and Open Problems. In: Proc. of Xsym, pp. 1–18 (2003)Google Scholar
  7. 7.
    Krishnamurthy, R., Kaushik, R., Naughton, J.: Efficient XML-to-SQL Query Translation: Where to Add the Intelligence? In: Proc. of VLDB (2004)Google Scholar
  8. 8.
    Shanmugasundaram, J., Kiernan, J., Shekita, E., Fan, C., Funderburk, J.: Querying XML Views of Relational Data. In: Proc. of VLDB, pp. 261–270 (2001)Google Scholar
  9. 9.
    Clark, J.: XML Path language(XPath) (1999), Available from the W3C,
  10. 10.
    World Wide Web Consortium. XSL Transformations (XSLT) version 1.0 (November 1999), W3C Recommendation
  11. 11.
    World Wide Web Consortium. Xquery version 1.0 (January 2001), W3C working draft
  12. 12.
  13. 13.
    Chan, C., Felber, P., Garofalakis, M., Rastogi, R.: Efficient Filtering of XML Document With XPath Expressions. In: Proc. of ICDE, pp. 235–244 (2002)Google Scholar
  14. 14.
    Miklau, G., Suciu, D.: Containment and Equivalence for an XPath Fragment. In: Proc.of PODS, pp. 65–76 (2002)Google Scholar
  15. 15.
  16. 16.
    Neven, F., Schwentick, T.: XPath Containment in the Presence of Disjunction, DTDs, and Variables. In: Proc. of ICDT, pp. 315-329 (2003)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Jun Gao
    • 1
  • Dongqing Yang
    • 1
  • Yunfeng Liu
    • 1
  1. 1.The School of Electronic Engineering and Computer SciencePeking UniversityBeijingChina

Personalised recommendations