skip to main content
research-article

Matching lenses: alignment and view update

Published:27 September 2010Publication History
Skip Abstract Section

Abstract

Bidirectional programming languages are a practical approach to the view update problem. Programs in these languages, called lenses, define both a view and an update policy - i.e., every program can be read as a function mapping sources to views as well as one mapping updated views back to updated sources.

One thorny issue that has not received sufficient attention in the design of bidirectional languages is alignment. In general, to correctly propagate an update to a view, a lens needs to match up the pieces of the view with the corresponding pieces of the underlying source, even after data has been inserted, deleted, or reordered. However, existing bidirectional languages either support only simple strategies that fail on many examples of practical interest, or else propose specific strategies that are baked deeply into the underlying theory.

We propose a general framework of matching lenses that parameterizes lenses over arbitrary heuristics for calculating alignments. We enrich the types of lenses with "chunks" identifying reorderable pieces of the source and view that should be re-aligned after an update, and we formulate behavioral laws that capture essential constraints on the handling of chunks. We develop a core language of matching lenses for strings, together with a set of "alignment combinators" that implement a variety of alignment strategies.

Skip Supplemental Material Section

Supplemental Material

icfp-tues-1425-cretin.mov

mov

95.4 MB

References

  1. }}François Bancilhon and Nicolas Spyratos. Update semantics of relational views. ACM Transactions on Database Systems, 6(4):557--575, December 1981. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}Jean Berstel, Dominique Perrin, and Christophe Reutenauer. Codes and Automata. Cambridge University Press, 2009.Google ScholarGoogle ScholarCross RefCross Ref
  3. }}Aaron Bohannon, J. Nathan Foster, Benjamin C. Pierce, Alexandre Pilkiewicz, and Alan Schmitt. Boomerang: Resourceful lenses for string data. In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), San Francisco, CA, pages 407--419, January 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. }}Aaron Bohannon, Jeffrey A. Vaughan, and Benjamin C. Pierce. Relational lenses: A language for updateable views. In ACM SIGACT-SIGMOD-SIGART Symposium on Principles of Database Systems (PODS), Chicago, TL, 2006. Extended version available as University of Pennsylvania technical report MS-CIS-05-27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. }}Krzysztof Czarnecki, J. Nathan Foster, Zhenjiang Hu, Ralf Lämmel, Andy Schürr, and James F. Terwilliger. Bidirectional transformations: A cross-discipline perspective. In ICMT '09: Proceedings of the 2nd International Conference on Theory and Practice of Model Transformations, pages 260--283, Berlin, Heidelberg. 2009. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}Umeshwar Dayal and Philip A. Bernstein. On the correct translation of update operations on relational views. ACM Transactions on Database Systems, 7(3):381--416, September 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}Zinovy Diskin. Algebraic models for bidirectional model synchronization. In International Conference on Model Driven Engineering Languages and Systems (MoDELS), Toulouse, France, pages 21--36, September 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}Zinovy Diskin, Yingfei Xiong, and Krzysztof Czarnecki. From state- to delta-based bidirectional model transformations. In Laurence Tratt and Martin Gogolla, editors, ICMT, volume 6142 of Lecture Notes in Computer Science, pages 61--76. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. }}J. Nathan Foster, Michael B. Greenwald, Christian Kirkegaard, Benjamin C. Pierce, and Alan Schmitt. Exploiting schemas in data synchronization. Journal of Computer and System Sciences, 73(4), June 2007. Short version in DBPL '05. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. Combinators for bidirectional tree transformations: A linguistic approach to the view update problem. ACM Transactions on Programming Languages and Systems, 29(3), May 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}J. Nathan Foster and Benjamin C. Pierce. Boomerang Programmer's Manual, 2009. Available from http://www.seas.upenn.edu/~harmony/.Google ScholarGoogle Scholar
  12. }}J. Nathan Foster, Benjamin C. Pierce, and Steve Zdancewic. Updatable security views. In IEEE Computer Security Foundations Symposium (CSF), Port Jefferson, NY, pages 60--74, July 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. }}J. Nathan Foster, Alexandre Pilkiewcz, and Benjamin C. Pierce. Quotient lenses. In ACM SIGPLAN International Conference on Functional Programming (ICFP), Victoria, BC, pages 383--395, September 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}G. Gottlob, P. Paolini, and R. Zicari. Properties and update semantics of consistent views. ACM Transactions on Database Systems (TODS), 13(4):486--524, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}Zhenjiang Hu, Shin-Cheng Mu, and Masato Takeichi. A programmable editor for developing structured documents based on bi-directional transformations. Higher-Order and Symbolic Computation, 21(1-2), June, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}C. Barry Jay and J. Robin B. Cockett. Shapely types and shape polymorphism. In Proceedings of the European Symposium on Programming (ESOP), London, UK, pages 302--316, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. }}Arthur M. Keller. Algorithms for translating view updates to database updates for views involving selections, projections, and joins. In Proceedings of Fourth Annual ACM Symposium on Principles of Database Systems (PODS), pages 154--163, march 1985. Portland, Oregon. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. }}David Lutterkort. Augeas-A configuration API. In Linux Symposium, Ottawa, ON, pages 47--56, 2008.Google ScholarGoogle Scholar
  19. }}Kazutaka Matsuda, Zhenjiang Hu, Keisuke Nakano, Makoto Hamana, and Masato Takeichi. Bidirectionalization transformation based on automatic derivation of view complement functions. In ACM SIGPLAN International Conference on Functional Programming (ICFP), Freiburg, Germany, pages 47--58, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}Lambert Meertens. Designing constraint maintainers for user interaction, 1998. Manuscript, available from ftp://ftp.kestrel.edu/pub/papers/meertens/dcm.ps.Google ScholarGoogle Scholar
  21. }}Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. An algebraic approach to bi-directional updating. In ASIAN Symposium on Programming Languages and Systems (APLAS), pages 2--20, November 2004.Google ScholarGoogle ScholarCross RefCross Ref
  22. }}Hugo Pacheco and Alcino Cunha. Generic point-free lenses. In International Conference on Mathematics of Program Construction (MPC), Québec City, QC, 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}Perdita Stevens. Bidirectional model transformations in QVT: Semantic issues and open questions. In International Conference on Model Driven Engineering Languages and Systems (MoDELS), Nashville, TN, volume 4735 of Lecture Notes in Computer Science, pages 1--15. Springer-Verlag, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. }}Janis Voigtländer. Bidirectionalization for free! In ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), Savannah, GA, pages 165--176, January 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. }}Meng Wang, Jeremy Gibbons, Kazutaka Matsuda, and Zhenjiang Hu. Gradual refinement: Blending pattern matching with data abstraction. In International Conference on Mathematics of Program Construction (MPC), Québec City, QC, 2010. To appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. }}Y. Xiong, Z. Hu, H. Zhao, H. Song, M. Takeichi, and H. Mei. Supporting automatic model inconsistency fixing. In ACM SIGSOFT Symposium on the Foundations of Software Engineering (FSE), Amsterdam, Netherlands, pages 315--324. 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Matching lenses: alignment and view update

    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 SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 45, Issue 9
      ICFP '10
      September 2010
      382 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1932681
      Issue’s Table of Contents
      • cover image ACM Conferences
        ICFP '10: Proceedings of the 15th ACM SIGPLAN international conference on Functional programming
        September 2010
        398 pages
        ISBN:9781605587943
        DOI:10.1145/1863543

      Copyright © 2010 ACM

      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 ACM 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]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 27 September 2010

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    ePub

    View this article in ePub.

    View ePub