|
@@ -25,20 +25,31 @@ Element function ramify(model : Element):
|
|
|
|
|
|
// Add in some primitives
|
|
|
instantiate_node(new_model, "SimpleAttribute", "Natural")
|
|
|
+ instantiate_attribute(new_model, "Natural", "constraint", constraint_Natural)
|
|
|
+
|
|
|
instantiate_node(new_model, "SimpleAttribute", "String")
|
|
|
+ instantiate_attribute(new_model, "String", "constraint", constraint_String)
|
|
|
+
|
|
|
instantiate_node(new_model, "SimpleAttribute", "Boolean")
|
|
|
- instantiate_node(new_model, "SimpleAttribute", "Element")
|
|
|
+ instantiate_attribute(new_model, "Boolean", "constraint", constraint_Boolean)
|
|
|
+
|
|
|
+ instantiate_node(new_model, "SimpleAttribute", "Location")
|
|
|
+ instantiate_attribute(new_model, "Location", "constraint", constraint_Location)
|
|
|
+
|
|
|
+ instantiate_node(new_model, "ComplexAttribute", "ActionLanguage")
|
|
|
+ instantiate_attribute(new_model, "ActionLanguage", "constraint", constraint_ActionLanguage)
|
|
|
+ model_define_attribute(new_model, "ActionLanguage", "type", False, "Location")
|
|
|
|
|
|
// Add some default elements
|
|
|
// Class LHS_Root {
|
|
|
- // constraint? : funcdef
|
|
|
+ // constraint? : ActionLanguage
|
|
|
// upper_cardinality = 1
|
|
|
// lower_cardinality = 1
|
|
|
// }
|
|
|
instantiate_node(new_model, "Class", "LHS_Root")
|
|
|
instantiate_attribute(new_model, "LHS_Root", "lower_cardinality", 1)
|
|
|
instantiate_attribute(new_model, "LHS_Root", "upper_cardinality", 1)
|
|
|
- model_define_attribute(new_model, "LHS_Root", "LHS_constraint", True, "funcdef")
|
|
|
+ model_define_attribute(new_model, "LHS_Root", "LHS_constraint", True, "ActionLanguage")
|
|
|
|
|
|
// Class LHS : LHS_Root {}
|
|
|
instantiate_node(new_model, "Class", "LHS")
|
|
@@ -50,32 +61,32 @@ Element function ramify(model : Element):
|
|
|
|
|
|
// Class PreElement {
|
|
|
// label : String
|
|
|
- // constraint? : funcdef
|
|
|
+ // constraint? : ActionLanguage
|
|
|
// }
|
|
|
instantiate_node(new_model, "Class", "PreElement")
|
|
|
model_define_attribute(new_model, "PreElement", "label", False, "String")
|
|
|
- model_define_attribute(new_model, "PreElement", "matching_constraint", True, "funcdef")
|
|
|
+ model_define_attribute(new_model, "PreElement", "matching_constraint", True, "ActionLanguage")
|
|
|
|
|
|
// Association LHS_contains (LHS_Root, PreElement) {}
|
|
|
instantiate_link(new_model, "Association", "LHS_contains", "LHS_Root", "PreElement")
|
|
|
|
|
|
// Class RHS {
|
|
|
- // action? : FuncDef
|
|
|
+ // action? : ActionLanguage
|
|
|
// upper_cardinality = 1
|
|
|
// lower_cardinality = 1
|
|
|
// }
|
|
|
instantiate_node(new_model, "Class", "RHS")
|
|
|
instantiate_attribute(new_model, "RHS", "lower_cardinality", 1)
|
|
|
instantiate_attribute(new_model, "RHS", "upper_cardinality", 1)
|
|
|
- model_define_attribute(new_model, "RHS", "action", True, "funcdef")
|
|
|
+ model_define_attribute(new_model, "RHS", "action", True, "ActionLanguage")
|
|
|
|
|
|
// Class PostElement {
|
|
|
// label : String
|
|
|
- // action? : funcdef
|
|
|
+ // action? : ActionLanguage
|
|
|
// }
|
|
|
instantiate_node(new_model, "Class", "PostElement")
|
|
|
model_define_attribute(new_model, "PostElement", "label", False, "String")
|
|
|
- model_define_attribute(new_model, "PostElement", "action", True, "funcdef")
|
|
|
+ model_define_attribute(new_model, "PostElement", "action", True, "ActionLanguage")
|
|
|
|
|
|
// Association RHS_contains (RHS, PostElement) {}
|
|
|
instantiate_link(new_model, "Association", "RHS_contains", "RHS", "PostElement")
|
|
@@ -105,9 +116,12 @@ Element function ramify(model : Element):
|
|
|
set_add(copied_attributes, "source_upper_cardinality")
|
|
|
set_add(copied_attributes, "target_upper_cardinality")
|
|
|
|
|
|
+ log("Start RAM")
|
|
|
+ log("Set: " + list_to_string(keys))
|
|
|
while (read_nr_out(keys) > 0):
|
|
|
- key = list_pop(keys, read_nr_out(keys) - 1)
|
|
|
+ key = list_pop(keys, 0)
|
|
|
entry = old_m[key]
|
|
|
+ log("CHECK " + key)
|
|
|
|
|
|
type_name = read_type(model, key)
|
|
|
if (type_name == "Class"):
|
|
@@ -118,20 +132,27 @@ Element function ramify(model : Element):
|
|
|
instantiate_link(new_model, "Inheritance", "", "Pre_" + key, "PreElement")
|
|
|
instantiate_link(new_model, "Inheritance", "", "Post_" + key, "PostElement")
|
|
|
|
|
|
- elif (type_name == "Attribute"):
|
|
|
+ log("Added " + key)
|
|
|
+
|
|
|
+ elif (type_name == "AttributeLink"):
|
|
|
// Got an attribute, so find out the source and name
|
|
|
+ log("Attribute link!")
|
|
|
old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
|
|
|
attr_name = read_attribute(model, key, "name")
|
|
|
+ log("Search " + old_source)
|
|
|
+ log("Got " + set_to_string(dict_keys(new_model["model"])))
|
|
|
+
|
|
|
+ // TODO distinguish between Simple and Complex Attributes
|
|
|
|
|
|
- if (set_in(new_model["model"], "Pre_" + old_source)):
|
|
|
+ if (dict_in(new_model["model"], "Pre_" + old_source)):
|
|
|
// Only if it is a class that it originates from is a class, should we add this
|
|
|
if (read_type(model, old_source) == "Class"):
|
|
|
// If the attribute is one used in the conformance check, we should mask it
|
|
|
// Add the attribute in the new model, altering its name and making it optional
|
|
|
log("Adding attribute " + attr_name)
|
|
|
log(" to " + old_source)
|
|
|
- model_define_attribute(new_model, "Pre_" + old_source, attr_name + "_constraint", True, "funcdef")
|
|
|
- model_define_attribute(new_model, "Post_" + old_source, attr_name + "_value", True, "funcdef")
|
|
|
+ model_define_attribute(new_model, "Pre_" + old_source, attr_name + "_constraint", True, "ActionLanguage")
|
|
|
+ model_define_attribute(new_model, "Post_" + old_source, attr_name + "_value", True, "ActionLanguage")
|
|
|
else:
|
|
|
log("Non-class origin for attribute link " + key)
|
|
|
else:
|
|
@@ -142,7 +163,7 @@ Element function ramify(model : Element):
|
|
|
old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
|
|
|
old_target = reverseKeyLookup(model["model"], read_edge_dst(entry))
|
|
|
|
|
|
- if (bool_and(set_in(new_model["model"], old_source), set_in(new_model["model"], old_target))):
|
|
|
+ if (bool_and(dict_in(new_model["model"], "Pre_" + old_source), dict_in(new_model["model"], "Pre_" + old_target))):
|
|
|
instantiate_link(new_model, type_name, "Pre_" + key, "Pre_" + old_source, "Pre_" + old_target)
|
|
|
instantiate_link(new_model, type_name, "Post_" + key, "Post_" + old_source, "Post_" + old_target)
|
|
|
|
|
@@ -152,12 +173,15 @@ Element function ramify(model : Element):
|
|
|
else:
|
|
|
// Queue for later
|
|
|
list_append(keys, key)
|
|
|
+ log("Wait for S " + old_source)
|
|
|
+ log("Wait for T " + old_target)
|
|
|
+ log("Got: " + set_to_string(dict_keys(new_model["model"])))
|
|
|
|
|
|
elif (type_name == "Inheritance"):
|
|
|
old_source = reverseKeyLookup(model["model"], read_edge_src(entry))
|
|
|
old_target = reverseKeyLookup(model["model"], read_edge_dst(entry))
|
|
|
|
|
|
- if (bool_and(set_in(new_model["model"], old_source), set_in(new_model["model"], old_target))):
|
|
|
+ if (bool_and(dict_in(new_model["model"], "Pre_" + old_source), dict_in(new_model["model"], "Pre_" + old_target))):
|
|
|
instantiate_link(new_model, type_name, "Pre_" + key, "Pre_" + old_source, "Pre_" + old_target)
|
|
|
instantiate_link(new_model, type_name, "Post_" + key, "Post_" + old_source, "Post_" + old_target)
|
|
|
else:
|
|
@@ -180,6 +204,8 @@ Element function ramify(model : Element):
|
|
|
else:
|
|
|
log("Masked attribute: " + attr_name)
|
|
|
log(" for " + old_source)
|
|
|
+ else:
|
|
|
+ log("DROP " + key)
|
|
|
|
|
|
// Define schedule over these elements
|
|
|
|