|
@@ -2,115 +2,80 @@ include "primitives.alh"
|
|
include "object_operations.alh"
|
|
include "object_operations.alh"
|
|
include "library.alh"
|
|
include "library.alh"
|
|
include "conformance_scd.alh"
|
|
include "conformance_scd.alh"
|
|
|
|
+include "modelling.alh"
|
|
|
|
|
|
Element function create_metamodels():
|
|
Element function create_metamodels():
|
|
if (bool_not(dict_in(dict_read(read_root(), "__hierarchy"), "models"))):
|
|
if (bool_not(dict_in(dict_read(read_root(), "__hierarchy"), "models"))):
|
|
Element scd
|
|
Element scd
|
|
- Element scd_model
|
|
|
|
- scd = create_node()
|
|
|
|
- scd_model = create_node()
|
|
|
|
- dict_add(scd, "model", scd_model)
|
|
|
|
- instantiate_bottom_node(scd, "Class")
|
|
|
|
- instantiate_bottom_value(scd, "Type", Type)
|
|
|
|
- instantiate_bottom_value(scd, "__String", String)
|
|
|
|
- instantiate_bottom_value(scd, "__name", "name")
|
|
|
|
- instantiate_bottom_edge(scd, "Attribute", scd_model["Class"], scd_model["Type"])
|
|
|
|
- instantiate_bottom_edge(scd, "__Name", scd_model["Attribute"], scd_model["__String"])
|
|
|
|
- instantiate_bottom_edge(scd, "Association", scd_model["Class"], scd_model["Class"])
|
|
|
|
- instantiate_bottom_edge(scd, "Inheritance", scd_model["Class"], scd_model["Class"])
|
|
|
|
- instantiate_bottom_edge(scd, "__name_edge", scd_model["__Name"], scd_model["__name"])
|
|
|
|
- instantiate_bottom_edge(scd, "__inh_1", scd_model["Association"], scd_model["Class"])
|
|
|
|
- instantiate_bottom_edge(scd, "__inh_2", scd_model["Attribute"], scd_model["Class"])
|
|
|
|
- instantiate_bottom_value(scd, "__attribute", "attribute")
|
|
|
|
- instantiate_bottom_edge(scd, "__attribute_edge", scd_model["Attribute"], scd_model["__attribute"])
|
|
|
|
|
|
+ scd = instantiate_bottom()
|
|
|
|
+ model_add_node(scd, "Class")
|
|
|
|
+ model_add_node(scd, "Type")
|
|
|
|
+ model_add_node(scd, "Any")
|
|
|
|
+ model_add_node(scd, "String")
|
|
|
|
+ model_add_value(scd, "inheritance", "inheritance")
|
|
|
|
+ model_add_value(scd, "link", "link")
|
|
|
|
+ model_add_value(scd, "name", "name")
|
|
|
|
+ model_add_edge(scd, "l1", "Class", "Any")
|
|
|
|
+ model_add_edge(scd, "l2", "Type", "Any")
|
|
|
|
+ model_add_edge(scd, "l3", "Any", "Any")
|
|
|
|
+ model_add_edge(scd, "l4", "l3", "inheritance")
|
|
|
|
+ model_add_edge(scd, "l5", "Any", "Any")
|
|
|
|
+ model_add_edge(scd, "l6", "l5", "Any")
|
|
|
|
+ model_add_edge(scd, "l7", "l5", "link")
|
|
|
|
+ model_add_edge(scd, "l8", "l5", "String")
|
|
|
|
+ model_add_edge(scd, "l9", "l8", "name")
|
|
|
|
+
|
|
|
|
+ retype_model(scd, scd)
|
|
|
|
+ define_inheritance(scd, "l3")
|
|
|
|
+ retype(scd, "Class", "Class")
|
|
|
|
+ retype(scd, "Type", "Class")
|
|
|
|
+ retype(scd, "Any", "Class")
|
|
|
|
+ retype(scd, "String", "Type")
|
|
|
|
+ retype(scd, "inheritance", "String")
|
|
|
|
+ retype(scd, "link", "String")
|
|
|
|
+ retype(scd, "name", "String")
|
|
|
|
+ retype(scd, "l1", "l3")
|
|
|
|
+ retype(scd, "l2", "l3")
|
|
|
|
+ retype(scd, "l3", "l5")
|
|
|
|
+ retype(scd, "l4", "l8")
|
|
|
|
+ retype(scd, "l5", "l5")
|
|
|
|
+ retype(scd, "l6", "l3")
|
|
|
|
+ retype(scd, "l7", "l8")
|
|
|
|
+ retype(scd, "l8", "l5")
|
|
|
|
+ retype(scd, "l9", "l8")
|
|
|
|
|
|
- // Instantiated, now retype to make sure that everything is correct
|
|
|
|
- Element mapping
|
|
|
|
- mapping = create_node()
|
|
|
|
- dict_add(mapping, scd_model["Class"], scd_model["Class"])
|
|
|
|
- dict_add(mapping, scd_model["Type"], scd_model["Type"])
|
|
|
|
- dict_add(mapping, scd_model["__String"], scd_model["Type"])
|
|
|
|
- dict_add(mapping, scd_model["Attribute"], scd_model["Attribute"])
|
|
|
|
- dict_add(mapping, scd_model["__Name"], scd_model["Attribute"])
|
|
|
|
- dict_add(mapping, scd_model["Association"], scd_model["Association"])
|
|
|
|
- dict_add(mapping, scd_model["Inheritance"], scd_model["Association"])
|
|
|
|
- dict_add(mapping, scd_model["__inh_1"], scd_model["Inheritance"])
|
|
|
|
- dict_add(mapping, scd_model["__inh_2"], scd_model["Inheritance"])
|
|
|
|
- dict_add(mapping, scd_model["__name"], scd_model["__String"])
|
|
|
|
- dict_add(mapping, scd_model["__name_edge"], scd_model["__Name"])
|
|
|
|
- dict_add(mapping, scd_model["__attribute"], scd_model["__String"])
|
|
|
|
- dict_add(mapping, scd_model["__attribute_edge"], scd_model["__Name"])
|
|
|
|
- retype(scd, scd, scd_model["Inheritance"], mapping)
|
|
|
|
export_node("models/SimpleClassDiagrams", scd)
|
|
export_node("models/SimpleClassDiagrams", scd)
|
|
|
|
|
|
- // TODO this code is also very dirty as there is no nice "dictionary" and "list" syntax yet
|
|
|
|
- Element modeletamodel
|
|
|
|
- modeletamodel = instantiate_new_model(scd, scd_model["Inheritance"])
|
|
|
|
- Element tokens
|
|
|
|
- tokens = create_node()
|
|
|
|
- dict_add(tokens, "tokens", Integer)
|
|
|
|
- instantiate_model_lib(modeletamodel, scd_model["Class"], "Place", create_node(), tokens, create_node())
|
|
|
|
- instantiate_model_lib(modeletamodel, scd_model["Class"], "Transition", create_node(), create_node(), create_node())
|
|
|
|
- Element weight
|
|
|
|
- weight = create_node()
|
|
|
|
- dict_add(weight, "weight", Integer)
|
|
|
|
- Element p2t_links
|
|
|
|
- p2t_links = create_node()
|
|
|
|
- list_append(p2t_links, modeletamodel["model"]["Place"])
|
|
|
|
- list_append(p2t_links, modeletamodel["model"]["Transition"])
|
|
|
|
- Element t2p_links
|
|
|
|
- t2p_links = create_node()
|
|
|
|
- list_append(t2p_links, modeletamodel["model"]["Transition"])
|
|
|
|
- list_append(t2p_links, modeletamodel["model"]["Place"])
|
|
|
|
- instantiate_model_lib(modeletamodel, scd_model["Association"], "P2T", p2t_links, weight, create_node())
|
|
|
|
- instantiate_model_lib(modeletamodel, scd_model["Association"], "T2P", t2p_links, weight, create_node())
|
|
|
|
|
|
+ Element pn
|
|
|
|
+ pn = instantiate_model(scd)
|
|
|
|
+ define_inheritance(pn, "l3")
|
|
|
|
+ instantiate_node(pn, "Class", "Place")
|
|
|
|
+ instantiate_node(pn, "Class", "Transition")
|
|
|
|
+ instantiate_node(pn, "Type", "Integer")
|
|
|
|
+ instantiate_link(pn, "l5", "P2T", "Place", "Transition")
|
|
|
|
+ instantiate_link(pn, "l5", "T2P", "Transition", "Place")
|
|
|
|
+ instantiate_named(pn, "l5", "tokens", "Place", "Integer")
|
|
|
|
+ instantiate_named(pn, "l5", "weight", "P2T", "Integer")
|
|
|
|
+ instantiate_named(pn, "l5", "weight", "T2P", "Integer")
|
|
|
|
+
|
|
|
|
+ set_model_constraints(pn, petrinet_constraints)
|
|
|
|
+ export_node("models/PetriNets", pn)
|
|
|
|
|
|
- set_model_constraints(modeletamodel, petrinet_constraints)
|
|
|
|
- export_node("models/PetriNets", modeletamodel)
|
|
|
|
|
|
+ Element ltm_bottom
|
|
|
|
+ ltm_bottom = instantiate_bottom()
|
|
|
|
+ model_add_node(ltm_bottom, "Node")
|
|
|
|
+ model_add_edge(ltm_bottom, "Edge", "Node", "Node")
|
|
|
|
+ model_add_edge(ltm_bottom, "inheritance", "Node", "Node")
|
|
|
|
+ model_add_edge(ltm_bottom, "__inh", "Edge", "Node")
|
|
|
|
|
|
- // Also create conformance bottom metamodel
|
|
|
|
- Element mm_bottom
|
|
|
|
- Element mm_bottom_model
|
|
|
|
- mm_bottom = create_node()
|
|
|
|
- mm_bottom_model = create_node()
|
|
|
|
- dict_add(mm_bottom, "model", mm_bottom_model)
|
|
|
|
- instantiate_bottom_node(mm_bottom, "Node")
|
|
|
|
- instantiate_bottom_value(mm_bottom, "Type", Type)
|
|
|
|
- instantiate_bottom_value(mm_bottom, "Integer", Integer)
|
|
|
|
- instantiate_bottom_value(mm_bottom, "Action", Action)
|
|
|
|
- instantiate_bottom_value(mm_bottom, "Float", Float)
|
|
|
|
- instantiate_bottom_value(mm_bottom, "String", String)
|
|
|
|
- instantiate_bottom_value(mm_bottom, "Boolean", Boolean)
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "Edge", mm_bottom_model["Node"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__Inheritance", mm_bottom_model["Node"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_1", mm_bottom_model["Type"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_2", mm_bottom_model["Integer"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_3", mm_bottom_model["Action"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_4", mm_bottom_model["Float"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_5", mm_bottom_model["String"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_6", mm_bottom_model["Boolean"], mm_bottom_model["Node"])
|
|
|
|
- instantiate_bottom_edge(mm_bottom, "__inh_7", mm_bottom_model["Edge"], mm_bottom_model["Node"])
|
|
|
|
|
|
+ retype_model(ltm_bottom, ltm_bottom)
|
|
|
|
+ define_inheritance(ltm_bottom, "inheritance")
|
|
|
|
+ retype(ltm_bottom, "Node", "Node")
|
|
|
|
+ retype(ltm_bottom, "Edge", "Edge")
|
|
|
|
+ retype(ltm_bottom, "inheritance", "Edge")
|
|
|
|
+ retype(ltm_bottom, "__inh", "inheritance")
|
|
|
|
|
|
- // Retype it with itself
|
|
|
|
- mapping = create_node()
|
|
|
|
- dict_add(mapping, mm_bottom_model["Node"], mm_bottom_model["Node"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["Type"], mm_bottom_model["Type"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["Integer"], mm_bottom_model["Type"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["Float"], mm_bottom_model["Type"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["String"], mm_bottom_model["Type"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["Boolean"], mm_bottom_model["Type"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["Action"], mm_bottom_model["Type"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["Edge"], mm_bottom_model["Edge"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__Inheritance"], mm_bottom_model["Edge"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_1"], mm_bottom_model["__Inheritance"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_2"], mm_bottom_model["__Inheritance"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_3"], mm_bottom_model["__Inheritance"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_4"], mm_bottom_model["__Inheritance"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_5"], mm_bottom_model["__Inheritance"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_6"], mm_bottom_model["__Inheritance"])
|
|
|
|
- dict_add(mapping, mm_bottom_model["__inh_7"], mm_bottom_model["__Inheritance"])
|
|
|
|
- retype(mm_bottom, mm_bottom, mm_bottom_model["__Inheritance"], mapping)
|
|
|
|
- export_node("models/LTM_bottom", mm_bottom)
|
|
|
|
|
|
+ export_node("models/LTM_bottom", ltm_bottom)
|
|
|
|
|
|
return dict_read(dict_read(read_root(), "__hierarchy"), "models")
|
|
return dict_read(dict_read(read_root(), "__hierarchy"), "models")
|
|
|
|
|