On the complexity of nonrecursive XQuery and functional query languages on complex values

This article studies the complexity of evaluating functional query languages for complex values such as monad algebra and the recursion-free fragment of XQuery. We show that monad algebra, with equality restricted to atomic values, is complete for the class TA[2O(n), O(n)] of problems solvable in linear exponential time with a linear number of alternations if the query is assumed to be part of the input. The monotone fragment of monad algebra with atomic value equality but without negation is NEXPTIME-complete. For monad algebra with deep value equality, that is, equality of complex values, we establish TA[2O(n), O(n)] lower and exponential-space upper bounds. We also study a fragment of XQuery, Core XQuery, that seems to incorporate all the features of a query language on complex values that are traditionally deemed essential. A close connection between monad algebra on lists and Core XQuery (with “child” as the only axis) is exhibited. The two languages are shown expressively equivalent up to representation issues. We show that Core XQuery is just as hard as monad algebra with respect to query and combined complexity. As Core XQuery is NEXPTIME-hard, the best-known techniques for processing such problems require exponential amounts of working memory and doubly exponential time in the worst case. We present a property of queries---the lack of a certain form of composition---that virtually all real-world XQueries have and that allows for query evaluation in PSPACE and thus singly exponential time. Still, we are able to show for an important special case---Core XQuery with equality testing restricted to atomic values---that the composition-free language is just as expressive as the language with composition. Thus, under widely-held complexity-theoretic assumptions, the language with composition is an exponentially more succinct version of the composition-free language.

[1]  Evgeny Dantsin,et al.  Expressive Power and Data Complexity of Query Languages for Trees and Lists , 2000, PODS 2000.

[2]  Victor Vianu,et al.  Tractable query languages for complex object databases , 1991, PODS '91.

[3]  Jianwen Su,et al.  On accessing object-oriented databases: expressive power, complexity, and restrictions , 1989, SIGMOD '89.

[4]  Andrei Voronkov,et al.  Complexity of nonrecursive logic programs with complex values , 1998, PODS.

[5]  Limsoon Wong,et al.  Normal Forms and Conservative Extension Properties for Query Languages over Collection Types , 1996, J. Comput. Syst. Sci..

[6]  Moshe Y. Vardi The complexity of relational query languages (Extended Abstract) , 1982, STOC '82.

[7]  Bertram Ludäscher,et al.  A Transducer-Based XML Query Processor , 2002, VLDB.

[8]  Serge Abiteboul,et al.  Space Usage in Functional Query Languages , 1995, ICDT.

[9]  Serge Abiteboul,et al.  Foundations of Databases , 1994 .

[10]  Limsoon Wong,et al.  Principles of Programming with Complex Objects and Collection Types , 1995, Theor. Comput. Sci..

[11]  Evgeny Dantsin,et al.  Complexity of Query Answering in Logic Databases with Complex Values , 1998 .

[12]  Tova Milo,et al.  Towards Tractable Algebras for Bags , 1996, J. Comput. Syst. Sci..

[13]  Amélie Marian,et al.  Projecting XML Documents , 2003, VLDB.

[14]  Jeanne Ferrante,et al.  A Decision Procedure for the First Order Theory of Real Addition with Order , 1975, SIAM J. Comput..

[15]  Richard Edwin Stearns,et al.  Hierarchies of memory limited computations , 1965, SWCT.

[16]  Stephen A. Cook,et al.  Problems Complete for Deterministic Logarithmic Space , 1987, J. Algorithms.

[17]  Catriel Beeri,et al.  The power of languages for the manipulation of complex values , 1995, The VLDB Journal.

[18]  Gabriel M. Kuper,et al.  The logical data model , 1993, TODS.

[19]  E. F. Codd,et al.  A relational model of data for large shared data banks , 1970, CACM.

[20]  Philip Wadler,et al.  An Algebra for XML Query , 2000, FSTTCS.

[21]  Hans-Jörg Schek,et al.  Remarks on the algebra of non first normal form relations , 1982, PODS.

[22]  Neil Immerman,et al.  On Uniformity within NC¹ , 1990, J. Comput. Syst. Sci..

[23]  Christoph Koch,et al.  On the complexity of nonrecursive XQuery and functional query languages on complex values , 2006, TODS.

[24]  Leonard Berman,et al.  The Complexity of Logical Theories , 1980, Theor. Comput. Sci..

[25]  Ashok K. Chandra,et al.  Optimal implementation of conjunctive queries in relational data bases , 1977, STOC '77.

[26]  Dirk Van Gucht,et al.  Possibilities and limitations of using flat operators in nested algebra expressions , 1988, PODS '88.

[27]  Georg Gottlob,et al.  The complexity of XPath query evaluation and XML typing , 2005, JACM.

[28]  Evgeny Dantsin,et al.  Expressive power and data complexity of nonrecursive query languages for lists and trees (extended abstract) , 2000, PODS '00.

[29]  Limsoon Wong,et al.  Query Languages for Bags and Aggregate Functions , 1997, J. Comput. Syst. Sci..

[30]  Christoph Koch,et al.  On the role of composition in XQuery , 2005, WebDB.

[31]  Jan Hidders,et al.  A Light but Formal Introduction to XQuery , 2004, XSym.

[32]  Jérôme Siméon,et al.  Building an Extensible XQuery Engine: Experiences with Galax (Extended Abstract) , 2004, XSym.

[33]  Michael J. Carey,et al.  The BEA/XQRL Streaming XQuery Processor , 2003, VLDB.

[34]  Jianwen Su,et al.  Algebraic and Calculus Query Languages for Recursively Typed Complex Objects , 1993, J. Comput. Syst. Sci..

[35]  Limsoon Wong,et al.  Naturally Embedded Query Languages , 1992, ICDT.

[36]  Limsoon Wong,et al.  Query languages for bags: expressive power and complexity , 1996, SIGA.

[37]  Dan Suciu,et al.  A Query Language for NC , 1997, J. Comput. Syst. Sci..

[38]  Gabriel M. Kuper,et al.  On the Complexity of Queries in the Logical Data Model , 1993, Theor. Comput. Sci..

[39]  H. James Hoover,et al.  Limits to Parallel Computation: P-Completeness Theory , 1995 .

[40]  David S. Johnson,et al.  A Catalog of Complexity Classes , 1991, Handbook of Theoretical Computer Science, Volume A: Algorithms and Complexity.

[41]  Michael Benedikt,et al.  Interpreting Tree-to-Tree Queries , 2006, ICALP.

[42]  Stefanie Scherzinger,et al.  Schema-based Scheduling of Event Processors and Buffer Minimization for Queries on Structured Data Streams , 2004, VLDB.

[43]  Georg Gottlob,et al.  Complexity and expressive power of logic programming , 2001, CSUR.