skip to main content
research-article
Free Access

Parametric polymorphism for XML

Published:04 November 2009Publication History
Skip Abstract Section

Abstract

Despite the extensiveness of recent investigations on static typing for XML, parametric polymorphism has rarely been treated. This well-established typing discipline can also be useful in XML processing in particular for programs involving “parametric schemas,” that is, schemas parameterized over other schemas (e.g., SOAP). The difficulty in treating polymorphism for XML lies in how to extend the “semantic” approach used in the mainstream (monomorphic) XML type systems. A naive extension would be “semantic” quantification over all substitutions for type variables. However, this approach reduces to an NEXPTIME-complete problem for which no practical algorithm is known and induces a subtyping relation that may not always match the programmer's intuition. In this article, we propose a different method that smoothly extends the semantic approach yet is algorithmically easier. The key idea here is to devise a novel and simple marking technique, where we interpret a polymorphic type as a set of values with annotations of which subparts are parameterized. We exploit this interpretation in every ingredient of our polymorphic type system such as subtyping, inference of type arguments, etc. As a result, we achieve a sensible system that directly represents a usual expected behavior of polymorphic type systems—“values of abstract types are never reconstructed”—in a reminiscence of Reynold's parametricity theory. Also, we obtain a set of practical algorithms for typechecking by local modifications to existing ones for a monomorphic system.

