|
@@ -3,36 +3,46 @@ include "object_operations.alh"
|
|
|
include "modelling.alh"
|
|
|
include "metamodels.alh"
|
|
|
|
|
|
-Element function create_transformation_language(root : Element, source : String, target : String):
|
|
|
+Element function create_outplace_transformation_language(source : Element, target : Element):
|
|
|
+ log("Create outplace model!")
|
|
|
Element ramified
|
|
|
Element fused
|
|
|
Element tagged_model
|
|
|
Element model_list
|
|
|
|
|
|
- if (source == target):
|
|
|
- // in-place transformation, so no need to alter meta-model any further
|
|
|
- ramified = ramify(root[source])
|
|
|
- else:
|
|
|
- // out-place transformation, so modify meta-model a bit and add further information
|
|
|
- model_list = create_node()
|
|
|
- tagged_model = create_node()
|
|
|
- list_append(tagged_model, source)
|
|
|
- list_append(tagged_model, root[source])
|
|
|
- list_append(model_list, tagged_model)
|
|
|
- tagged_model = create_node()
|
|
|
- list_append(tagged_model, target)
|
|
|
- list_append(tagged_model, root[target])
|
|
|
- list_append(model_list, tagged_model)
|
|
|
-
|
|
|
- fused = model_fuse(model_list)
|
|
|
- ramified = ramify(fused)
|
|
|
+ // out-place transformation, so modify meta-model a bit and add further information
|
|
|
+ model_list = create_node()
|
|
|
+ tagged_model = create_node()
|
|
|
+ list_append(tagged_model, "SOURCE")
|
|
|
+ list_append(tagged_model, source)
|
|
|
+ list_append(model_list, tagged_model)
|
|
|
+ tagged_model = create_node()
|
|
|
+ list_append(tagged_model, "TARGET")
|
|
|
+ list_append(tagged_model, target)
|
|
|
+ list_append(model_list, tagged_model)
|
|
|
+
|
|
|
+ fused = model_fuse(model_list)
|
|
|
+ ramified = ramify(fused)
|
|
|
|
|
|
// Augment with information about the source and target
|
|
|
+ dict_add(ramified, "inplace", False)
|
|
|
dict_add(ramified, "source", source)
|
|
|
dict_add(ramified, "target", target)
|
|
|
|
|
|
return ramified!
|
|
|
|
|
|
+Element function create_inplace_transformation_language(model : Element):
|
|
|
+ log("Create inplace model!")
|
|
|
+ Element ramified
|
|
|
+
|
|
|
+ ramified = ramify(model)
|
|
|
+
|
|
|
+ dict_add(ramified, "inplace", True)
|
|
|
+ dict_add(ramified, "source", model)
|
|
|
+ dict_add(ramified, "target", model)
|
|
|
+
|
|
|
+ return ramified!
|
|
|
+
|
|
|
Element function ramify(model : Element):
|
|
|
// Create new model structure
|
|
|
Element new_model
|