|
@@ -141,6 +141,9 @@ Void function model_join(dst_model : Element, src_model : Element, retyping_key
|
|
|
String type
|
|
|
String src
|
|
|
String dst
|
|
|
+ Element cached_src_model_model
|
|
|
+ Element elem
|
|
|
+ cached_src_model_model = src_model["model"]
|
|
|
|
|
|
mapping = create_node()
|
|
|
|
|
@@ -149,15 +152,16 @@ Void function model_join(dst_model : Element, src_model : Element, retyping_key
|
|
|
keys = dict_keys(src_model["model"])
|
|
|
while (read_nr_out(keys) > 0):
|
|
|
name = set_pop(keys)
|
|
|
+ elem = cached_src_model_model[name]
|
|
|
type = read_type(src_model, name)
|
|
|
|
|
|
- if (is_edge(src_model["model"][name])):
|
|
|
+ if (is_edge(elem)):
|
|
|
// Is an edge, so potentially queue it
|
|
|
String src
|
|
|
String dst
|
|
|
|
|
|
- src = reverseKeyLookup(src_model["model"], read_edge_src(src_model["model"][name]))
|
|
|
- dst = reverseKeyLookup(src_model["model"], read_edge_dst(src_model["model"][name]))
|
|
|
+ src = reverseKeyLookup(cached_src_model_model, read_edge_src(elem))
|
|
|
+ dst = reverseKeyLookup(cached_src_model_model, read_edge_dst(elem))
|
|
|
|
|
|
if (bool_and(dict_in(mapping, src), dict_in(mapping, dst))):
|
|
|
// All present, so create the link between them
|
|
@@ -165,9 +169,9 @@ Void function model_join(dst_model : Element, src_model : Element, retyping_key
|
|
|
else:
|
|
|
set_add(second_keys, name)
|
|
|
|
|
|
- elif (has_value(src_model["model"][name])):
|
|
|
+ elif (has_value(elem)):
|
|
|
// Has a value, so copy that as well
|
|
|
- dict_add_fast(mapping, name, instantiate_value(dst_model, retyping_key + type, "", src_model["model"][name]))
|
|
|
+ dict_add_fast(mapping, name, instantiate_value(dst_model, retyping_key + type, "", elem))
|
|
|
|
|
|
else:
|
|
|
// Is a node
|
|
@@ -193,6 +197,9 @@ Element function model_split(src_model : Element, target_metamodel : Element, re
|
|
|
String dst
|
|
|
Integer length
|
|
|
String new_type
|
|
|
+ Element cached_src_model_model
|
|
|
+ Element elem
|
|
|
+ cached_src_model_model = src_model["model"]
|
|
|
|
|
|
mapping = create_node()
|
|
|
length = string_len(retyping_key)
|
|
@@ -202,17 +209,18 @@ Element function model_split(src_model : Element, target_metamodel : Element, re
|
|
|
|
|
|
while (read_nr_out(keys) > 0):
|
|
|
name = set_pop(keys)
|
|
|
+ elem = cached_src_model_model[name]
|
|
|
|
|
|
type = read_type(src_model, name)
|
|
|
if (string_startswith(type, retyping_key)):
|
|
|
new_type = string_substr(type, length, string_len(type))
|
|
|
- if (is_edge(src_model["model"][name])):
|
|
|
+ if (is_edge(elem)):
|
|
|
// Is an edge, so potentially queue it
|
|
|
String src
|
|
|
String dst
|
|
|
|
|
|
- src = reverseKeyLookup(src_model["model"], read_edge_src(src_model["model"][name]))
|
|
|
- dst = reverseKeyLookup(src_model["model"], read_edge_dst(src_model["model"][name]))
|
|
|
+ src = reverseKeyLookup(cached_src_model_model, read_edge_src(elem))
|
|
|
+ dst = reverseKeyLookup(cached_src_model_model, read_edge_dst(elem))
|
|
|
|
|
|
if (bool_and(dict_in(mapping, src), dict_in(mapping, dst))):
|
|
|
// All present, so create the link between them
|
|
@@ -232,9 +240,9 @@ Element function model_split(src_model : Element, target_metamodel : Element, re
|
|
|
// Still source or destination in the queue, so we wait for that
|
|
|
set_add(second_keys, name)
|
|
|
|
|
|
- elif (has_value(src_model["model"][name])):
|
|
|
+ elif (has_value(elem)):
|
|
|
// Has a value, so copy that as well
|
|
|
- dict_add_fast(mapping, name, instantiate_value(dst_model, new_type, "", src_model["model"][name]))
|
|
|
+ dict_add_fast(mapping, name, instantiate_value(dst_model, new_type, "", elem))
|
|
|
|
|
|
else:
|
|
|
// Is a node
|