|
@@ -562,6 +562,7 @@ Element function model_copy(src_model : Element):
|
|
|
Element dst_model
|
|
|
Element queue
|
|
|
Element name
|
|
|
+ String type
|
|
|
|
|
|
dst_model = instantiate_model(src_model["metamodel"])
|
|
|
dict_add(dst_model, "inheritance", src_model["inheritance"])
|
|
@@ -575,7 +576,31 @@ Element function model_copy(src_model : Element):
|
|
|
|
|
|
if (is_edge(src_model["model"][name])):
|
|
|
// 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]))
|
|
|
+ type = reverseKeyLookup(src_model["metamodel"]["model"], dict_read_node(src_model["type_mapping"], src_model["model"][name]))
|
|
|
+
|
|
|
+ if (bool_and(dict_in(dst_model["model"], src), dict_in(dst_model["model"], dst))):
|
|
|
+ // All present, so create the link between them
|
|
|
+ instantiate_link(dst_model, type, name, src, dst)
|
|
|
+ else:
|
|
|
+ list_append(queue, name)
|
|
|
+
|
|
|
elif (has_value(src_model["model"][name])):
|
|
|
// Has a value, so copy that as well
|
|
|
+ type = reverseKeyLookup(src_model["metamodel"]["model"], dict_read_node(src_model["type_mapping"], src_model["model"][name]))
|
|
|
+ instantiate_value(dst_model, type, name, src_model["model"][name])
|
|
|
+
|
|
|
else:
|
|
|
// Is a node
|
|
|
+ type = reverseKeyLookup(src_model["metamodel"]["model"], dict_read_node(src_model["type_mapping"], src_model["model"][name]))
|
|
|
+ instantiate_node(dst_model, type, name)
|
|
|
+
|
|
|
+ return dst_model!
|
|
|
+
|
|
|
+Element function model_retype_on_name(model : Element, new_MM : Element, operation : String, name : String):
|
|
|
+ // TODO
|
|
|
+ return model!
|