General (#1) - Newbie question on QVT (#11) - Message List

Newbie question on QVT


I am totally new to this QVT stuff and I am having some trouble with it... however i think my task is quite simple. My transformation only needs to change an integer in one class in my model. That is I have a Cell with an int iCellValue. I need for this iCellValue to change, e.g. if iCellValue = 1 then i want to change it to 5 or whatever. My extremely simple code looks like this:

transformation valueTransformation(source : newstructure, target: newstructure){
  top relation change1to2 {
    value: Integer;
    checkonly domain source newstructure:Cell { iCellValue = 3 };
    enforce domain target newstructure:Cell { iCellValue = 1 };


This only results in the Cell with iCellValue = 3 being deleted. Probably not surprising to you guys though.. haha! If i write 'value' instead of 3, all iCellValues are set to 1. So at least something got transformed...

Well, any pointers?

Thanks :)e...

  • Message #23

    I think I figured it out :)

    • Message #24

      To give the solution of the mystery to everyone:

      You took the variable name "newstructure" for both domains (source and target). Thus, the same Cell instance is used in the source and target. Means the instance is moved from the source model into the target model, whereas the the Cells property "iCellValue" is changed to 1.

      This is a very enhances feature ;-) You can use this for inplace transformation of the same model! To enable this feature, you will not specify an output model. Means the result will be stored in the source model.


No attachments created.