|
@@ -111,12 +111,9 @@ Element function get_possible_bindings(host_model : Element, LHS_model : Element
|
|
else:
|
|
else:
|
|
// Check local constraints and add only if positive
|
|
// Check local constraints and add only if positive
|
|
Element constraint_function
|
|
Element constraint_function
|
|
- log("Finding constraint")
|
|
|
|
constraint_function = read_attribute(LHS_model, current_element, "constraint")
|
|
constraint_function = read_attribute(LHS_model, current_element, "constraint")
|
|
Boolean result
|
|
Boolean result
|
|
- log("Executing constraint")
|
|
|
|
result = constraint_function(host_model, option)
|
|
result = constraint_function(host_model, option)
|
|
- log("Executed constraint")
|
|
|
|
if (result):
|
|
if (result):
|
|
set_add(filtered_options, option)
|
|
set_add(filtered_options, option)
|
|
|
|
|
|
@@ -255,13 +252,10 @@ Void function rewrite(host_model : Element, RHS_model : Element, mapping : Eleme
|
|
dict_add(new_mapping, label, new_name)
|
|
dict_add(new_mapping, label, new_name)
|
|
|
|
|
|
while (read_nr_out(original_RHS_labels) > 0):
|
|
while (read_nr_out(original_RHS_labels) > 0):
|
|
- log("Checking whether actions must be executed!")
|
|
|
|
label = set_pop(original_RHS_labels)
|
|
label = set_pop(original_RHS_labels)
|
|
- log("Checking for actions!")
|
|
|
|
action = read_attribute(RHS_model, RHS_map[label], "action")
|
|
action = read_attribute(RHS_model, RHS_map[label], "action")
|
|
if (element_neq(action, read_root())):
|
|
if (element_neq(action, read_root())):
|
|
action(host_model, new_mapping[label], mapping)
|
|
action(host_model, new_mapping[label], mapping)
|
|
- log("DONE")
|
|
|
|
|
|
|
|
while (read_nr_out(labels_to_remove) > 0):
|
|
while (read_nr_out(labels_to_remove) > 0):
|
|
// Remove the elements linked to these labels
|
|
// Remove the elements linked to these labels
|
|
@@ -275,7 +269,6 @@ Void function rewrite(host_model : Element, RHS_model : Element, mapping : Eleme
|
|
RHS = set_pop(RHS)
|
|
RHS = set_pop(RHS)
|
|
action = read_attribute(RHS_model, RHS, "action")
|
|
action = read_attribute(RHS_model, RHS, "action")
|
|
if (element_neq(action, read_root())):
|
|
if (element_neq(action, read_root())):
|
|
- log("Executing global action")
|
|
|
|
action(host_model, new_mapping)
|
|
action(host_model, new_mapping)
|
|
|
|
|
|
return!
|
|
return!
|
|
@@ -286,13 +279,11 @@ Void function transform(host_model : Element, LHS_model : Element, RHS_model : E
|
|
|
|
|
|
// Get all possible mappings
|
|
// Get all possible mappings
|
|
mappings = match(host_model, LHS_model)
|
|
mappings = match(host_model, LHS_model)
|
|
- log("Found total mappings: " + cast_v2s(read_nr_out(mappings)))
|
|
|
|
|
|
|
|
// Select one such mapping and rewrite it
|
|
// Select one such mapping and rewrite it
|
|
if (read_nr_out(mappings) > 0):
|
|
if (read_nr_out(mappings) > 0):
|
|
// Mapping found, so can rewrite it
|
|
// Mapping found, so can rewrite it
|
|
mapping = set_pop(mappings)
|
|
mapping = set_pop(mappings)
|
|
- log("Found example mapping " + dict_to_string(mapping))
|
|
|
|
rewrite(host_model, RHS_model, mapping)
|
|
rewrite(host_model, RHS_model, mapping)
|
|
else:
|
|
else:
|
|
output("No mapping found!")
|
|
output("No mapping found!")
|