20.09.2015 Views

Spreadsheet notoriously

Bidirectional Transformation of Model-Driven Spreadsheets⋆ - ALFA

Bidirectional Transformation of Model-Driven Spreadsheets⋆ - ALFA

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12<br />

to (replicate M cn dir n inst) = replicate D dir cn n inst<br />

to (addClass M cn p 1 p 2 ) = ∅<br />

to (addClassExp M cn dir p 1 p 2 ) = ∅<br />

The first five model operations have a direct data transformation, that is, a<br />

transformation with the same name which does the analogous operation. An interesting<br />

transformation is perfomed by replicate M : it duplicates a given class,<br />

but not the data. Instead, a new empty instance is added to the newly created<br />

class. Another interesting case is the transformation of the model operation<br />

addClass M . This model transformation does not have any impact on data instances.<br />

Thus, to returns an empty set of data transformations. In fact, the same<br />

happens with the addClassExp M operation.<br />

We now present the from transformation, which maps data operations into<br />

model operations:<br />

from : Op D → Op ⋆ M<br />

from (addColumn D w i) =<br />

replicate M className Horizontal classInstances instanceIndex M<br />

; addColumn M w columnOffsetIndex M<br />

from (delColumn D i) =<br />

replicate M className Horizontal classInstances instanceIndex M<br />

; delColumn M columnOffsetIndex M<br />

from (addRow D w i) =<br />

replicate M className Vertical classInstances rowIndex M<br />

; addRow M w rowOffsetIndex M<br />

from (delRow D i) =<br />

replicate M className Vertical classInstances rowIndex M<br />

; delRow M rowOffsetIndex M<br />

from (setLabel D (i, j ) l) =<br />

replicate M className Horizontal classInstances columnIndex M<br />

; replicate M className Vertical classInstances rowIndex M<br />

; setLabel M positionOffset M l<br />

from (setV alue D (i, j ) l ) = ∅<br />

from (addInstance D cn dir m) = ∅<br />

The transformations in this case are more complex than the model-to-data ones.<br />

In fact, most of them produce a sequence of model operations. For instance, the<br />

first transformation (addColumn D ) results in the replication of a class followed<br />

by the addition of a new column. The argument classInstances is actually a<br />

function that calculates the number of data class instances based on the data to<br />

be evolved. On the other hand, the operation to set a value of a particular cell,<br />

setV alue D , does not have any impact on the model. The same happens to the<br />

operation addInstance D which adds a new instance of an expandable class. The<br />

definition of from for the (non-empty) data operations in the range of to (e.g.,<br />

AddColumn D , DelRow D ) is simply the inverse of to.<br />

4.5 Bidirectional Transformation Properties<br />

Since the aim of our bidirectional transformations is to restore the conformity<br />

between instances and models, a basic requirement is that they satisfy correct-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!