Abstract
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.
- M. Benedikt and J. Cheney. Semantics, types and effects for XML updates. In DBPL’09, pages 1–17, 2009. Google Scholar
Digital Library
- doi: 10.1007/ 978-3-642-03793-1_1.Google Scholar
- M. Benedikt and J. Cheney. Destabilizers and independence of XML updates. Proc. VLDB Endow., 3(1-2):906–917, Sept. 2010. Google Scholar
Digital Library
- doi: 10.14778/1920841.1920956.Google Scholar
- M. Benedikt and H. Vu. Higher-order functions and structured datatypes. In WebDB’12, pages 43–48, 2012. URL http://db.disi. unitn.eu/pages/WebDB2012/papers/p13.pdf.Google Scholar
- V. Benzaken, G. Castagna, and A. Frisch. CDuce: an XML-centric general-purpose language. In ICFP’03, pages 51–63, 2003. doi: 10.1145/944705.944711. Google Scholar
Digital Library
- V. Benzaken, G. Castagna, H. Hosoya, B. C. Pierce, and S. Vansummeren. XML typechecking. In Encyclopedia of Database Systems, pages 3646–3650. Springer, 2009.Google Scholar
- S. Boag, D. Chamberlin, M. Fernández, D. Florescu, J. Robie, and J. Siméon. XQuery 1.0: An XML Query Language (2nd ed.). W3C Recommendation, 2010. http://www.w3.org/TR/xquery/.Google Scholar
- A. Brüggemann-Klein and D. Wood. One-unambiguous regular languages. Information and Computation, 140(2):229 – 253, 1998. Google Scholar
Digital Library
- doi: 10.1006/inco.1997.2688.Google Scholar
- C. Calcagno, P. Gardner, and U. Zarfaty. Context logic and tree update. In POPL’05, pages 271–282, 2005. doi: 10.1145/1040305. Google Scholar
Digital Library
- 1040328.Google Scholar
- C. Calcagno, P. Gardner, and U. Zarfaty. Context logic as modal logic: Completeness and parametric inexpressivity. In POPL’07, pages 123–134, 2007. doi: 10.1145/1190216.1190236. Google Scholar
Digital Library
- G. Castagna, H. Im, K. Nguy˜ ˆ en, and V. Benzaken. A core calculus for XQuery 3.0. In ESOP ’15, pages 232–256, 2015. doi: 10.1007/ 978-3-662-46669-8_10.Google Scholar
- D. Chamberlin, D. Florescu, and J. Robie. XQuery Update Facility. W3C WD, http://www.w3.org/TR/xqupdate/, 2006.Google Scholar
- J. Cheney and C. Urban. Mechanizing the metatheory of mini-XQuery. In CPP’11, pages 280–295, 2011. Google Scholar
Digital Library
- doi: 10.1007/ 978-3-642-25379-9_21.Google Scholar
- J. Clark and M. Murata. RELAX NG home page. http://relaxng. org/, 2014.Google Scholar
- I. Cognetic Systems. XQuantum XML database server, 2014. http: //www.cogneticsystems.com/xquery/xquery.html.Google Scholar
- D. Colazzo and C. Sartiani. Precision and complexity of XQuery type inference. In PPDP’11, pages 89–100, 2011. doi: 10.1145/2003476. Google Scholar
Digital Library
- 2003490.Google Scholar
- D. Colazzo, G. Ghelli, P. Manghi, and C. Sartiani. Types for path correctness of XML queries. In ICFP’04, pages 126–137, 2004. doi: 10.1145/1016850.1016869. Google Scholar
Digital Library
- D. Draper, M. Dyck, P. Fankhauser, M. Fernández, A. Malhotra, K. Rose, M. Rys, J. Siméon, and P. Wadler. XQuery 1.0 and XPath 2.0 formal semantics, W3C recommendation, December 2010. http: //www.w3.org/TR/xquery-semantics/.Google Scholar
- P. Fankhauser, M. Fernández, A. Malhotra, M. Rys, J. Siméon, and P. Wadler. The XML query algebra, W3C working draft, December 2000. http://www.w3.org/TR/2000/ WD-query-algebra-20001204/.Google Scholar
- M. F. Fernández, J. Siméon, and P. Wadler. A semi-monad for semistructured data. In ICDT’01, pages 263–300, 2001. doi: 10.1007/ 3-540-44503-X_18.Google Scholar
- P. A. Gardner, G. D. Smith, M. J. Wheelhouse, and U. D. Zarfaty. Local Hoare reasoning about DOM. In PODS’08, 2008. doi: 10. 1145/1376916.1376953. Google Scholar
Digital Library
- P. Genevès, N. Layaïda, and A. Schmitt. Efficient static analysis of XML paths and types. In PLDI’07, pages 342–351, 2007. doi: 10.1145/1250734.1250773. Google Scholar
Digital Library
- P. Genevès, N. Layaïda, A. Schmitt, and N. Gesbert. Efficiently deciding µ-calculus with converse over finite trees. ACM Transactions on Computational Logic, 16(2):16:1–16:41, 2015. doi: 10.1145/ 2724712. Google Scholar
Digital Library
- H. Hosoya and B. C. Pierce. XDuce: A statically typed XML processing language. ACM Trans. Internet Technol., 3(2):117–148, 2003. doi: 10.1145/767193.767195. Google Scholar
Digital Library
- H. Hosoya, J. Vouillon, and B. C. Pierce. Regular expression types for XML. ACM Trans. Program. Lang. Syst., 27(1):46–90, 2005. doi: 10.1145/1053468.1053470. Google Scholar
Digital Library
- D. Hovland. The inclusion problem for regular expressions. Journal of Computer and System Sciences, 78(6):1795 – 1813, 2012. doi: 10.1016/j.jcss.2011.12.003. Google Scholar
Digital Library
- G. P. Huet. The zipper. J. Funct. Program., 7(5):549–554, 1997. Google Scholar
Digital Library
- ISO/IEC. Document schema definition language – schematron. http: //www.schematron.com, 2012.Google Scholar
- C. Kirkegaard, A. Møller, and M. I. Schwartzbach. Static analysis of XML transformations in Java. IEEE Transactions on Software Engineering, 30(3):181–192, March 2004. Google Scholar
Digital Library
- C. Koch. On the complexity of nonrecursive XQuery and functional query languages on complex values. ACM Trans. Database Syst., 31 (4):1215–1256, Dec. 2006. doi: 10.1145/1189769.1189771. Google Scholar
Digital Library
- S. Maneth, A. Berlea, T. Perst, and H. Seidl. XML type checking with macro tree transducers. In PODS’05, pages 283–294, 2005. doi: 10.1145/1065167.1065203. Google Scholar
Digital Library
- S. Maneth, T. Perst, and H. Seidl. Exact XML type checking in polynomial time. In ICDT’07, pages 254–268, 2007. doi: 10.1007/ 11965893_18. Google Scholar
Digital Library
- T. Milo, D. Suciu, and V. Vianu. Typechecking for XML transformers. J. Comput. Syst. Sci., 66(1):66–97, 2003. Google Scholar
Digital Library
- J. Robie, D. Chamberlin, M. Dyck, D. Florescu, J. Melton, and J. Siméon. XQuery update facility 1.0, W3C recommendation, March 2011. http://www.w3.org/TR/xquery-update-10/.Google Scholar
- J. Robie, D. Chamberlin, M. Dyck, and J. Snelson. XQuery 3.0: An XML Query Language. W3C Last Call Working, July 2013. http://www.w3.org/TR/xquery-30/.Google Scholar
- J. Siméon, M. Fernández, et al. Implementation of xquery 1.0, 2008. http://galax.sourceforge.net/.Google Scholar
- W3C. Document object model (DOM), W3C recommendation, 2004. http://www.w3.org/DOM/.Google Scholar
- W3C. Xml query (xquery) implementations, 2014. http://www.w3. org/XML/Query/#implementations.Google Scholar
- P. Wadler. XQuery: A typed functional language for querying XML. In Advanced Functional Programming, pages 188–212, 2002.Google Scholar
Index Terms
XQuery and static typing: tackling the problem of backward axes
Recommendations
XQuery and static typing: tackling the problem of backward axes
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingXQuery 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 ...
Precision and complexity of XQuery type inference
PPDP '11: Proceedings of the 13th international ACM SIGPLAN symposium on Principles and practices of declarative programmingA key feature of XQuery is its type system. Any language expression is statically typed and its type is used during program type-checking.
In XQuery, types of input data and functions are defined in terms of regular expression types, but it is quite ...
XML Processing and Data Integration with XQuery
Most Web applications exchange data as XML, but they create and process this data with languages that don't have native support for XML. With appropriate middleware, XQuery can dramatically simplify this process, treating all data sources as though they ...






Comments