skip to main content
10.1145/2784731.2784746acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

XQuery and static typing: tackling the problem of backward axes

Published: 29 August 2015 Publication History

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.

References

[1]
M. Benedikt and J. Cheney. Semantics, types and effects for XML updates. In DBPL’09, pages 1–17, 2009.
[2]
978-3-642-03793-1_1.
[3]
M. Benedikt and J. Cheney. Destabilizers and independence of XML updates. Proc. VLDB Endow., 3(1-2):906–917, Sept. 2010.
[5]
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.
[6]
V. Benzaken, G. Castagna, and A. Frisch. CDuce: an XML-centric general-purpose language. In ICFP’03, pages 51–63, 2003.
[7]
V. Benzaken, G. Castagna, H. Hosoya, B. C. Pierce, and S. Vansummeren. XML typechecking. In Encyclopedia of Database Systems, pages 3646–3650. Springer, 2009.
[8]
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/.
[9]
A. Brüggemann-Klein and D. Wood. One-unambiguous regular languages. Information and Computation, 140(2):229 – 253, 1998.
[11]
C. Calcagno, P. Gardner, and U. Zarfaty. Context logic and tree update. In POPL’05, pages 271–282, 2005.
[12]
[13]
C. Calcagno, P. Gardner, and U. Zarfaty. Context logic as modal logic: Completeness and parametric inexpressivity. In POPL’07, pages 123–134, 2007.
[14]
G. Castagna, H. Im, K. Nguy˜ ˆ en, and V. Benzaken. A core calculus for XQuery 3.0. In ESOP ’15, pages 232–256, 2015. 978-3-662-46669-8_10.
[15]
D. Chamberlin, D. Florescu, and J. Robie. XQuery Update Facility. W3C WD, http://www.w3.org/TR/xqupdate/, 2006.
[16]
J. Cheney and C. Urban. Mechanizing the metatheory of mini-XQuery. In CPP’11, pages 280–295, 2011.
[17]
978-3-642-25379-9_21.
[18]
J. Clark and M. Murata. RELAX NG home page. http://relaxng. org/, 2014.
[19]
I. Cognetic Systems. XQuantum XML database server, 2014. http: //www.cogneticsystems.com/xquery/xquery.html.
[20]
D. Colazzo and C. Sartiani. Precision and complexity of XQuery type inference. In PPDP’11, pages 89–100, 2011.
[21]
[22]
D. Colazzo, G. Ghelli, P. Manghi, and C. Sartiani. Types for path correctness of XML queries. In ICFP’04, pages 126–137, 2004.
[23]
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/.
[24]
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/.
[25]
M. F. Fernández, J. Siméon, and P. Wadler. A semi-monad for semistructured data. In ICDT’01, pages 263–300, 2001. 3-540-44503-X_18.
[26]
P. A. Gardner, G. D. Smith, M. J. Wheelhouse, and U. D. Zarfaty. Local Hoare reasoning about DOM. In PODS’08, 2008. 1145/1376916.1376953.
[27]
P. Genevès, N. Layaïda, and A. Schmitt. Efficient static analysis of XML paths and types. In PLDI’07, pages 342–351, 2007.
[28]
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. 2724712.
[29]
H. Hosoya and B. C. Pierce. XDuce: A statically typed XML processing language. ACM Trans. Internet Technol., 3(2):117–148, 2003.
[30]
H. Hosoya, J. Vouillon, and B. C. Pierce. Regular expression types for XML. ACM Trans. Program. Lang. Syst., 27(1):46–90, 2005.
[31]
D. Hovland. The inclusion problem for regular expressions. Journal of Computer and System Sciences, 78(6):1795 – 1813, 2012.
[32]
G. P. Huet. The zipper. J. Funct. Program., 7(5):549–554, 1997.
[33]
ISO/IEC. Document schema definition language – schematron. http: //www.schematron.com, 2012.
[34]
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.
[35]
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.
[36]
S. Maneth, A. Berlea, T. Perst, and H. Seidl. XML type checking with macro tree transducers. In PODS’05, pages 283–294, 2005.
[37]
S. Maneth, T. Perst, and H. Seidl. Exact XML type checking in polynomial time. In ICDT’07, pages 254–268, 2007. 11965893_18.
[38]
T. Milo, D. Suciu, and V. Vianu. Typechecking for XML transformers. J. Comput. Syst. Sci., 66(1):66–97, 2003.
[39]
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/.
[40]
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/.
[41]
J. Siméon, M. Fernández, et al. Implementation of xquery 1.0, 2008. http://galax.sourceforge.net/.
[42]
W3C. Document object model (DOM), W3C recommendation, 2004. http://www.w3.org/DOM/.
[43]
W3C. Xml query (xquery) implementations, 2014. http://www.w3. org/XML/Query/#implementations.
[44]
P. Wadler. XQuery: A typed functional language for querying XML. In Advanced Functional Programming, pages 188–212, 2002.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
August 2015
436 pages
ISBN:9781450336697
DOI:10.1145/2784731
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 9
    ICFP '15
    September 2015
    436 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858949
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 29 August 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. µ-calculus
  2. XML
  3. XQuery
  4. regular tree types

Qualifiers

  • Research-article

Conference

ICFP'15
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media