|
@@ -131,7 +131,6 @@ Void function main():
|
|
|
instantiate_link(core, "owner", "", al_model, admin_user)
|
|
|
|
|
|
// Add the Manual Operation formalism
|
|
|
- log("Adding manual model")
|
|
|
Element manual
|
|
|
String manual_model
|
|
|
manual = instantiate_model(scd)
|
|
@@ -142,7 +141,6 @@ Void function main():
|
|
|
instantiate_attribute(core, manual_model, "permissions", "221")
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", manual_model, scd_model)
|
|
|
instantiate_attribute(core, instance_of, "type_mapping", create_node())
|
|
|
- log("Added manual model")
|
|
|
|
|
|
// Make necessary links for the formalism to the owners
|
|
|
instantiate_link(core, "group", "", manual_model, admin_group)
|
|
@@ -492,28 +490,20 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
lst = allAssociationOrigins(pm, element, "Consumes")
|
|
|
while (read_nr_out(lst) > 0):
|
|
|
elem = set_pop(lst)
|
|
|
- log("Origin: " + elem)
|
|
|
// As there are no inheritance relations between full models, we can just read out the typename
|
|
|
type_name = read_attribute(pm, elem, "type")
|
|
|
dict_add(inputs, type_name, string_join(prefix, read_attribute(pm, elem, "name")))
|
|
|
- log("Inputs: " + dict_to_string(inputs))
|
|
|
|
|
|
// Find all outputs and their types (i.e., key)
|
|
|
- log("Read all producers of " + element)
|
|
|
lst = allAssociationDestinations(pm, element, "Produces")
|
|
|
while (read_nr_out(lst) > 0):
|
|
|
elem = set_pop(lst)
|
|
|
- log("Destination: " + elem)
|
|
|
// As there are no inheritance relations between full models, we can just read out the typename
|
|
|
type_name = read_attribute(pm, elem, "type")
|
|
|
- log("Type name: " + type_name)
|
|
|
dict_add(outputs, type_name, string_join(prefix, read_attribute(pm, elem, "name")))
|
|
|
dict_add(output_mms, type_name, get_full_model(get_model_id(type_name)))
|
|
|
- log("Outputs: " + dict_to_string(outputs))
|
|
|
|
|
|
exact_type = read_type(core, transformation_id)
|
|
|
- log("Exact type: " + exact_type)
|
|
|
- log("EXECUTE OPERATION " + cast_e2s(read_attribute(core, transformation_id, "name")))
|
|
|
if (exact_type == "ModelTransformation"):
|
|
|
// Model transformation is always in-place and uses only a single metamodel
|
|
|
// Therefore, we must:
|
|
@@ -534,20 +524,15 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
// 1) Create empty instance of merged metamodel
|
|
|
|
|
|
ramified_metamodel_id = set_pop(followAssociation(core, transformation_id, "instanceOf"))
|
|
|
- log("Got ramified: " + ramified_metamodel_id)
|
|
|
trace_links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
|
|
|
- log("Trace links resolved")
|
|
|
merged_metamodel_id = ""
|
|
|
while (read_nr_out(trace_links) > 0):
|
|
|
trace_link_id = set_pop(trace_links)
|
|
|
if (value_eq(read_attribute(core, trace_link_id, "type"), "RAMified")):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
|
- log("Got merged metamodel: " + merged_metamodel_id)
|
|
|
|
|
|
if (merged_metamodel_id != ""):
|
|
|
- log("Ready for instantiate")
|
|
|
merged_model = instantiate_model(get_full_model(merged_metamodel_id))
|
|
|
- log("Instantiated model")
|
|
|
|
|
|
// 2) Merge source models
|
|
|
|
|
@@ -556,9 +541,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
Element input_keys
|
|
|
Element output_keys
|
|
|
|
|
|
- log("Fetching input keys")
|
|
|
input_keys = dict_keys(inputs)
|
|
|
- log("Input keys: " + set_to_string(input_keys))
|
|
|
while (read_nr_out(input_keys) > 0):
|
|
|
key = set_pop(input_keys)
|
|
|
model_join(merged_model, get_full_model(get_model_id(inputs[key])), key + "/")
|
|
@@ -597,36 +580,24 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
String key
|
|
|
Element func
|
|
|
|
|
|
- log("Action Language execution starts!")
|
|
|
- log("Getting full model for transformation")
|
|
|
- log("Got model: " + cast_e2s(read_attribute(core, transformation_id, "location")))
|
|
|
-
|
|
|
// 1) Group source models in dictionary
|
|
|
// --> This is just the "inputs" variable, but resolve all references
|
|
|
- log("Create inputs")
|
|
|
new_inputs = create_node()
|
|
|
input_keys = dict_keys(inputs)
|
|
|
while (read_nr_out(input_keys) > 0):
|
|
|
key = set_pop(input_keys)
|
|
|
- log("Resolving " + cast_e2s(key))
|
|
|
- log(" --> " + cast_e2s(inputs[key]))
|
|
|
- log(" ID " + cast_e2s(get_model_id(inputs[key])))
|
|
|
- log(" full m " + cast_e2s(get_full_model(get_model_id(inputs[key]))))
|
|
|
dict_add(new_inputs, key, get_full_model(get_model_id(inputs[key])))
|
|
|
inputs = new_inputs
|
|
|
|
|
|
// 2) Execute action language model
|
|
|
func = get_func_AL_model(get_full_model(transformation_id))
|
|
|
- log("Ready to execute: " + cast_e2s(func))
|
|
|
|
|
|
result = func(inputs, output_mms)
|
|
|
- log("Result: " + cast_e2s(result))
|
|
|
|
|
|
// 3) Split output dictionary back to seperate models
|
|
|
output_keys = dict_keys(outputs)
|
|
|
while (read_nr_out(output_keys) > 0):
|
|
|
key = set_pop(output_keys)
|
|
|
- log("Splitting " + key)
|
|
|
|
|
|
// Check if the destination model already exists
|
|
|
if (get_model_id(outputs[key]) == ""):
|
|
@@ -636,10 +607,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
// Model exists, so we overwrite
|
|
|
model_overwrite(result[key], get_model_id(outputs[key]))
|
|
|
|
|
|
- log("Finished")
|
|
|
-
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
- log("Manual operation starts!")
|
|
|
// Identical to model transformations, but give control to users for modification
|
|
|
// 1) Create empty instance of merged metamodel
|
|
|
Element input_model
|
|
@@ -671,9 +639,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
|
|
|
// 3) Transform
|
|
|
|
|
|
- log("Start modify")
|
|
|
modify(merged_model, True)
|
|
|
- log("Modify finished")
|
|
|
|
|
|
// 4) Split in different files depending on type
|
|
|
|
|
@@ -687,7 +653,6 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
split_off_model = model_split(merged_model, get_full_model(desired_metamodel_id), key + "/")
|
|
|
|
|
|
// Check if the destination model already exists
|
|
|
- log("Writing output to " + cast_v2s(outputs[key]))
|
|
|
if (get_model_id(outputs[key]) == ""):
|
|
|
// New model
|
|
|
model_create(split_off_model, outputs[key], user_id, desired_metamodel_id, "Model")
|
|
@@ -700,8 +665,6 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
// TODO find out whether it succeeded or not
|
|
|
result = True
|
|
|
else:
|
|
|
- log("Type name: " + exact_type)
|
|
|
- log("From " + transformation_id)
|
|
|
output("Did not know how to interpret model of type " + exact_type)
|
|
|
|
|
|
return result!
|
|
@@ -731,7 +694,6 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
|
tuple = set_pop(worklist)
|
|
|
element = tuple[0]
|
|
|
result = tuple[1]
|
|
|
- log("EXECUTING " + element)
|
|
|
|
|
|
// Find the type (to see what to do with it)
|
|
|
// this does not yet yield the type of transformation, if it is an Execution
|
|
@@ -772,8 +734,6 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
|
// This the difficult part!
|
|
|
|
|
|
result = enact_action(pm, element, prefix, user_id)
|
|
|
- log("Executed Exec of " + element)
|
|
|
- log("Result: " + cast_v2s(result))
|
|
|
|
|
|
elif (type == "Decision"):
|
|
|
// If the previous result is true, we add the normal one, otherwise the false one
|
|
@@ -789,7 +749,6 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
|
String next
|
|
|
while (read_nr_out(all_next) > 0):
|
|
|
next = set_pop(all_next)
|
|
|
- log("Queueing next: " + next)
|
|
|
set_add(worklist, create_tuple(next, result))
|
|
|
|
|
|
// Reached a finish element, so stop
|
|
@@ -887,7 +846,6 @@ Void function user_function_skip_init(user_id : String):
|
|
|
String process_id
|
|
|
|
|
|
output("Which process model do you want to execute?")
|
|
|
- log("Execute process!")
|
|
|
process_id = get_model_id(input())
|
|
|
if (process_id != ""):
|
|
|
if (allow_read(user_id, process_id)):
|
|
@@ -1010,7 +968,6 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
// 3) Transform
|
|
|
|
|
|
- log("EXECUTE TRANSFORMATION " + cast_e2s(read_attribute(core, transformation_id, "name")))
|
|
|
result = transform(merged_model, schedule_model)
|
|
|
output("Transformation executed with result: " + cast_v2s(result))
|
|
|
|
|
@@ -1044,35 +1001,23 @@ Void function user_function_skip_init(user_id : String):
|
|
|
String key
|
|
|
Element func
|
|
|
|
|
|
- log("Action Language execution starts!")
|
|
|
- log("Getting full model for transformation")
|
|
|
- log("Got model: " + cast_e2s(read_attribute(core, transformation_id, "location")))
|
|
|
-
|
|
|
// 1) Group source models in dictionary
|
|
|
// --> This is just the "inputs" variable, but resolve all references
|
|
|
- log("Create inputs")
|
|
|
new_inputs = create_node()
|
|
|
input_keys = dict_keys(inputs)
|
|
|
while (read_nr_out(input_keys) > 0):
|
|
|
key = set_pop(input_keys)
|
|
|
- log("Resolving " + cast_e2s(key))
|
|
|
- log(" --> " + cast_e2s(inputs[key]))
|
|
|
- log(" ID " + cast_e2s(get_model_id(inputs[key])))
|
|
|
- log(" full m " + cast_e2s(get_full_model(get_model_id(inputs[key]))))
|
|
|
dict_add(new_inputs, key, get_full_model(get_model_id(inputs[key])))
|
|
|
inputs = new_inputs
|
|
|
|
|
|
// 2) Execute action language model
|
|
|
func = get_func_AL_model(get_full_model(transformation_id))
|
|
|
- log("Ready to execute: " + cast_e2s(func))
|
|
|
result = func(inputs)
|
|
|
- log("Result: " + cast_e2s(result))
|
|
|
|
|
|
// 3) Split output dictionary back to seperate models
|
|
|
output_keys = dict_keys(outputs)
|
|
|
while (read_nr_out(output_keys) > 0):
|
|
|
key = set_pop(output_keys)
|
|
|
- log("Splitting " + key)
|
|
|
|
|
|
// Check if the destination model already exists
|
|
|
if (get_model_id(outputs[key]) == ""):
|
|
@@ -1082,10 +1027,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
// Model exists, so we overwrite
|
|
|
model_overwrite(result[key], get_model_id(outputs[key]))
|
|
|
|
|
|
- log("Finished")
|
|
|
-
|
|
|
elif (exact_type == "ManualOperation"):
|
|
|
- log("Manual operation starts!")
|
|
|
// Identical to model transformations, but give control to users for modification
|
|
|
// 1) Create empty instance of merged metamodel
|
|
|
Element input_model
|
|
@@ -1117,9 +1059,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
// 3) Transform
|
|
|
|
|
|
- log("Start modify")
|
|
|
modify(merged_model, True)
|
|
|
- log("Modify finished")
|
|
|
|
|
|
// 4) Split in different files depending on type
|
|
|
|
|
@@ -1265,7 +1205,6 @@ Void function user_function_skip_init(user_id : String):
|
|
|
String new_model_id
|
|
|
|
|
|
old_type_id = ""
|
|
|
- log("Adding MT language")
|
|
|
|
|
|
// Read involved formalisms
|
|
|
all_formalisms = create_node()
|
|
@@ -1300,9 +1239,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
String tracability_link
|
|
|
|
|
|
// New location is available, so write
|
|
|
- log("FUSE")
|
|
|
merged_formalism = model_fuse(set_copy(all_formalisms))
|
|
|
- log("Fuse OK")
|
|
|
model_create(merged_formalism, "__merged_" + name, user_id, type_id, "Model")
|
|
|
merged_formalism_id = get_model_id("__merged_" + name)
|
|
|
|
|
@@ -1313,9 +1250,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
instantiate_attribute(core, tracability_link, "type", "merged")
|
|
|
|
|
|
// Merge complete, now RAMify!
|
|
|
- log("RAM")
|
|
|
ramified_formalism = ramify(merged_formalism)
|
|
|
- log("RAMed")
|
|
|
model_create(ramified_formalism, name, user_id, type_id, "Model")
|
|
|
ramified_formalism_id = get_model_id(name)
|
|
|
|
|
@@ -1446,9 +1381,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
|
|
|
// Write out a merged metamodel containing all these models: this is the MM for the manual operation
|
|
|
// New location is available, so write
|
|
|
- log("FUSE")
|
|
|
merged_formalism = model_fuse(set_copy(all_formalisms))
|
|
|
- log("Fuse OK")
|
|
|
model_create(merged_formalism, "__merged_" + name, user_id, type_id, "Model")
|
|
|
merged_formalism_id = get_model_id("__merged_" + name)
|
|
|
|
|
@@ -1465,17 +1398,13 @@ Void function user_function_skip_init(user_id : String):
|
|
|
String link
|
|
|
String dst
|
|
|
|
|
|
- log("Adding inputs")
|
|
|
while (read_nr_out(source) > 0):
|
|
|
dst = set_pop(source)
|
|
|
- log(" for " + dst)
|
|
|
link = instantiate_link(core, "transformInput", "", model_id, dst)
|
|
|
instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
|
|
|
- log("Adding outputs")
|
|
|
while (read_nr_out(target) > 0):
|
|
|
dst = set_pop(target)
|
|
|
- log(" for " + dst)
|
|
|
link = instantiate_link(core, "transformOutput", "", model_id, dst)
|
|
|
instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
else:
|
|
@@ -1525,15 +1454,10 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output("Name of Action Language model?")
|
|
|
name = input()
|
|
|
|
|
|
- log("Add AL is fine!")
|
|
|
if (get_model_id(name) == ""):
|
|
|
// Finished with all information, now create the model itself!
|
|
|
output("Waiting for model constructors...")
|
|
|
- log("AL model: " + cast_e2s(get_model_id("ActionLanguage")))
|
|
|
- log("Location: " + cast_e2s(read_attribute(core, get_model_id("ActionLanguage"), "location")))
|
|
|
- log("Imported: " + cast_e2s(import_node(read_attribute(core, get_model_id("ActionLanguage"), "location"))))
|
|
|
add_code_model(get_full_model(get_model_id("ActionLanguage")), "AL/" + name, construct_function())
|
|
|
- log("Exported to " + cast_e2s(import_node("AL/" + name)))
|
|
|
model_create(import_node("AL/" + name), name, user_id, get_model_id("ActionLanguage"), "ActionLanguage")
|
|
|
model_id = get_model_id(name)
|
|
|
|
|
@@ -1541,17 +1465,13 @@ Void function user_function_skip_init(user_id : String):
|
|
|
String link
|
|
|
String dst
|
|
|
|
|
|
- log("Adding inputs")
|
|
|
while (read_nr_out(source) > 0):
|
|
|
dst = set_pop(source)
|
|
|
- log(" for " + dst)
|
|
|
link = instantiate_link(core, "transformInput", "", model_id, dst)
|
|
|
instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
|
|
|
- log("Adding outputs")
|
|
|
while (read_nr_out(target) > 0):
|
|
|
dst = set_pop(target)
|
|
|
- log(" for " + dst)
|
|
|
link = instantiate_link(core, "transformOutput", "", model_id, dst)
|
|
|
instantiate_attribute(core, link, "name", read_attribute(core, dst, "name"))
|
|
|
else:
|