A Language for Bi-Directional Tree Transformations

We present a semantic foundation and a collection of program combinators for bi-directional transformations on tree-structured data. In one direction, these transformations map a “concrete” tree into a simplified “abstract” one; in the other, they map a modified abstract tree, together with the original concrete tree, to a correspondingly modified concrete tree. The challenge of understanding and designing these transformations—called lenses—arises from their asymmetric nature: information is discarded when mapping from concrete to abstract, and must be restored on the way back. We identify a natural mathematical space of well-behaved lenses, in which the two components are constrained to fit together in a sensible way. We study definedness and continuity in this setting and state a precise connection with the classical theory of “update translation under a constant complement” from databases. We then instantiate our semantic framework in the form of a collection of lens combinators that can be assembled to describe powerful transformations on trees and whose well-behavedness follows from simple, local checks. These combinators include familiar constructs from functional programming (composition, mapping, projection, recursion) together with some novel primitives for manipulating trees (splitting, pruning, pivoting, etc.). An extended example shows how our combinators can be used to define a lens that translates between a native HTML representation of browser bookmarks and a generic

[1]  Shôichirô Sakai On type *-algebras , 1967 .

[2]  Lawrence A. Rowe,et al.  Data abstraction, views and updates in RIGEL , 1979, SIGMOD '79.

[3]  Nicolas Spyratos,et al.  Update semantics of relational views , 1981, TODS.

[4]  Umeshwar Dayal,et al.  On the correct translation of update operations on relational views , 1982, TODS.

[5]  Frank J. Oles,et al.  Type Algebras, Functor Categories, and Block Structure , 1986 .

[6]  S. Cosmadakis TRANSLATING UPDATES OF RELATIONAL DATA BASE VIEWS , 1983 .

[7]  Christos H. Papadimitriou,et al.  Updates of Relational Views , 1984, JACM.

[8]  Yoshifumi Masunaga,et al.  A Relational Database View Update Translation Mechanism , 1984, VLDB.

[9]  Arthur M. Keller,et al.  Algorithms for translating view updates to database updates for views involving selections, projections, and joins , 1985, PODS.

[10]  Arthur M. Keller,et al.  Choosing a View Update Translator by Dialog at View Definition Time , 1986, VLDB.

[11]  Philip Wadler,et al.  Views: a way for pattern matching to cohabit with data abstraction , 1987, POPL '87.

[12]  Georg Gottlob,et al.  Properties and update semantics of consistent views , 1988, TODS.

[13]  Gio Wiederhold,et al.  Updating relational databases through object-based views , 1991, SIGMOD '91.

[14]  Markus Tresch,et al.  Updatable Views in Object-Oriented Databases , 1991, DOOD.

[15]  Glynn Winskel,et al.  The formal semantics of programming languages - an introduction , 1993, Foundation of computing series.

[16]  Joachim Niehren,et al.  Feature Automata and Recognizable Sets of Feature Trees , 1993, TAPSOFT.

[17]  Keishi Tajima,et al.  A polymorphic calculus for views and object sharing (extended abstract) , 1994, PODS '94.

[18]  Chuck Allison Data abstraction , 1995 .

[19]  Paolo Atzeni,et al.  Management of Multiple Models in an Extensible Database Design Tool , 1996, EDBT.

[20]  Martin Hofmann,et al.  Positive Subtyping , 1996, Inf. Comput..

[21]  Serge Abiteboul,et al.  Correspondence and Translation for Heterogeneous Data , 1997, ICDT.

[22]  Paolo Atzeni,et al.  MDM: a multiple-data model tool for the management of heterogeneous database schemes , 1997, SIGMOD '97.

[23]  Serge Abiteboul,et al.  Incremental Maintenance for Materialized Views over Semistructured Data , 1998, VLDB.

[24]  Serge Abiteboul,et al.  A logical view of structured files , 1998, The VLDB Journal.

[25]  Tova Milo,et al.  Using Schema Matching to Simplify Heterogeneous Data Translation , 1998, VLDB.

[26]  Erhard Rahm,et al.  A survey of approaches to automatic schema matching , 2001, The VLDB Journal.

[27]  Vanessa Braganholo,et al.  UPDATING RELATIONAL DATABASES THROUGH XML VIEWS , 2001 .

[28]  Benjamin C. Pierce,et al.  Unison: A File Synchronizer and Its Specification , 2001, TACS.

[29]  Alon Y. Halevy,et al.  Updating XML , 2001, SIGMOD '01.

[30]  Laura M. Haas,et al.  The Clio project: managing heterogeneity , 2001, SGMD.

[31]  Sanjeev Khanna,et al.  Edinburgh Research Explorer On the Propagation of Deletions and Annotations through Views , 2013 .

[32]  Pedro M. Domingos,et al.  Learning to map between structured representations of data , 2002 .

[33]  Benjamin C. Pierce,et al.  A Language for Bi-Directional Tree Transformations ( Working Draft of Full Version ) , 2003 .

[34]  Jens Lechtenbörger,et al.  The impact of the constant complement approach towards view updating , 2003, PODS.

[35]  Benjamin Pierce,et al.  Lenses and View Update Translation , 2003 .

[36]  Susan B. Davidson,et al.  On the updatability of XML views over relational databases , 2003, WebDB.

[37]  Benjamin C. Pierce,et al.  What's in Unison? A Formal Specification and Reference Implementation of a File Synchronizer , 2004 .

[38]  Frank Wm. Tompa,et al.  Understanding the implications of view update policies , 1985, Algorithmica.

[39]  Takayuki Tomaru,et al.  The CLIO project , 2006 .