Nothing Special   »   [go: up one dir, main page]

skip to main content
research-article

Quotient lenses

Published: 20 September 2008 Publication History

Abstract

There are now a number of BIDIRECTIONAL PROGRAMMING LANGUAGES, where every program can be read both as a forward transformation mapping one data structure to another and as a reverse transformation mapping an edited output back to a correspondingly edited input. Besides parsimony - the two related transformations are described by just one expression - such languages are attractive because they promise strong behavioral laws about how the two transformations fit together - e.g., their composition is the identity function. It has repeatedly been observed, however, that such laws are actually a bit too strong: in practice, we do not want them "on the nose," but only up to some equivalence, allowing inessential details, such as whitespace, to be modified after a round trip. Some bidirectional languages loosen their laws in this way, but only for specific, baked-in equivalences.
In this work, we propose a general theory of QUOTIENT LENSES - bidirectional transformations that are well behaved modulo equivalence relations controlled by the programmer. Semantically, quotient lenses are a natural refinement of LENSES, which we have studied in previous work. At the level of syntax, we present a rich set of constructs for programming with CANONIZERS and for quotienting lenses by canonizers. We track equivalences explicitly, with the type of every quotient lens specifying the equivalences it respects.
We have implemented quotient lenses as a refinement of the bidirectional string processing language Boomerang. We present a number of useful primitive canonizers for strings, and give a simple extension of Boomerang's regular-expression-based type system to statically typecheck quotient lenses. The resulting language is an expressive tool for transforming real-world, ad-hoc data formats. We demonstrate the power of our notation by developing an extended example based on the UniProt genome database format and illustrate the generality of our approach by showing how uses of quotienting in other bidirectional languages can be translated into our notation.

Supplementary Material

JPG File (1411257.jpg)
index.html (index.html)
Slides from the presentation
ZIP File (p383-slides.zip)
Supplemental material for: Quotient lenses
Audio only (1411257.mp3)
Video (1411257.mp4)

References

