|
@@ -359,6 +359,8 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
|
|
|
String value
|
|
|
String action
|
|
|
Element original_RHS_labels
|
|
|
+ String new_identifier
|
|
|
+ Element func
|
|
|
|
|
|
Element reverse
|
|
|
reverse = make_reverse_dictionary(schedule_model["model"])
|
|
@@ -389,6 +391,14 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
|
|
|
while (list_len(labels_to_add) > 0):
|
|
|
// Add the elements linked to these labels
|
|
|
label = list_pop(labels_to_add, list_len(labels_to_add) - 1)
|
|
|
+
|
|
|
+ // Check if we have any requirement for the ID
|
|
|
+ if (element_eq(read_attribute(schedule_model, RHS_map[label], "__id__"), read_root())):
|
|
|
+ new_identifier = ""
|
|
|
+ else:
|
|
|
+ func = get_func_AL_model(import_node(read_attribute(schedule_model, RHS_map[label], "__id__")))
|
|
|
+ new_identifier = func(host_model, mapping)
|
|
|
+
|
|
|
if (is_edge(schedule_model["model"][RHS_map[label]])):
|
|
|
// Edge
|
|
|
src = read_attribute(schedule_model, reverse[cast_id(read_edge_src(schedule_model["model"][RHS_map[label]]))], "label")
|
|
@@ -399,7 +409,7 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
|
|
|
// Both are present, so we can make the link
|
|
|
typename = read_type(schedule_model, RHS_map[label])
|
|
|
original_typename = string_substr(typename, 5, string_len(typename))
|
|
|
- new_name = instantiate_link(host_model, original_typename, "", new_mapping[src], new_mapping[dst])
|
|
|
+ new_name = instantiate_link(host_model, original_typename, new_identifier, new_mapping[src], new_mapping[dst])
|
|
|
dict_add_fast(new_mapping, label, new_name)
|
|
|
else:
|
|
|
// Delay this a bit, until all are bound
|
|
@@ -409,13 +419,12 @@ Void function rewrite(host_model : Element, schedule_model : Element, RHS : Stri
|
|
|
// Create the node and add it
|
|
|
typename = read_type(schedule_model, RHS_map[label])
|
|
|
original_typename = string_substr(typename, 5, string_len(typename))
|
|
|
- new_name = instantiate_node(host_model, original_typename, "")
|
|
|
+ new_name = instantiate_node(host_model, original_typename, new_identifier)
|
|
|
dict_add_fast(new_mapping, label, new_name)
|
|
|
|
|
|
Element attributes
|
|
|
String attribute
|
|
|
Element result
|
|
|
- Element func
|
|
|
|
|
|
while (set_len(original_RHS_labels) > 0):
|
|
|
// Perform actions
|
|
@@ -535,6 +544,9 @@ Boolean function transform_atomic(host_model : Element, schedule_model : Element
|
|
|
// Execute the atomic transformation
|
|
|
Element mappings
|
|
|
Element mapping
|
|
|
+
|
|
|
+ log("Executing rule: " + current)
|
|
|
+
|
|
|
mappings = full_match(host_model, schedule_model, current, True)
|
|
|
|
|
|
if (set_len(mappings) > 0):
|
|
@@ -543,8 +555,10 @@ Boolean function transform_atomic(host_model : Element, schedule_model : Element
|
|
|
String RHS
|
|
|
RHS = set_pop(allAssociationDestinations(schedule_model, current, "RHSLink"))
|
|
|
rewrite(host_model, schedule_model, RHS, mapping)
|
|
|
+ log("Rewrite OK")
|
|
|
return True!
|
|
|
else:
|
|
|
+ log("Rewrite failed")
|
|
|
return False!
|
|
|
|
|
|
Boolean function transform_forall(host_model : Element, schedule_model : Element, current : String):
|