References

  1. Aiken, A., Kozen, D., and Wimmers, E. L. 1995. Decidability of systems of set constraints with negative constraints. Inf. Comput. 122, 1, 30--44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Alon, N., Milo, T., Neven, F., Suciu, D., and Vianu, V. 2001. XML with data values: Typechecking revisited. In Proceedings of Symposium on Principles of Database Systems (PODS). ACM, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Altheim, M. and McCarron, S. 2001. XHTML 1.1 — Module-based XHTML. http://www.w3.org/TR/2001/REC-xhtml11-20010531/.Google ScholarGoogle Scholar
  4. Appel, A. W. and MacQueen, D. B. 1991. Standard ML of New Jersey. In Proceedings of the 3rd International Symposium on Programming Language Implementation and Logic Programming. Springer-Verlag, Berlin, Germany, 1--13.Google ScholarGoogle ScholarCross RefCross Ref
  5. Ausbrooks, R., Buswell, S., Dalmas, S., Devitt, S., Diaz, A., Hunter, R., Smith, B., Soiffer, N., Sutor, R., and Watt, S. 2003. Mathematical Markup Language (MathML) Version 2.0 (Second Edition). http://www.w3.org/Math/.Google ScholarGoogle Scholar
  6. Benzaken, V., Castagna, G., and Frisch, A. 2003. CDuce: An XML-centric general-purpose language. In Proceedings of the International Conference on Functional Programming (ICFP). 51--63. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bracha, G., Odersky, M., Stoutamire, D., and Wadler, P. 1998. Making the future safe for the past: Adding genericity to the Java programming language. In Proceedings of the ACM Symposium on Object Oriented Programming: Systems, Languages, and Applications (OOPSLA). ACM, New York, 183--200. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Bray, T., Paoli, J., Sperberg-McQueen, C. M., and Maler, E. 2000. Extensible markup language (XML#8482;). http://www.w3.org/XML/.Google ScholarGoogle Scholar
  9. Canning, P. S., Cook, W. R., Hill, W. L., Olthoff, W. G., and Mitchell, J. C. 1989. F-bounded polymorphism for object-oriented programming. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture (FPCA). 273--280. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Cardelli, L., Martini, S., Mitchell, J. C., and Scedrov, A. 1994. An extension of System F with subtyping. Inf. Comput. 109, 1--2, 4--56. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Castagna, G. and Nguyen, K. 2008. Typed iterators for XML. In ICFP '08: Proceedings of the 13th ACM-SIGPLAN International Conference on Functional Programming. ACM, New York, 15--26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Castagna, G. and Pierce, B. C. 1995. Corrigendum: decidable bounded quantification. In POPL'95: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, 408. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Comon, H., Dauchet, M., Gilleron, R., Jacquemard, F., Lugiez, D., Tison, S., and Tommasi, M. 1999. Tree automata techniques and applications. Draft book; available electronically on http://www.grappa.univ-lille3.fr/tata.Google ScholarGoogle Scholar
  14. Fallside, D. and Lafon, Y. 2004. XML protocol working group. http://www.w3.org/2000/xp/Group/.Google ScholarGoogle Scholar
  15. Fankhauser, P., Fernández, M., Malhotra, A., Rys, M., Siméon, J., and Wadler, P. 2001. XQuery 1.0 Formal Semantics. http://www.w3.org/TR/query-semantics/.Google ScholarGoogle Scholar
  16. Frisch, A. 2004. Théorie, conception et réalisation d'un langage de programmation adapté à XML. Ph.D. dissertation, Universite Paris 7, Paris, France.Google ScholarGoogle Scholar
  17. Frisch, A. 2006. OCaml + XDuce. SIGPLAN Not. 41, 9, 192--200. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Frisch, A., Castagna, G., and Benzaken, V. 2002. Semantic subtyping. In Proceedings of the 17th Annual IEEE Symposium on Logic Computer Science. IEEE Computer Society Press, Los Alamitos, CA, 137--146. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Frisch, A., Castagna, G., and Benzaken, V. 2008. Semantic subtyping: dealing set-theoretically with function, union, intersection, and negation types. J. ACM 55, 4, 1--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Gilleron, R., Tison, S., and Tommasi, M. 1999. Set constraints and automata. Inf. Comput. 149, 1, 1--41.Google ScholarGoogle ScholarCross RefCross Ref
  21. Harren, M., Raghavachari, M., Shmueli, O., Burke, M. G., Bordawekar, R., Pechtchanski, I., and Sarkar, V. 2005. XJ: Facilitating XML processing in Java. In Proceedings of the 14th International Conference on World Wide Web (WWW2005). ACM, New York, 278--287. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Hosoya, H. 2003. Regular expression pattern matching—a simpler design. Tech. Rep. 1397, RIMS, Kyoto Univ., Kyoto, Japan.Google ScholarGoogle Scholar
  23. Hosoya, H. 2006. Regular expression filters for XML. J. Funct. Prog. 16, 6, 711--750. (Short version appeared in Proceedings of Programming Language Technologies for XML (PLAN-X), pp.13--27, 2004.) Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Hosoya, H., Frisch, A., and Castagna, G. 2005. Parametric polymorphism for XML. In Proceedings of the 32nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, 50--62. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Hosoya, H. and Murata, M. 2003. Boolean operations and inclusion test for attribute-element constraints. In Proceedings of the 8th International Conference on Implementation and Application of Automata. Lecture Notes in Computer Science, vol. 2759. Springer-Verlag, Berlin, Germany, 201--212. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Hosoya, H. and Pierce, B. C. 2002. Regular expression pattern matching for XML. J. Funct. Prog. 13, 6, 961--1004. (Short version appeared in Proceedings of the 25th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, 2001, pp. 67--80.) Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Hosoya, H. and Pierce, B. C. 2003. XDuce: A typed XML processing language. ACM Trans. Internet Tech. 3, 2, 117--148. (Short version appeared in Proceedings of the 3rd International Workshop on the Web and Databases (WebDB2000), Lecture Notes in Computer Science, vol. 1997. Springer-Verlag, Berlin, Germany, pp. 226--244. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Hosoya, H., Vouillon, J., and Pierce, B. C. 2004. Regular expression types for XML. ACM Trans. Prog. Lang. Syst. 27, 1, 46--90. (Short version appeared in Proceedings of the International Conference on Functional Programming (ICFP), pp. 11--22, 2000.) Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Ishikawa, M. 2002. An XHTML + MathML + SVG Profile. http://www.w3.org/TR/XHTMLplusMathMLplusSVG/xhtml-math-svg.html.Google ScholarGoogle Scholar
  30. Jackson, D., Ferraiolo, J., and Fujisawa, J. 2002. Scalable Vector Graphics (SVG) 1.1 Specification. http://www.w3.org/TR/2002/CR-SVG11-20020430/.Google ScholarGoogle Scholar
  31. Kirkegaard, C. and Møller, A. 2006. XACT - XML transformations in Java. In Proceedings of the Programming Language Technologies for XML (PLAN-X). 87.Google ScholarGoogle Scholar
  32. Leroy, X., Doligez, D., Garrigue, J., Vouillon, J., and Rémy, D. 1996. The Objective Caml system. Software and documentation available on the Web, http://pauillac.inria.fr/ocaml/.Google ScholarGoogle Scholar
  33. Maneth, S., Perst, T., Berlea, A., and Seidl, H. 2005. XML type checking with macro tree transducers. In Proceedings of Symposium on Principles of Database Systems (PODS). ACM, New York, 283--294. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Maneth, S., Perst, T., and Seidl, H. 2007. Exact XML type checking in polynomial time. In Proceedings of the International Conference on Database Theory (ICDT). 254--268. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Meijer, E. and Shields, M. 1999. XMλ: A functional programming language for constructing and manipulating XML documents. Manuscript.Google ScholarGoogle Scholar
  36. Milner, R., Tofte, M., and Harper, R. 1990. The Definition of Standard ML. The MIT Press, Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Milo, T., Suciu, D., and Vianu, V. 2000. Typechecking for XML transformers. In Proceedings of the 19th ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems. ACM, New York, 11--22. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Murata, M. 2001. Extended path expressions for XML. In Proceedings of Symposium on Principles of Database Systems (PODS). ACM, New York, 126--137. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Nottingham, M. and Sayre, R. 2005. The Atom Syndication Format (RFC 4287). ftp://ftp.rfc-editor.org/in-notes/rfc4287.txt.Google ScholarGoogle Scholar
  40. OASIS. 2002. DocBook. http://www.docbook.org.Google ScholarGoogle Scholar
  41. OAS1S. 2007. Open Document Format for Office Applications (OpenDocument). http://www.oasis-open.org/committees/office/.Google ScholarGoogle Scholar
  42. Peyton Jones, S. L., Hall, C. V., Hammond, K., Partain, W., and Wadler, P. 1993. The Glasgow Haskell compiler: a technical overview. In Proceedings of the UK Joint Framework for Information Technology (JFIT) Technical Conference.Google ScholarGoogle Scholar
  43. Python XML Special Interest Group. 1998. The XML bookmark exchange language. http://pyxml.sourceforge.net/topics/xbel/.Google ScholarGoogle Scholar
  44. Reynolds, J. C. 1983. Types, abstraction, and parametric polymorphism. Inf. Proc. 83, 513--523.Google ScholarGoogle Scholar
  45. Shields, M. and Meijer, E. 2001. Type-indexed rows. In Proceedings of the 25th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, 261--275. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Stefénsson, K. 1994. Systems of set constraints with negative constraints are nexptime-complete. In Proceedings of 9th Annual IEEE Symposium on Logic in Computer Science. IEEE Computer Society Press, Los Alamitos, CA, 137--141.Google ScholarGoogle ScholarCross RefCross Ref
  47. Stroustrup, B. 2000. The C++ Programming Language. Addison-Wesley, Reading, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Suda, T. and Hosoya, H. 2005. Non-backtracking top-down algorithm for checking tree automata containment. In Proceedings of Conference on Implementation and Applications of Automata (CIAA). 83--92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Sulzmann, M. and Lu, K. Z. M. 2006a. A type-safe embedding of XDuce into ML. Electric Notes Theoret. Comput. Sci. 148, 2, 239--264. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Sulzmann, M. and Lu, K. Z. M. 2006b. XHaskell. In Proceedings of the Programming Language Technologies for XML (PLAN-X). 92. Demonstration.Google ScholarGoogle Scholar
  51. Tozawa, A. and Hagiya, M. 2003. XML schema containment checking based on semi-implicit techniques. In Proceedings of the 8th International Conference on Implementation and Application of Automata. Lecture Notes in Computer Science, vol. 2759. Springer-Verlag, Berlin, Germany, 213--225. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Vansummeren, S. 2006. Type inference for unique pattern matching. ACM Trans. Prog. Lang. Syst. 28, 3, 389--428. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Vouillon, J. 2006a. Polymorphic regular tree types and patterns. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, 103--114. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Vouillon, J. 2006b. Polymorphism and XDuce-style patterns. In PLAN-X '06, Proceedings of the 4th Workshop on Programming Language Technologies for XML. 49--60.Google ScholarGoogle Scholar
  55. Wallace, M. and Runciman, C. 1999. Haskell and XML: Generic combinators or type-based translation? In Proceedings of the 4th ACM SIGPLAN International Conference on Functional Programming (ICFP'99). ACM, New York, 148--159. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Parametric polymorphism for XML

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM Transactions on Programming Languages and Systems
          ACM Transactions on Programming Languages and Systems  Volume 32, Issue 1
          October 2009
          142 pages
          ISSN:0164-0925
          EISSN:1558-4593
          DOI:10.1145/1596527
          Issue’s Table of Contents

          Copyright © 2009 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 4 November 2009
          • Accepted: 1 March 2009
          • Revised: 1 January 2009
          • Received: 1 June 2008
          Published in toplas Volume 32, Issue 1

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article
          • Research
          • Refereed

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!