|
@@ -99,8 +99,6 @@ Element function instantiate_model(metamodel : Element):
|
|
|
return model!
|
|
|
|
|
|
String function instantiate_node(model : Element, type_name : String, instance_name : String):
|
|
|
- // Create a node typed by a node from the metamodel
|
|
|
- // Basically create a node and type it immediately
|
|
|
String actual_name
|
|
|
|
|
|
if (bool_not(dict_in(model["metamodel"]["model"], type_name))):
|
|
@@ -108,30 +106,25 @@ String function instantiate_node(model : Element, type_name : String, instance_n
|
|
|
log(" for " + instance_name)
|
|
|
return ""!
|
|
|
|
|
|
- //if (dict_in(model["model"], instance_name)):
|
|
|
- // return ""!
|
|
|
-
|
|
|
- actual_name = model_add_node(model, instance_name)
|
|
|
- retype(model, actual_name, type_name)
|
|
|
+ Element value
|
|
|
+ value = create_node()
|
|
|
|
|
|
+ actual_name = instantiated_name(value, instance_name)
|
|
|
+ dict_add_fast(model["model"], actual_name, value)
|
|
|
+ dict_add_fast(model["type_mapping"], actual_name, type_name)
|
|
|
return actual_name!
|
|
|
|
|
|
String function instantiate_value(model : Element, type_name : String, instance_name : String, value : Element):
|
|
|
- // Create a node typed by a node from the metamodel
|
|
|
- // Basically create a node and type it immediately
|
|
|
String actual_name
|
|
|
|
|
|
if (bool_not(dict_in(model["metamodel"]["model"], type_name))):
|
|
|
log("ERROR: (instantiate_value) no such type in metamodel: " + type_name)
|
|
|
log(" for " + instance_name)
|
|
|
return ""!
|
|
|
-
|
|
|
- //if (dict_in(model["model"], instance_name)):
|
|
|
- // return ""!
|
|
|
-
|
|
|
- actual_name = model_add_value(model, instance_name, value)
|
|
|
- retype(model, actual_name, type_name)
|
|
|
-
|
|
|
+
|
|
|
+ actual_name = instantiated_name(value, instance_name)
|
|
|
+ dict_add_fast(model["model"], actual_name, value)
|
|
|
+ dict_add_fast(model["type_mapping"], actual_name, type_name)
|
|
|
return actual_name!
|
|
|
|
|
|
String function find_attribute_type(model : Element, elem : String, name : String):
|
|
@@ -324,9 +317,6 @@ String function instantiate_link(model : Element, type : String, name : String,
|
|
|
// Create a typed link between two nodes
|
|
|
String actual_name
|
|
|
|
|
|
- //if (dict_in(model["model"], name)):
|
|
|
- // return ""!
|
|
|
-
|
|
|
if (type == ""):
|
|
|
// Have to find the type ourselves, as it isn't defined
|
|
|
Element out
|
|
@@ -351,10 +341,12 @@ String function instantiate_link(model : Element, type : String, name : String,
|
|
|
log("ERROR: (instantiate_link) no such type in metamodel: " + type)
|
|
|
log(" for " + name)
|
|
|
return ""!
|
|
|
-
|
|
|
- actual_name = model_add_edge(model, name, source, destination)
|
|
|
|
|
|
- retype(model, actual_name, type)
|
|
|
+ Element v
|
|
|
+ v = create_edge(model["model"][source], model["model"][destination])
|
|
|
+ actual_name = instantiated_name(v, name)
|
|
|
+ dict_add_fast(model["model"], actual_name, v)
|
|
|
+ dict_add_fast(model["type_mapping"], actual_name, type)
|
|
|
return actual_name!
|
|
|
|
|
|
Void function model_delete_element(model : Element, name : String):
|