[1]
Artem Alimarine, Sjaak Smetsers, Arjen van Weelden, Marko van Eekelen, and Rinus Plasmeijer. There and back again: Arrows for invertible programming. In ACM SIGPLAN Workshop on Haskell, pages 86--97, 2005.
[2]
Amos Bairoch, Rolf Apweiler, Cathy H. Wu, Winona C. Barker, Brigitte Boeckmann, Serenella Ferro, Elisabeth Gasteiger, Hongzhan Huang, Rodrigo Lopez, Michele Magrane, Maria J. Martin, Darren A. Natale, Claire O'Donovan, Nicole Redaschi, and Lai. The Universal Protein Resource (UniProt). Nucleic Acids Research, 33 (Database issue):D154--9, January 2005.
[3]
François Bancilhon and Nicolas Spyratos. Update semantics of relational views. ACM Transactions on Database Systems, 6(4):557--575, December 1981.
[4]
Nick Benton. Embedded interpreters. Journal of Functional Programming, 15(4):503--542, 2005.
[5]
Pablo Berdaguer, Alcino Cunha, Hugo Pacheco, and Joost Visser. Coupled schema transformation and data conversion for XML and SQL. In International Symposium on Practical Aspects of Declarative Languages (PADL), Nice France, volume 4354, pages 290--304, 2007.
[6]
Meera Blattner. Single-valued a-transducers. Journal of Computer and System Sciences, 15(3):310--327, 1977.
[7]
Aaron Bohannon, Jeffrey A. Vaughan, and Benjamin C. Pierce. Relational lenses: A language for updateable views. In Principles of Database Systems (PODS), 2006. Extended version available as University of Pennsylvania technical report MS-CIS-05-27.
[8]
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, California, January 2008.
[9]
Claus Brabrand, Anders Møller, and Michael I. Schwartzbach. Dual syntax for XML languages. Information Systems, 2007. To appear. Extended abstract in Database Programming Languages (DBPL) 2005.
[10]
A. Cunha, J. N. Oliveira, and J. Visser. Type-safe two-level data transformation. European Symposium on Formal Methods, 4085:284--299.
[11]
Umeshwar Dayal and Philip A. Bernstein. On the correct translation of update operations on relational views. TODS, 7(3):381--416, September 1982.
[12]
David T. Eger. Bit level types, 2005. Manuscript. Available from http://www.yak.net/random/blt/blt-drafts/03/blt.pdf.
[13]
Sander Evers, Peter Achten, and Rinus Plasmeijer. Disjoint forms in graphical user interfaces. In Trends in Functional Programming, volume 5, pages 113--128. Intellect, 2006. ISBN 1-84150-144-1.
[14]
Kathleen Fisher and Robert Gruber. PADS: a domain-specific language for processing ad hoc data. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Chicago, IL, pages 295--304, 2005.
[15]
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):669--689, June 2007a. Extended abstract in Database Programming Languages (DBPL) 2005.
[16]
J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. Combinators for bi-directional tree transformations: A linguistic approach to the view update problem. ACM Transactions on Programming Languages and Systems, 29(3):17, May 2007b. Extended abstract in Principles of Programming Languages (POPL), 2005.
[17]
J. Nathan Foster, Benjamin C. Pierce, and Alexandre Pilkiewicz. Quotient lenses. Technical Report MS-CIS-08-08, Dept. of CIS University of Pennsylvania, 2008.
[18]
Michael Greenberg and Shriram Krishnamurthi. Declarative Composable Views, 2007. Undergraduate Honors Thesis. Department of Computer Science, Brown University.
[19]
Stephen J. Hegner. Foundations of canonical update support for closed database views. In International Conference on Database Theory (ICDT), Paris, France, pages 422--436, New York, NY, USA, 1990. Springer-Verlag New York, Inc. ISBN 0-387-53507-1. URL http://www.cs.umu.se/hegner/Publications/PDF/icdt90.pdf.
[20]
Zhenjiang Hu, Shin-Cheng Mu, and Masato Takeichi. A programmable editor for developing structured documents based on bi-directional transformations. In Partial Evaluation and Program Manipulation (PEPM), pages 178--189, 2004. Extended version to appear in Higher Order and Symbolic Computation, 2008.
[21]
Shinya Kawanaka and Haruo Hosoya. bixid: a bidirectional transformation language for XML. In ACM SIGPLAN International Conference on Functional Programming (ICFP), Portland, Oregon, pages 201--214, 2006.
[22]
Andrew J. Kennedy. Functional pearl: Pickler combinators. Journal of Functional Programming, 14(6):727--739, 2004.
[23]
Dongxi Liu, Zhenjiang Hu, and Masato Takeichi. Bidirectional interpretation of xquery. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM), Nice, France, pages 21--30, New York, NY, USA, 2007.
[24]
David Lutterkort. Augeas: A Linux configuration API, February 2007. Available from http://augeas.net/.
[25]
K. Matsuda, Z. Hu, K. Nakano, M. Hamana, and M. Takeichi. Bidirectionalization transformation based on automatic derivation of view complement functions. In ACM SIGPLAN International Conference on Functional Programming (ICFP), volume 42, pages 47--58. ACM Press New York, NY, USA, 2007.
[26]
Lambert Meertens. Designing constraint maintainers for user interaction, 1998. Manuscript.
[27]
Renée J. Miller, Mauricio, A. Hernandez, Laura M. Haas, Lingling Yan, C. T. Howard Ho, Ronald Fagin, and Lucian Popa. The clio project: Managing heterogeneity. 30(1):78--83, March 2001. URL citeseer.nj.nec.com/miller01clio.html.
[28]
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.
[29]
Shin-Cheng Mu, Zhenjiang Hu, and Masato Takeichi. Bidirectionalizing tree transformation languages: A case study. JSSST Computer Software, 23(2): 129--141, 2006.
[30]
Norman Ramsey. Embedding an interpreted language using higher-order functions and types. In ACM SIGPLAN Workshop on Interpreters, Virtual Machines and Emulators (IVME), San Diego, CA, pages 6--14, 2003.
[31]
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. ISBN 978-3-540-75208-0.
[32]
Yingfei Xiong, Dongxi Liu, Zhenjiang Hu, Haiyan Zhao, Masato Takeichi, and Hong Mei. Towards automatic model synchronization from model transformations. In IEEE/ACM International Conference on Automated Software Engineering (ASE), Atlanta, Georgia, pages 164--173, 2007.

