View
215
Download
0
Category
Preview:
Citation preview
A Programmable Editor forDeveloping Structured Documents based on
Bidirectional Transformations
Zhenjiang Hu, Shin-Cheng Mu, Masato Takeichi
University of Tokyo
Structured Documents
IPL Address Book
Zhenjiang Hu: Assoc. Prof. Shin-Cheng Mu: Post Doc Masato Takeichi: Prof.
Names
Zhenjiang Hu: hu@mist … Shin-Cheng Mu: scm@ipl … Masato Takeichi: takeichi@ …
Addresses
XML<addressBook> <person> <name> Zhenjiang Hu </name> …. </person> <person> … </person></addressBook>
DTD XSLT
Document Engineering
XML<addressBook> <person> <name> Zhenjiang Hu </name> …. </person> <person> … </person></addressBook>
DTD XSLT
Redesign &Refinement
Like software development …
Editors Supporting Development of Structured Documents
http://www.xmlsoftware.com/editors.html
• XML Spy (Altova)
• Xdoc (Microsoft)
• IBM Visual XML Creator (IBM)
• Ark II (JustSYSTEM)
• Proxima (Utrecht)and many …
Can we develop structured documents in a WYSIWYG
manner? IPL Address Book
Zhenjiang Hu: Assoc. Prof. Shin-Cheng Mu: Post Doc Masato Takeichi: Prof.
Names
Zhenjiang Hu: hu@mist … Shin-Cheng Mu: scm@ipl … Masato Takeichi: takeichi@ …
Addresses
Redesign &Refinement
XML, DTD, XSLT
Derive
Transformation
Internal Representation IPL Address Book
Zhenjiang Hu: Assoc. Prof. Shin-Cheng Mu: Post Doc Masato Takeichi: Prof.
Names
Zhenjiang Hu: hu@mist Shin-Cheng Mu: scm@ipl Masato Takeichi: takeichi@
Addresses
Zhenjiang Hu:Position: Asso. Prof.Email: hu@mist.Tel:03-5841-7411Address: 7-3-1 Hongo, Bunkyo Tokyo 113, JapanWWW: www.ipl.t.u-tokyo.ac.jp
Masato TakeichiPosition: Prof.Email: takeichi@mist.Tel: 03-5841-7430…
Display
Transformation
IPL Address Book
ZHENJIANG HU: Assoc. Prof. Shin-Cheng Mu: Post Doc Masato Takeichi: Prof.
Names
Zhenjiang Hu: hu@mist Shin-Cheng Mu: scm@ipl Masato Takeichi: takeichi@
Addresses
Zhenjiang Hu:Position: Asso. Prof.Email: hu@mist.Tel:03-5841-7411Address: 7-3-1 Hongo, Bunkyo Tokyo 113, JapanWWW: www.ipl.t.u-tokyo.ac.jp
Masato TakeichiPosition: Prof.Email: takeichi@mist.Tel: 03-5841-7430…
DisplayInternal Representation
Transformation
IPL Address Book
ZHENJIANG HU: Assoc. Prof. Shin-Cheng Mu: Post Doc Masato Takeichi: Prof.
Names
ZHENJIANG HU: hu@mist Shin-Cheng Mu: scm@ipl Masato Takeichi: takeichi@
Addresses
ZHENJIANG HU:Position: Asso. Prof.Email: hu@mist.Tel:03-5841-7411Address: 7-3-1 Hongo, Bunkyo Tokyo 113, JapanWWW: www.ipl.t.u-tokyo.ac.jp
Masato TakeichiPosition: Prof.Email: takeichi@mist.Tel: 03-5841-7430…
DisplayInternal Representation
Transformation
IPL Address Book
ZHENJIANG HU: Assoc. Prof. Shin-Cheng Mu: Post Doc Masato Takeichi: Prof.
Names
ZHENJIANG HU: hu@mist Shin-Cheng Mu: scm@ipl Masato Takeichi: takeichi@
Addresses
ZHENJIANG HU:Position: Asso. Prof.Email: hu@mist.Tel:03-5841-7411Address: 7-3-1 Hongo, Bunkyo Tokyo 113, JapanWWW: www.ipl.t.u-tokyo.ac.jp…Masato TakeichiPosition: Prof.Email: takeichi@mist.Tel: 03-5841-7430…
DisplayInternal Representation
3
3
Source View
editingX
Two issues of concern:-- How to update the source when the view is changed?-- A formal model of the editor?
The Rest of the Talk
The Rest of the Talk
• Introducing X, the language we use to code XML transformation– allowing duplication– supporting recursive tree traversals
• Overview of the editor– editing data as well as transformation– allowing data dependency and derived
values
The Bidirectional Transformation Language
X
An extension of the lens language by Greenwald et al With dup, if and fold. [Ref: PLANX2004]
CView AView
View ::= N String [View]
Semantics
satisfying 2 laws:
GET:PUT:
With each construct x come 2 functions:
Basic Transformations
CView AView
f
g
CView AViewf
Sequential Combinator
CView AView Aview’
x1 x2
Product
Duplication
Map and Fold
Derived Transformation idX and constX
constX f = NFun f
Derived Transformation exchangeX
a
b
b
a
exX
Derived Transformation: hoistX
m
hoistX m
Hole Manipulation
Bidirectionality
There are two ways to insert a new subtree:
Coding Editing Operators in X
Source View
editingX
The Editor State
The state of the editor is a triple:
satisfying the following SNYC property:
Actions the User Can Do
remembersdependency
introducetransformation
General Editing Operators
InsertE p v (c,x,a) = Aa(c,x,insert p v a)
DeleteE p v (c,x,a) = Aa(c,x,delete p v a)
MoveE p1 p2 (c,x,a) = Aa(c,x,move p1 p2 a)
FieldEdit p v (c,x,a) = Aa(c,x,fieldEdit p v a)
Special Editing Operators
DuplicateE p (c,x,a) = A
cx (c, (x ; applyX p Dup), a)
TransformE p x’ (c,x,a) = A
cx (c, (x ; apply p x’), a)
Conclusion
• We proposed a new transformation language with the following features.– It is bidirectional.– It supports duplication and recursive
transformation.
• We applied the language to the design of a new editor for developing structured documents:– Data dependency and local synchronization– Derived values– Efficient implementation of infinite undos
Recommended