|
@@ -1036,37 +1036,71 @@ String function cmd_process_execute(process : String, prefix : String):
|
|
|
else:
|
|
|
return "Model not found: " + process!
|
|
|
|
|
|
-String function cmd_transformation_between(source_name : String, target_name : String):
|
|
|
- String source_id
|
|
|
- String target_id
|
|
|
- Element onSource
|
|
|
- Element onTarget
|
|
|
+String function cmd_transformation_between(source_dict : String, target_dict : String):
|
|
|
Element result
|
|
|
- String transformation
|
|
|
+ Element subresult
|
|
|
+ String tag
|
|
|
+ String mm
|
|
|
+ String mm_id
|
|
|
+ Element links
|
|
|
+ String link
|
|
|
+ Element keys
|
|
|
|
|
|
- log("Finding transformation from " + source_name + " to " + target_name)
|
|
|
- source_id = get_entry_id(source_name)
|
|
|
- if (source_id != ""):
|
|
|
- target_id = get_entry_id(target_name)
|
|
|
-
|
|
|
- if (target_id != ""):
|
|
|
- onSource = allAssociationOrigins(core, source_id, "transformInput")
|
|
|
- onTarget = allAssociationOrigins(core, target_id, "transformOutput")
|
|
|
-
|
|
|
- result = set_overlap(onSource, onTarget)
|
|
|
-
|
|
|
- String r
|
|
|
- r = "Success: "
|
|
|
- while (set_len(result) > 0):
|
|
|
- transformation = set_pop(result)
|
|
|
- if (allow_read(current_user_id, transformation)):
|
|
|
- r = r + string_join(full_name(transformation), "\n")
|
|
|
- log("Found: " + full_name(transformation))
|
|
|
- return r!
|
|
|
+ log("Finding transformation from " + dict_to_string(source_dict) + " to " + dict_to_string(target_dict))
|
|
|
+ result = allInstances(core, "Transformation")
|
|
|
+
|
|
|
+ // Iterate over all inputs
|
|
|
+ keys = dict_keys(source_dict)
|
|
|
+ while (set_len(keys) > 0):
|
|
|
+ subresult = set_create()
|
|
|
+ tag = set_pop(keys)
|
|
|
+ mm = source_dict[tag]
|
|
|
+ mm_id = get_entry_id(mm)
|
|
|
+
|
|
|
+ if (mm_id != ""):
|
|
|
+ links = allIncomingAssociationInstances(core, mm_id, "transformInput")
|
|
|
+
|
|
|
+ while (set_len(links) > 0):
|
|
|
+ link = set_pop(links)
|
|
|
+ if (value_eq(read_attribute(core, link, "name"), tag)):
|
|
|
+ // Correct tag, so make transformation a possibility
|
|
|
+ set_add(subresult, readAssociationSource(core, link))
|
|
|
else:
|
|
|
- return "Model not found: " + target_name!
|
|
|
- else:
|
|
|
- return "Model not found: " + source_name!
|
|
|
+ return "Model not found: " + mm!
|
|
|
+
|
|
|
+ // Got a set of subresults now, which we use to find the overlap
|
|
|
+ result = set_overlap(result, subresult)
|
|
|
+
|
|
|
+ keys = dict_keys(target_dict)
|
|
|
+ while (set_len(keys) > 0):
|
|
|
+ subresult = set_create()
|
|
|
+ tag = set_pop(keys)
|
|
|
+ mm = target_dict[tag]
|
|
|
+ mm_id = get_entry_id(mm)
|
|
|
+
|
|
|
+ if (mm_id != ""):
|
|
|
+ links = allIncomingAssociationInstances(core, mm_id, "transformOutput")
|
|
|
+
|
|
|
+ while (set_len(links) > 0):
|
|
|
+ link = set_pop(links)
|
|
|
+ if (value_eq(read_attribute(core, link, "name"), tag)):
|
|
|
+ // Correct tag, so make transformation a possibility
|
|
|
+ set_add(subresult, readAssociationSource(core, link))
|
|
|
+ else:
|
|
|
+ return "Model not found: " + mm!
|
|
|
+
|
|
|
+ // Got a set of subresults now, which we use to find the overlap
|
|
|
+ result = set_overlap(result, subresult)
|
|
|
+
|
|
|
+ String r
|
|
|
+ String transformation
|
|
|
+ r = "Success: "
|
|
|
+ while (set_len(result) > 0):
|
|
|
+ transformation = set_pop(result)
|
|
|
+ if (allow_read(current_user_id, transformation)):
|
|
|
+ r = r + string_join(full_name(transformation), "\n")
|
|
|
+ log("Found: " + full_name(transformation))
|
|
|
+ return r!
|
|
|
|
|
|
String function cmd_model_rendered(model_name : String, mapper_name : String):
|
|
|
Element trace_links
|
|
@@ -1605,6 +1639,7 @@ String function transformation_add(source_models : Element, target_models : Elem
|
|
|
keys = dict_keys(source)
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
+ log("Add transformInput link for " + model_id + " to " + cast_v2s(source[key]) + " while adding operation " + operation_name)
|
|
|
link = instantiate_link(core, "transformInput", "", model_id, source[key])
|
|
|
instantiate_attribute(core, link, "name", key)
|
|
|
|
|
@@ -1740,6 +1775,7 @@ String function cmd_transformation_add_MT(source_models : Element, target_models
|
|
|
while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
dst = source[key]
|
|
|
+ log("Add transformInput link for " + model_id + " to " + dst + " while adding operation " + operation_name)
|
|
|
link = instantiate_link(core, "transformInput", "", model_id, dst)
|
|
|
instantiate_attribute(core, link, "name", key)
|
|
|
|
|
@@ -2136,7 +2172,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
elif (cmd == "process_execute"):
|
|
|
output(cmd_process_execute(single_input("Process to execute?"), single_input("Model prefix to use?")))
|
|
|
elif (cmd == "transformation_between"):
|
|
|
- output(cmd_transformation_between(single_input("Source type?"), single_input("Target type?")))
|
|
|
+ output(cmd_transformation_between(dict_input("Source signature?"), dict_input("Target signature?")))
|
|
|
elif (cmd == "model_render"):
|
|
|
output(cmd_model_render(single_input("Model name?"), single_input("Mapper name?"), single_input("Rendered name?")))
|
|
|
elif (cmd == "model_rendered"):
|