Cited By

View all
  • (2023)Exploring the mechanism of empathy on lens language and linguistic landscape on movie-induced tourism: The moderating effect of cultural differencesFrontiers in Psychology10.3389/fpsyg.2023.110932814Online publication date: 2-Feb-2023
  • (2020)Blockchain-based Bidirectional Transformations for Access Control and Data Sharing in EMRsProceedings of the 12th Asia-Pacific Symposium on Internetware10.1145/3457913.3457915(71-80)Online publication date: 1-Nov-2020
  • (2020)Applying Bidirectional Transformations to the Design of Interoperable EMR SystemsJournal of Healthcare Informatics Research10.1007/s41666-019-00065-0Online publication date: 22-Jan-2020
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 43, Issue 9
ICFP '08
September 2008
399 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/1411203
Issue’s Table of Contents
  • cover image ACM Conferences
    ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programming
    September 2008
    422 pages
    ISBN:9781595939197
    DOI:10.1145/1411204
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: 20 September 2008
Published in SIGPLAN Volume 43, Issue 9

Check for updates

Author Tags

  1. bidirectional languages
  2. bijective languages
  3. boomerang
  4. canonizers
  5. equivalences
  6. lenses
  7. regular string transducers
  8. regular types
  9. view update problem

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)17
  • Downloads (Last 6 weeks)1
Reflects downloads up to 20 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023)Exploring the mechanism of empathy on lens language and linguistic landscape on movie-induced tourism: The moderating effect of cultural differencesFrontiers in Psychology10.3389/fpsyg.2023.110932814Online publication date: 2-Feb-2023
  • (2020)Blockchain-based Bidirectional Transformations for Access Control and Data Sharing in EMRsProceedings of the 12th Asia-Pacific Symposium on Internetware10.1145/3457913.3457915(71-80)Online publication date: 1-Nov-2020
  • (2020)Applying Bidirectional Transformations to the Design of Interoperable EMR SystemsJournal of Healthcare Informatics Research10.1007/s41666-019-00065-0Online publication date: 22-Jan-2020
  • (2019)Consistency management via a combination of triple graph grammars and linear programmingProceedings of the 12th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3357766.3359544(29-41)Online publication date: 20-Oct-2019
  • (2019)Synthesizing symmetric lensesProceedings of the ACM on Programming Languages10.1145/33416993:ICFP(1-28)Online publication date: 26-Jul-2019
  • (2018)Synthesizing quotient lensesProceedings of the ACM on Programming Languages10.1145/32367752:ICFP(1-29)Online publication date: 30-Jul-2018
  • (2018)Testing models and model transformations using classifying termsSoftware and Systems Modeling (SoSyM)10.1007/s10270-016-0568-317:3(885-912)Online publication date: 1-Jul-2018
  • (2018)FliPpr: A System for Deriving Parsers from Pretty-PrintersNew Generation Computing10.1007/s00354-018-0033-736:3(173-202)Online publication date: 27-Aug-2018
  • (2016)Reusable self-adaptation through bidirectional programmingProceedings of the 11th International Symposium on Software Engineering for Adaptive and Self-Managing Systems10.1145/2897053.2897055(4-15)Online publication date: 14-May-2016
  • (2012)Relations as executable specificationsProceedings of the 13th international conference on Relational and Algebraic Methods in Computer Science10.1007/978-3-642-33314-9_10(146-161)Online publication date: 17-Sep-2012
  • Show More Cited By

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