XQuery and static typing: tackling the problem of backward axes

XQuery is a functional language dedicated to XML data querying and manipulation. As opposed to other W3C-standardized languages for XML (e.g. XSLT), it has been intended to feature strong static typing. Currently, however, some expressions of the language cannot be statically typed with any precision. We argue that this is due to a discrepancy between the semantics of the language and its type algebra: namely, the values of the language are (possibly inner) tree nodes, which may have siblings and ancestors in the data. The types on the other hand are regular tree types, as usual in the XML world: they describe sets of trees. The type associated to a node then corresponds to the subtree whose root is that node and contains no information about the rest of the data. This makes navigation expressions using `backward axes,' which return e.g. the siblings of a node, impossible to type. We discuss how to handle this discrepancy by improving the type system. We describe a logic-based language of extended types able to represent inner tree nodes and show how it can dramatically increase the precision of typing for navigation expressions. We describe how inclusion between these extended types and the classical regular tree types can be decided, allowing a hybrid system combining both type languages. The result is a net increase in precision of typing.

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

[2]  Philippa Gardner,et al.  Context logic and tree update , 2005, POPL '05.

[3]  Christian Urban,et al.  Mechanizing the Metatheory of mini-XQuery , 2011, CPP.

[4]  Philippa Gardner,et al.  Local Hoare reasoning about DOM , 2008, PODS.

[5]  Vincent Quint,et al.  Impact of XML Schema Evolution , 2011, TOIT.

[6]  W. Marsden I and J , 2012 .

[7]  Dan Suciu,et al.  Typechecking for XML transformers , 2000, J. Comput. Syst. Sci..

[8]  Ling Liu,et al.  Encyclopedia of Database Systems , 2009, Encyclopedia of Database Systems.

[9]  James Cheney,et al.  Semantics, Types and Effects for XML Updates , 2009, DBPL.

[10]  Gérard P. Huet,et al.  The Zipper , 1997, Journal of Functional Programming.

[11]  Helmut Seidl,et al.  XML type checking with macro tree transducers , 2005, PODS.

[12]  Philippa Gardner,et al.  Context logic as modal logic: completeness and parametric inexpressivity , 2007, POPL '07.

[13]  James Cheney,et al.  Destabilizers and independence of XML updates , 2010, Proc. VLDB Endow..

[14]  Ling Liu,et al.  XML Type-Checking , 2009 .

[15]  Scott Boag,et al.  XQuery 1.0 : An XML Query Language , 2007 .

[16]  Benjamin C. Pierce,et al.  XDuce: A statically typed XML processing language , 2003, TOIT.

[17]  Dag Hovland The Inclusion Problem for Regular Expressions , 2010, LATA.

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

[19]  Philip Wadler XQuery: A Typed Functional Language for Querying XML , 2002, Advanced Functional Programming.

[20]  Benjamin C. Pierce,et al.  Regular expression types for XML , 2000, TOPL.

[21]  Helmut Seidl,et al.  Exact XML Type Checking in Polynomial Time , 2007, ICDT.

[22]  Giuseppe Castagna,et al.  Optimizing XML querying using type-based document projection , 2013, TODS.

[23]  Derick Wood,et al.  One-Unambiguous Regular Languages , 1998, Inf. Comput..

[24]  Giuseppe Castagna,et al.  CDuce: an XML-centric general-purpose language , 2003, ACM SIGPLAN Notices.

[25]  P. Cochat,et al.  Et al , 2008, Archives de pediatrie : organe officiel de la Societe francaise de pediatrie.

[26]  Federico Ulliana Type-Based Detection of XML Query-Update Independence , 2012, Proc. VLDB Endow..

[27]  Nils Gesbert,et al.  Parametric polymorphism and semantic subtyping: the logical connection , 2011, ICFP.

[28]  E. H. Hutten SEMANTICS , 1953, The British Journal for the Philosophy of Science.

[29]  Nils Gesbert,et al.  Efficiently Deciding μ-Calculus with Converse over Finite Trees , 2015, ACM Trans. Comput. Log..

[30]  Giuseppe Castagna,et al.  Set-theoretic foundation of parametric polymorphism and subtyping , 2011, ICFP.

[31]  Philip Wadler,et al.  A Semi-monad for Semi-structured Data , 2001, ICDT.

[32]  Dario Colazzo,et al.  Precision and complexity of XQuery type inference , 2011, PPDP.

[33]  Pierre Genevès,et al.  Efficient static analysis of XML paths and types , 2007, PLDI '07.

[34]  Giuseppe Castagna,et al.  A Core Calculus for XQuery 3.0 - Combining Navigational and Pattern Matching Approaches , 2015, ESOP.

[35]  Michael F. P. O'Boyle,et al.  ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI '14, Edinburgh, United Kingdom - June 09 - 11, 2014 , 2014, ACM-SIGPLAN Symposium on Programming Language Design and Implementation.

[36]  Michael Benedikt,et al.  Higher­Order Functions and Structured Datatypes , 2012, WebDB.

[37]  Paolo Manghi,et al.  Types for path correctness of XML queries , 2004, ICFP '04.

[38]  Giuseppe Castagna,et al.  XML Typechecking , 2009, Encyclopedia of Database Systems.

[39]  Christian Kirkegaard,et al.  Static analysis of XML transformations in Java , 2003, IEEE Transactions on Software Engineering.