|
|
@@ -4,141 +4,225 @@ include "library.alh"
|
|
|
include "conformance_scd.alh"
|
|
|
include "modelling.alh"
|
|
|
|
|
|
-String function constraint_Natural(model : Element, name : String):
|
|
|
- Element self
|
|
|
- self = model["model"][name]
|
|
|
- if (is_physical_int(self)):
|
|
|
- if (integer_gte(self, 0)):
|
|
|
+Element function constraint_natural(model : Element, name : String):
|
|
|
+ if (is_physical_int(model["model"][name])):
|
|
|
+ if (integer_gte(model["model"][name], 0)):
|
|
|
return "OK"!
|
|
|
else:
|
|
|
return "Natural number not larger than or equal to zero"!
|
|
|
else:
|
|
|
- return "Natural number not larger than or equal to zero"!
|
|
|
+ return "Natural has non-integer instance"!
|
|
|
|
|
|
-Element function constraint_String(model : Element, name : String):
|
|
|
- Element self
|
|
|
- self = model["model"][name]
|
|
|
- if (is_physical_string(self)):
|
|
|
+Element function constraint_string(model : Element, name : String):
|
|
|
+ if (is_physical_string(model["model"][name])):
|
|
|
return "OK"!
|
|
|
else:
|
|
|
return "String has non-string instance"!
|
|
|
|
|
|
-Element function constraint_Boolean(model : Element, name : String):
|
|
|
- Element self
|
|
|
- self = model["model"][name]
|
|
|
- if (is_physical_boolean(self)):
|
|
|
- return "OK"!
|
|
|
+Element function constraint_if(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "if"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_while(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "while"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_break(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "break"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_continue(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "continue"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_assign(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "assign"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_return(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "return"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_output(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "output"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_input(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "input"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_declare(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "declare"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_global(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "global"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_access(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "access"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
+ else:
|
|
|
+ return "Expected physical action value"!
|
|
|
+
|
|
|
+Element function constraint_constant(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "constant"):
|
|
|
+ return "OK"!
|
|
|
+ else:
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
else:
|
|
|
- return "Boolean has non-boolean instance"!
|
|
|
+ return "Expected physical action value"!
|
|
|
|
|
|
-Element function constraint_Location(model : Element, name : String):
|
|
|
- Element self
|
|
|
- self = model["model"][name]
|
|
|
- if (is_physical_string(self)):
|
|
|
- if (element_neq(import_node(self), read_root())):
|
|
|
+Element function constraint_resolve(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "resolve"):
|
|
|
return "OK"!
|
|
|
else:
|
|
|
- return "Location references non-existing element!"!
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
else:
|
|
|
- return "Location has non-string instance"!
|
|
|
+ return "Expected physical action value"!
|
|
|
|
|
|
-Element function constraint_ActionLanguage(model : Element, name : String):
|
|
|
- Element self
|
|
|
- self = model["model"][name]
|
|
|
- if (is_physical_string(self)):
|
|
|
- if (element_neq(import_node(self), read_root())):
|
|
|
+Element function constraint_call(model : Element, name : String):
|
|
|
+ if (is_physical_action(model["model"][name])):
|
|
|
+ if (cast_a2s(model["model"][name]) == "call"):
|
|
|
return "OK"!
|
|
|
else:
|
|
|
- return "ActionLanguage references non-existing element!"!
|
|
|
+ return "Got wrong action primitive: " + cast_a2s(model["model"][name])!
|
|
|
else:
|
|
|
- return "ActionLanguage has non-string value!"!
|
|
|
+ return "Expected physical action value"!
|
|
|
|
|
|
Element function initialize_SCD(location : String):
|
|
|
if (element_neq(import_node(location), read_root())):
|
|
|
return import_node(location)!
|
|
|
|
|
|
Element scd
|
|
|
- String al_location
|
|
|
- al_location = "models/ActionLanguage"
|
|
|
-
|
|
|
scd = instantiate_bottom()
|
|
|
|
|
|
- model_add_node(scd, "Element")
|
|
|
+ // Initial model, typed using LTM_bottom
|
|
|
model_add_node(scd, "Class")
|
|
|
- model_add_node(scd, "Attribute")
|
|
|
- model_add_node(scd, "SimpleAttribute")
|
|
|
+ model_add_node(scd, "Any")
|
|
|
model_add_node(scd, "String")
|
|
|
- model_add_value(scd, "name_value", "name")
|
|
|
- model_add_edge(scd, "Association", "Class", "Class")
|
|
|
- model_add_edge(scd, "Inheritance", "Element", "Element")
|
|
|
- model_add_edge(scd, "AttributeLink", "Element", "Attribute")
|
|
|
- model_add_edge(scd, "attr_name", "AttributeLink", "String")
|
|
|
- model_add_edge(scd, "attr_name_name", "attr_name", "name_value")
|
|
|
- model_add_edge(scd, "class_inh_element", "Class", "Element")
|
|
|
- model_add_edge(scd, "attribute_inh_element", "Attribute", "Element")
|
|
|
- model_add_edge(scd, "simple_inh_attribute", "SimpleAttribute", "Attribute")
|
|
|
- model_add_edge(scd, "association_inh_element", "Association", "Element")
|
|
|
- model_add_edge(scd, "attributelink_inh_element", "AttributeLink", "Element")
|
|
|
-
|
|
|
- // Retype to self
|
|
|
+ model_add_value(scd, "name", "name")
|
|
|
+ model_add_edge(scd, "Association", "Class", "Any")
|
|
|
+ model_add_edge(scd, "Inheritance", "Class", "Class")
|
|
|
+ model_add_edge(scd, "Association_attribute", "Association", "String")
|
|
|
+ model_add_edge(scd, "Association_name", "Association_attribute", "name")
|
|
|
+ model_add_edge(scd, "assoc_inh_class", "Association", "Class")
|
|
|
+ model_add_edge(scd, "class_inh_any", "Class", "Any")
|
|
|
+ model_add_edge(scd, "string_inh_any", "String", "Any")
|
|
|
+
|
|
|
+ // Retype to a "real" LTM, which happens to be itself
|
|
|
retype_model(scd, scd)
|
|
|
- retype(scd, "Element", "Class")
|
|
|
retype(scd, "Class", "Class")
|
|
|
- retype(scd, "Attribute", "Class")
|
|
|
- retype(scd, "SimpleAttribute", "Class")
|
|
|
- retype(scd, "String", "SimpleAttribute")
|
|
|
- retype(scd, "name_value", "String")
|
|
|
+ retype(scd, "Any", "Class")
|
|
|
+ retype(scd, "String", "Class")
|
|
|
+ retype(scd, "name", "String")
|
|
|
retype(scd, "Association", "Association")
|
|
|
retype(scd, "Inheritance", "Association")
|
|
|
- retype(scd, "AttributeLink", "Association")
|
|
|
- retype(scd, "attr_name", "AttributeLink")
|
|
|
- retype(scd, "attr_name_name", "attr_name")
|
|
|
- retype(scd, "class_inh_element", "Inheritance")
|
|
|
- retype(scd, "attribute_inh_element", "Inheritance")
|
|
|
- retype(scd, "simple_inh_attribute", "Inheritance")
|
|
|
- retype(scd, "association_inh_element", "Inheritance")
|
|
|
- retype(scd, "attributelink_inh_element", "Inheritance")
|
|
|
+ retype(scd, "Association_attribute", "Association")
|
|
|
+ retype(scd, "Association_name", "Association_attribute")
|
|
|
+ retype(scd, "assoc_inh_class", "Inheritance")
|
|
|
+ retype(scd, "class_inh_any", "Inheritance")
|
|
|
+ retype(scd, "string_inh_any", "Inheritance")
|
|
|
|
|
|
// Add some attributes, now that it is an ordinary model
|
|
|
- instantiate_node(scd, "SimpleAttribute", "Location")
|
|
|
- instantiate_node(scd, "SimpleAttribute", "Natural")
|
|
|
- instantiate_node(scd, "SimpleAttribute", "Boolean")
|
|
|
- instantiate_link(scd, "AttributeLink", "attr_optional", "AttributeLink", "Boolean")
|
|
|
- instantiate_attribute(scd, "attr_optional", "name", "optional")
|
|
|
- instantiate_attribute(scd, "attr_optional", "optional", False)
|
|
|
- instantiate_attribute(scd, "attr_name", "optional", False)
|
|
|
-
|
|
|
- instantiate_node(scd, "Class", "ComplexAttribute")
|
|
|
- instantiate_link(scd, "Inheritance", "", "ComplexAttribute", "Attribute")
|
|
|
-
|
|
|
- model_define_attribute(scd, "Class", "lower_cardinality", True, "Natural")
|
|
|
- model_define_attribute(scd, "Class", "upper_cardinality", True, "Natural")
|
|
|
- model_define_attribute(scd, "Association", "source_lower_cardinality", True, "Natural")
|
|
|
- model_define_attribute(scd, "Association", "target_lower_cardinality", True, "Natural")
|
|
|
- model_define_attribute(scd, "Association", "source_upper_cardinality", True, "Natural")
|
|
|
- model_define_attribute(scd, "Association", "target_upper_cardinality", True, "Natural")
|
|
|
- model_define_attribute(scd, "ComplexAttribute", "type", False, "Location")
|
|
|
-
|
|
|
- // Export already, to allow AL to pick it up
|
|
|
- export_node(location, scd)
|
|
|
- // Add in the Action Language metamodel
|
|
|
- initialize_AL(location, al_location)
|
|
|
-
|
|
|
- // Define additional attributes that define functions
|
|
|
- instantiate_node(scd, "ComplexAttribute", "ActionLanguage")
|
|
|
- instantiate_attribute(scd, "ActionLanguage", "type", al_location)
|
|
|
- model_define_attribute(scd, "Element", "constraint", True, "ActionLanguage")
|
|
|
-
|
|
|
- // Define some constraints
|
|
|
- instantiate_attribute_code(scd, "Natural", "constraint", constraint_Natural)
|
|
|
- instantiate_attribute_code(scd, "String", "constraint", constraint_String)
|
|
|
- instantiate_attribute_code(scd, "Boolean", "constraint", constraint_Boolean)
|
|
|
- instantiate_attribute_code(scd, "Location", "constraint", constraint_Location)
|
|
|
- instantiate_attribute_code(scd, "ActionLanguage", "constraint", constraint_ActionLanguage)
|
|
|
-
|
|
|
- instantiate_node(scd, "Class", "GlobalConstraint")
|
|
|
- model_define_attribute(scd, "GlobalConstraint", "global_constraint", False, "ActionLanguage")
|
|
|
+ instantiate_node(scd, "Class", "Natural")
|
|
|
+ instantiate_link(scd, "Association", "lc", "Class", "Natural")
|
|
|
+ instantiate_attribute(scd, "lc", "name", "lower_cardinality")
|
|
|
+ instantiate_link(scd, "Association", "uc", "Class", "Natural")
|
|
|
+ instantiate_attribute(scd, "uc", "name", "upper_cardinality")
|
|
|
+ instantiate_link(scd, "Association", "slc", "Association", "Natural")
|
|
|
+ instantiate_attribute(scd, "slc", "name", "source_lower_cardinality")
|
|
|
+ instantiate_link(scd, "Association", "suc", "Association", "Natural")
|
|
|
+ instantiate_attribute(scd, "suc", "name", "source_upper_cardinality")
|
|
|
+ instantiate_link(scd, "Association", "tlc", "Association", "Natural")
|
|
|
+ instantiate_attribute(scd, "tlc", "name", "target_lower_cardinality")
|
|
|
+ instantiate_link(scd, "Association", "tuc", "Association", "Natural")
|
|
|
+ instantiate_attribute(scd, "tuc", "name", "target_upper_cardinality")
|
|
|
|
|
|
+ // Add in the Action Language metamodel
|
|
|
+ add_AL_to_MM(scd)
|
|
|
+
|
|
|
+ // Now still allow for constraints on classes
|
|
|
+ instantiate_link(scd, "Association", "constraint", "Class", "funcdef")
|
|
|
+ instantiate_attribute(scd, "constraint", "name", "constraint")
|
|
|
+
|
|
|
+ // Add constraints to all primitive classes
|
|
|
+ //add_constraint(scd, "if", constraint_if)
|
|
|
+ //add_constraint(scd, "while", constraint_while)
|
|
|
+ //add_constraint(scd, "break", constraint_break)
|
|
|
+ //add_constraint(scd, "continue", constraint_continue)
|
|
|
+ //add_constraint(scd, "assign", constraint_assign)
|
|
|
+ //add_constraint(scd, "return", constraint_return)
|
|
|
+ //add_constraint(scd, "output", constraint_output)
|
|
|
+ //add_constraint(scd, "input", constraint_input)
|
|
|
+ //add_constraint(scd, "declare", constraint_declare)
|
|
|
+ //add_constraint(scd, "global", constraint_global)
|
|
|
+ //add_constraint(scd, "access", constraint_access)
|
|
|
+ //add_constraint(scd, "constant", constraint_constant)
|
|
|
+ //add_constraint(scd, "resolve", constraint_resolve)
|
|
|
+ //add_constraint(scd, "call", constraint_call)
|
|
|
+
|
|
|
+ // And add some, to enforce correct physical types
|
|
|
+ add_constraint(scd, "Natural", constraint_natural)
|
|
|
+ add_constraint(scd, "String", constraint_string)
|
|
|
+
|
|
|
+ // Finally done, so export!
|
|
|
+ export_node(location, scd)
|
|
|
return scd!
|
|
|
|
|
|
Element function initialize_PN(location_SCD : String, location_PN : String):
|
|
|
@@ -150,15 +234,24 @@ Element function initialize_PN(location_SCD : String, location_PN : String):
|
|
|
pn = instantiate_model(scd)
|
|
|
instantiate_node(pn, "Class", "Place")
|
|
|
instantiate_node(pn, "Class", "Transition")
|
|
|
- instantiate_node(pn, "SimpleAttribute", "Natural")
|
|
|
+ instantiate_node(pn, "Class", "Natural")
|
|
|
instantiate_link(pn, "Association", "P2T", "Place", "Transition")
|
|
|
instantiate_link(pn, "Association", "T2P", "Transition", "Place")
|
|
|
- model_define_attribute(pn, "Place", "tokens", False, "Natural")
|
|
|
- model_define_attribute(pn, "P2T", "weight", False, "Natural")
|
|
|
- model_define_attribute(pn, "T2P", "weight", False, "Natural")
|
|
|
+ instantiate_link(pn, "Association", "Place_tokens", "Place", "Natural")
|
|
|
+ instantiate_attribute(pn, "Place_tokens", "name", "tokens")
|
|
|
+ instantiate_attribute(pn, "Place_tokens", "target_lower_cardinality", 1)
|
|
|
+ instantiate_attribute(pn, "Place_tokens", "target_upper_cardinality", 1)
|
|
|
+ instantiate_link(pn, "Association", "P2T_weight", "P2T", "Natural")
|
|
|
+ instantiate_attribute(pn, "P2T_weight", "name", "weight")
|
|
|
+ instantiate_attribute(pn, "P2T_weight", "target_lower_cardinality", 1)
|
|
|
+ instantiate_attribute(pn, "P2T_weight", "target_upper_cardinality", 1)
|
|
|
+ instantiate_link(pn, "Association", "T2P_weight", "T2P", "Natural")
|
|
|
+ instantiate_attribute(pn, "T2P_weight", "name", "weight")
|
|
|
+ instantiate_attribute(pn, "T2P_weight", "target_lower_cardinality", 1)
|
|
|
+ instantiate_attribute(pn, "T2P_weight", "target_upper_cardinality", 1)
|
|
|
|
|
|
// Add constraint on the Natural
|
|
|
- instantiate_attribute_code(pn, "Natural", "constraint", constraint_Natural)
|
|
|
+ add_constraint(pn, "Natural", constraint_natural)
|
|
|
|
|
|
export_node(location_PN, pn)
|
|
|
|
|
|
@@ -182,7 +275,7 @@ Element function initialize_bottom(location_bottom : String):
|
|
|
|
|
|
return ltm_bottom!
|
|
|
|
|
|
-Void function create_metamodels():
|
|
|
+Element function create_metamodels():
|
|
|
String location_SCD
|
|
|
String location_PN
|
|
|
String location_bottom
|
|
|
@@ -191,25 +284,16 @@ Void function create_metamodels():
|
|
|
location_PN = "models/PetriNets"
|
|
|
location_bottom = "models/LTM_bottom"
|
|
|
|
|
|
- if (element_eq(import_node("models/PetriNets"), read_root())):
|
|
|
+ if (bool_not(dict_in(dict_read(dict_read(read_root(), "__hierarchy"), "models"), "SimpleClassDiagrams"))):
|
|
|
+ initialize_SCD(location_SCD)
|
|
|
+ if (bool_not(dict_in(dict_read(dict_read(read_root(), "__hierarchy"), "models"), "PetriNets"))):
|
|
|
initialize_PN(location_SCD, location_PN)
|
|
|
- if (element_eq(import_node("models/LTM_bottom"), read_root())):
|
|
|
+ if (bool_not(dict_in(dict_read(dict_read(read_root(), "__hierarchy"), "models"), "LTM_bottom"))):
|
|
|
initialize_bottom(location_bottom)
|
|
|
|
|
|
- return!
|
|
|
-
|
|
|
-Void function initialize_AL(scd_location : String, export_location : String):
|
|
|
- // TODO this should be written in a file-based model and not created like this in the bootstrap
|
|
|
- Element model
|
|
|
- Element scd_model
|
|
|
-
|
|
|
- if (element_neq(import_node(export_location), read_root())):
|
|
|
- return!
|
|
|
+ return dict_read(dict_read(read_root(), "__hierarchy"), "models")!
|
|
|
|
|
|
- scd_model = import_node(scd_location)
|
|
|
- model = instantiate_model(scd_model)
|
|
|
-
|
|
|
- instantiate_node(model, "Class", "Element")
|
|
|
+Void function add_AL_to_MM(model : Element):
|
|
|
instantiate_node(model, "Class", "Action")
|
|
|
instantiate_node(model, "Class", "Statement")
|
|
|
instantiate_node(model, "Class", "Expression")
|
|
|
@@ -229,17 +313,10 @@ Void function initialize_AL(scd_location : String, export_location : String):
|
|
|
instantiate_node(model, "Class", "input")
|
|
|
instantiate_node(model, "Class", "resolve")
|
|
|
instantiate_node(model, "Class", "call")
|
|
|
- instantiate_node(model, "Class", "String")
|
|
|
- instantiate_node(model, "SimpleAttribute", "StringAttr")
|
|
|
- instantiate_node(model, "Class", "Initial")
|
|
|
-
|
|
|
- instantiate_attribute(model, "Initial", "lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "Initial", "upper_cardinality", 1)
|
|
|
- instantiate_link(model, "Association", "initial_funcdef", "Initial", "Action")
|
|
|
- instantiate_attribute(model, "initial_funcdef", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "initial_funcdef", "target_upper_cardinality", 1)
|
|
|
-
|
|
|
- instantiate_link(model, "Inheritance", "", "Action", "Element")
|
|
|
+ instantiate_link(model, "Association", "dict_link", "Action", "Any")
|
|
|
+ instantiate_link(model, "Association", "to_str", "dict_link", "String")
|
|
|
+ instantiate_attribute(model, "to_str", "name", "name")
|
|
|
+ instantiate_link(model, "Inheritance", "", "Action", "Any")
|
|
|
instantiate_link(model, "Inheritance", "", "funcdef", "Action")
|
|
|
instantiate_link(model, "Inheritance", "", "param", "Action")
|
|
|
instantiate_link(model, "Inheritance", "", "Statement", "Action")
|
|
|
@@ -258,25 +335,20 @@ Void function initialize_AL(scd_location : String, export_location : String):
|
|
|
instantiate_link(model, "Inheritance", "", "access", "Expression")
|
|
|
instantiate_link(model, "Inheritance", "", "constant", "Expression")
|
|
|
instantiate_link(model, "Inheritance", "", "input", "Expression")
|
|
|
- instantiate_link(model, "Inheritance", "", "String", "Element")
|
|
|
-
|
|
|
- instantiate_link(model, "Association", "dict_link", "Action", "Element")
|
|
|
- model_define_attribute(model, "dict_link", "name", False, "StringAttr")
|
|
|
-
|
|
|
- instantiate_link(model, "Association", "Statement_next", "Statement", "Statement")
|
|
|
+ instantiate_link(model, "Association", "statement_next", "Statement", "Statement")
|
|
|
instantiate_link(model, "Association", "if_cond", "if", "Expression")
|
|
|
instantiate_link(model, "Association", "if_then", "if", "Statement")
|
|
|
instantiate_link(model, "Association", "if_else", "if", "Statement")
|
|
|
instantiate_link(model, "Association", "while_cond", "while", "Expression")
|
|
|
instantiate_link(model, "Association", "while_body", "while", "Statement")
|
|
|
- instantiate_link(model, "Association", "assign_var", "assign", "resolve")
|
|
|
+ instantiate_link(model, "Association", "assign_var", "assign", "Any")
|
|
|
instantiate_link(model, "Association", "assign_value", "assign", "Expression")
|
|
|
instantiate_link(model, "Association", "break_while", "break", "while")
|
|
|
instantiate_link(model, "Association", "continue_while", "continue", "while")
|
|
|
instantiate_link(model, "Association", "return_value", "return", "Expression")
|
|
|
- instantiate_link(model, "Association", "resolve_var", "resolve", "Element")
|
|
|
- instantiate_link(model, "Association", "access_var", "access", "resolve")
|
|
|
- instantiate_link(model, "Association", "constant_node", "constant", "Element")
|
|
|
+ instantiate_link(model, "Association", "resolve_var", "resolve", "Any")
|
|
|
+ instantiate_link(model, "Association", "access_var", "access", "Any")
|
|
|
+ instantiate_link(model, "Association", "constant_node", "constant", "Any")
|
|
|
instantiate_link(model, "Association", "output_node", "output", "Expression")
|
|
|
instantiate_link(model, "Association", "global_var", "global", "String")
|
|
|
instantiate_link(model, "Association", "param_name", "param", "String")
|
|
|
@@ -286,7 +358,7 @@ Void function initialize_AL(scd_location : String, export_location : String):
|
|
|
instantiate_link(model, "Association", "call_func", "call", "Expression")
|
|
|
instantiate_link(model, "Association", "call_params", "call", "param")
|
|
|
instantiate_link(model, "Association", "call_last_param", "call", "param")
|
|
|
- instantiate_link(model, "Inheritance", "", "Statement_next", "dict_link")
|
|
|
+ instantiate_link(model, "Inheritance", "", "statement_next", "dict_link")
|
|
|
instantiate_link(model, "Inheritance", "", "if_cond", "dict_link")
|
|
|
instantiate_link(model, "Inheritance", "", "if_then", "dict_link")
|
|
|
instantiate_link(model, "Inheritance", "", "if_else", "dict_link")
|
|
|
@@ -310,47 +382,46 @@ Void function initialize_AL(scd_location : String, export_location : String):
|
|
|
instantiate_link(model, "Inheritance", "", "call_params", "dict_link")
|
|
|
instantiate_link(model, "Inheritance", "", "call_last_param", "dict_link")
|
|
|
|
|
|
+ // Add cardinalities on how many connections are allowed: one of each
|
|
|
+ instantiate_attribute(model, "statement_next", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "if_cond", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "if_then", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "while_cond", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "while_body", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "assign_var", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "assign_value", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "break_while", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "continue_while", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "resolve_var", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "access_var", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "constant_node", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "output_node", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "global_var", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "param_name", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "param_value", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "funcdef_body", "target_lower_cardinality", 1)
|
|
|
- instantiate_attribute(model, "call_func", "target_lower_cardinality", 1)
|
|
|
-
|
|
|
- instantiate_attribute(model, "Statement_next", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "if_cond", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "if_then", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "if_then", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "if_else", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "while_cond", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "while_cond", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "while_body", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "while_body", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "assign_var", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "assign_var", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "assign_value", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "assign_value", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "break_while", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "break_while", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "continue_while", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "continue_while", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "return_value", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "resolve_var", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "resolve_var", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "access_var", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "access_var", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "constant_node", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "constant_node", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "output_node", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "output_node", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "global_var", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "global_var", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "param_name", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "param_name", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "param_value", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "param_value", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "param_next_param", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "funcdef_body", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "funcdef_body", "target_upper_cardinality", 1)
|
|
|
+ instantiate_attribute(model, "call_func", "target_lower_cardinality", 1)
|
|
|
instantiate_attribute(model, "call_func", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "call_params", "target_upper_cardinality", 1)
|
|
|
instantiate_attribute(model, "call_last_param", "target_upper_cardinality", 1)
|
|
|
|
|
|
- export_node(export_location, model)
|
|
|
return !
|