|
@@ -30,9 +30,9 @@ String function get_instanceOf_link(model_id : String, metamodel_id : String):
|
|
|
|
|
|
all_links = set_overlap(allOutgoingAssociationInstances(core, model_id, "instanceOf"), allIncomingAssociationInstances(core, metamodel_id, "instanceOf"))
|
|
|
|
|
|
- if (read_nr_out(all_links) > 1):
|
|
|
+ if (set_len(all_links) > 1):
|
|
|
log("WARNING: multiple instanceOf relations were detected for this model; picking one at random!")
|
|
|
- elif (read_nr_out(all_links) == 0):
|
|
|
+ elif (set_len(all_links) == 0):
|
|
|
log("ERROR: untyped model; crashing")
|
|
|
log("Instance model: " + cast_v2s(read_attribute(core, model_id, "name")))
|
|
|
log("Type model: " + cast_v2s(read_attribute(core, metamodel_id, "name")))
|
|
@@ -124,7 +124,7 @@ Boolean function allow_group_modify(user_id : String, group_id : String):
|
|
|
// Is admin, so always allow
|
|
|
return True!
|
|
|
else:
|
|
|
- if (read_nr_out(set_overlap(allIncomingAssociationInstances(core, user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))) > 0):
|
|
|
+ if (set_len(set_overlap(allIncomingAssociationInstances(core, user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))) > 0):
|
|
|
// We are an owner
|
|
|
return True!
|
|
|
else:
|
|
@@ -187,7 +187,7 @@ String function get_model_id(name : String):
|
|
|
String model
|
|
|
|
|
|
models = allInstances(core, "Model")
|
|
|
- while (read_nr_out(models) > 0):
|
|
|
+ while (set_len(models) > 0):
|
|
|
model = set_pop(models)
|
|
|
if (value_eq(name, read_attribute(core, model, "name"))):
|
|
|
return model!
|
|
@@ -201,7 +201,7 @@ String function get_service_id(name : String):
|
|
|
services = allInstances(core, "Service")
|
|
|
|
|
|
log("Search " + name)
|
|
|
- while (read_nr_out(services) > 0):
|
|
|
+ while (set_len(services) > 0):
|
|
|
service = set_pop(services)
|
|
|
log("Check " + cast_v2s(read_attribute(core, service, "name")))
|
|
|
if (value_eq(read_attribute(core, service, "name"), name)):
|
|
@@ -216,7 +216,7 @@ String function get_user_id(name : String):
|
|
|
|
|
|
users = allInstances(core, "User")
|
|
|
|
|
|
- while (read_nr_out(users) > 0):
|
|
|
+ while (set_len(users) > 0):
|
|
|
user = set_pop(users)
|
|
|
if (value_eq(read_attribute(core, user, "name"), name)):
|
|
|
return user!
|
|
@@ -228,7 +228,7 @@ String function get_group_id(name : String):
|
|
|
String group
|
|
|
|
|
|
groups = allInstances(core, "Group")
|
|
|
- while (read_nr_out(groups) > 0):
|
|
|
+ while (set_len(groups) > 0):
|
|
|
group = set_pop(groups)
|
|
|
if (value_eq(read_attribute(core, group, "name"), name)):
|
|
|
return group!
|
|
@@ -303,7 +303,7 @@ Boolean function pm_finished(worklist : Element, pm : String):
|
|
|
// If so, we can already finish, and therefore will stop immediately
|
|
|
finished = allInstances(pm, "Finish")
|
|
|
i = 0
|
|
|
- cnt = read_nr_out(finished)
|
|
|
+ cnt = set_len(finished)
|
|
|
|
|
|
while (i < cnt):
|
|
|
// Check each finished element individually
|
|
@@ -347,13 +347,13 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
String edge
|
|
|
input_metamodels = dict_create()
|
|
|
iter = allOutgoingAssociationInstances(core, operation_id, "transformInput")
|
|
|
- while (read_nr_out(iter) > 0):
|
|
|
+ while (set_len(iter) > 0):
|
|
|
edge = set_pop(iter)
|
|
|
dict_add(input_metamodels, read_attribute(core, edge, "name"), read_attribute(core, readAssociationDestination(core, edge), "name"))
|
|
|
|
|
|
output_metamodels = dict_create()
|
|
|
iter = allOutgoingAssociationInstances(core, operation_id, "transformOutput")
|
|
|
- while (read_nr_out(iter) > 0):
|
|
|
+ while (set_len(iter) > 0):
|
|
|
edge = set_pop(iter)
|
|
|
dict_add(output_metamodels, read_attribute(core, edge, "name"), read_attribute(core, readAssociationDestination(core, edge), "name"))
|
|
|
|
|
@@ -362,7 +362,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
exact_type = read_type(core, operation_id)
|
|
|
trace_links = allOutgoingAssociationInstances(core, operation_id, "tracability")
|
|
|
merged_metamodel_id = ""
|
|
|
- while (read_nr_out(trace_links) > 0):
|
|
|
+ while (set_len(trace_links) > 0):
|
|
|
trace_link_id = set_pop(trace_links)
|
|
|
if (value_eq(read_attribute(core, trace_link_id, "type"), "operatesOn")):
|
|
|
merged_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
@@ -372,16 +372,16 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
if (merged_metamodel_id != ""):
|
|
|
model_tuples = set_create()
|
|
|
keys = dict_keys(input_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(input_models[key]), get_model_id(input_metamodels[key]))))
|
|
|
|
|
|
merged_model = model_join(model_tuples, get_full_model(merged_metamodel_id, get_model_id("SimpleClassDiagrams")), tracability_model)
|
|
|
else:
|
|
|
- if (bool_and(read_nr_out(input_models) == 1, read_nr_out(output_models) == 0)):
|
|
|
+ if (bool_and(dict_len(input_models) == 1, dict_len(output_models) == 0)):
|
|
|
// Just skip the merge...
|
|
|
- merged_model = model_copy(get_full_model(get_model_id(set_read(input_models)), get_model_id(set_read(input_metamodels))))
|
|
|
- elif (bool_and(read_nr_out(input_models) == 0, read_nr_out(output_models) == 0)):
|
|
|
+ merged_model = model_copy(get_full_model(get_model_id(input_models[set_pop(dict_keys(input_models))]), get_model_id(input_metamodels[set_pop(dict_keys(input_metamodels))])))
|
|
|
+ elif (bool_and(dict_len(input_models) == 0, dict_len(output_models) == 0)):
|
|
|
merged_model = read_root()
|
|
|
else:
|
|
|
log("Could not resolve intermediate merged metamodel")
|
|
@@ -393,7 +393,7 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
if (exact_type == "ModelTransformation"):
|
|
|
trace_links = allOutgoingAssociationInstances(core, merged_metamodel_id, "tracability")
|
|
|
ramified_metamodel_id = ""
|
|
|
- while (read_nr_out(trace_links) > 0):
|
|
|
+ while (set_len(trace_links) > 0):
|
|
|
trace_link_id = set_pop(trace_links)
|
|
|
if (value_eq(read_attribute(core, trace_link_id, "type"), "RAMified")):
|
|
|
ramified_metamodel_id = readAssociationDestination(core, trace_link_id)
|
|
@@ -422,18 +422,12 @@ Element function execute_operation(operation_id : String, input_models : Element
|
|
|
if (result):
|
|
|
model_tuples = set_create()
|
|
|
keys = dict_keys(output_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
set_add(model_tuples, create_tuple(key, get_full_model(get_model_id(output_models[key]), get_model_id(output_metamodels[key]))))
|
|
|
|
|
|
result = model_split(merged_model, model_tuples, tracability)
|
|
|
|
|
|
- //log("Output models:")
|
|
|
- //keys = dict_keys(result)
|
|
|
- //while (read_nr_out(keys) > 0):
|
|
|
- // key = set_pop(keys)
|
|
|
- // log((cast_v2s(key) + " --> ") + cast_v2s(read_nr_out(result[key]["model"])))
|
|
|
-
|
|
|
if (tracability):
|
|
|
Element new_tracability_model
|
|
|
new_tracability_model = result["__tracability"]
|
|
@@ -477,14 +471,14 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
|
|
|
// Find all input model names
|
|
|
lst = allOutgoingAssociationInstances(pm, element, "Consumes")
|
|
|
- while (read_nr_out(lst) > 0):
|
|
|
+ while (set_len(lst) > 0):
|
|
|
consume = set_pop(lst)
|
|
|
value = read_attribute(pm, readAssociationDestination(pm, consume), "name")
|
|
|
dict_add(inputs, read_attribute(pm, consume, "name"), prefix + value)
|
|
|
|
|
|
// Find all output model names and their metamodel
|
|
|
lst = allOutgoingAssociationInstances(pm, element, "Produces")
|
|
|
- while (read_nr_out(lst) > 0):
|
|
|
+ while (set_len(lst) > 0):
|
|
|
produce = set_pop(lst)
|
|
|
elem = readAssociationDestination(pm, produce)
|
|
|
type_name = read_attribute(pm, elem, "type")
|
|
@@ -509,7 +503,7 @@ Boolean function enact_action(pm : Element, element : String, prefix : String, u
|
|
|
return False!
|
|
|
else:
|
|
|
keys = dict_keys(result)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
if (get_model_id(output_map[key]) == ""):
|
|
|
// New model
|
|
@@ -533,7 +527,7 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
|
// Initialize Join counters
|
|
|
counters = dict_create()
|
|
|
join_nodes = allInstances(pm, "Join")
|
|
|
- while (read_nr_out(join_nodes) > 0):
|
|
|
+ while (set_len(join_nodes) > 0):
|
|
|
dict_add(counters, set_pop(join_nodes), 0)
|
|
|
|
|
|
// Create the worklist with the Start instance as first element
|
|
@@ -567,7 +561,7 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
|
// Now check whether we have enough tokens to execute the Join itself
|
|
|
Integer required
|
|
|
Integer got
|
|
|
- required = read_nr_out(allIncomingAssociationInstances(pm, element, "Next")) + read_nr_out(allIncomingAssociationInstances(pm, element, "Else"))
|
|
|
+ required = set_len(allIncomingAssociationInstances(pm, element, "Next")) + set_len(allIncomingAssociationInstances(pm, element, "Else"))
|
|
|
got = counters[element]
|
|
|
if (got == required):
|
|
|
// Reset counter to 0
|
|
@@ -600,7 +594,7 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
|
|
|
Element all_next
|
|
|
all_next = allAssociationDestinations(pm, element, "Next")
|
|
|
String next
|
|
|
- while (read_nr_out(all_next) > 0):
|
|
|
+ while (set_len(all_next) > 0):
|
|
|
next = set_pop(all_next)
|
|
|
set_add(worklist, create_tuple(next, result))
|
|
|
|
|
@@ -720,7 +714,7 @@ String function cmd_transformation_between(user_id : String, source_name : Strin
|
|
|
|
|
|
String r
|
|
|
r = "Success: "
|
|
|
- while (read_nr_out(result) > 0):
|
|
|
+ while (set_len(result) > 0):
|
|
|
transformation = set_pop(result)
|
|
|
if (allow_read(user_id, transformation)):
|
|
|
r = r + string_join(read_attribute(core, transformation, "name"), "\n")
|
|
@@ -764,7 +758,7 @@ String function cmd_model_render(user_id : String, model_name : String, mapper_n
|
|
|
// Fetch the output types
|
|
|
output_map = dict_create()
|
|
|
out_links = allOutgoingAssociationInstances(core, mapper_ID, "transformOutput")
|
|
|
- while(read_nr_out(out_links) > 0):
|
|
|
+ while(set_len(out_links) > 0):
|
|
|
link = set_pop(out_links)
|
|
|
dict_add(output_map, read_attribute(core, link, "name"), read_attribute(core, readAssociationDestination(core, link), "name"))
|
|
|
|
|
@@ -832,7 +826,7 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
inputs = dict_create()
|
|
|
|
|
|
sources = allOutgoingAssociationInstances(core, transformation_id, "transformInput")
|
|
|
- while (read_nr_out(sources) > 0):
|
|
|
+ while (set_len(sources) > 0):
|
|
|
source = set_pop(sources)
|
|
|
assoc_name = read_attribute(core, source, "name")
|
|
|
if (dict_in(source_models, assoc_name)):
|
|
@@ -860,7 +854,7 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
targets = allOutgoingAssociationInstances(core, transformation_id, "transformOutput")
|
|
|
outputs = dict_create()
|
|
|
output_map = dict_create()
|
|
|
- while (read_nr_out(targets) > 0):
|
|
|
+ while (set_len(targets) > 0):
|
|
|
target = set_pop(targets)
|
|
|
assoc_name = read_attribute(core, target, "name")
|
|
|
if (dict_in(target_models, assoc_name)):
|
|
@@ -896,7 +890,7 @@ String function cmd_transformation_execute(user_id : String, transformation_name
|
|
|
return "Failure"!
|
|
|
else:
|
|
|
keys = dict_keys(result)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
|
|
|
if (get_model_id(outputs[key]) == ""):
|
|
@@ -1014,7 +1008,7 @@ String function cmd_model_list():
|
|
|
|
|
|
result = "Success: "
|
|
|
models = allInstances(core, "Model")
|
|
|
- while (read_nr_out(models) > 0):
|
|
|
+ while (set_len(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
result = (result + string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name"))) + "\n"
|
|
|
return result!
|
|
@@ -1032,7 +1026,7 @@ String function cmd_model_list_full():
|
|
|
|
|
|
result = "Success: "
|
|
|
models = allInstances(core, "Model")
|
|
|
- while (read_nr_out(models) > 0):
|
|
|
+ while (set_len(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
permissions = read_attribute(core, m, "permissions")
|
|
|
owner = read_attribute(core, set_pop(allAssociationDestinations(core, m, "owner")), "name")
|
|
@@ -1071,7 +1065,7 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
formalism_map = set_create()
|
|
|
|
|
|
keys = dict_keys(source_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = source_models[key]
|
|
|
model_id = get_model_id(name)
|
|
@@ -1090,7 +1084,7 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
return "Model not found: " + name!
|
|
|
|
|
|
keys = dict_keys(target_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = target_models[key]
|
|
|
model_id = get_model_id(name)
|
|
@@ -1111,7 +1105,7 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
if (get_model_id(operation_name) == ""):
|
|
|
// Write out a merged metamodel containing all these models: this is the MM for the manual operation
|
|
|
// New location is available, so write
|
|
|
- if (bool_not(bool_and(read_nr_out(source_models) == 0, read_nr_out(target_models) == 0))):
|
|
|
+ if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
|
merged_formalism = model_fuse(set_copy(formalism_map))
|
|
|
modify(merged_formalism, True)
|
|
|
|
|
@@ -1127,12 +1121,12 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
model_create(import_node("AL/" + operation_name), operation_name, user_id, get_model_id("ActionLanguage"), "ActionLanguage")
|
|
|
model_id = get_model_id(operation_name)
|
|
|
|
|
|
- if (bool_not(bool_and(read_nr_out(source_models) == 0, read_nr_out(target_models) == 0))):
|
|
|
+ if (bool_not(bool_and(dict_len(source_models) == 0, dict_len(target_models) == 0))):
|
|
|
model_create(merged_formalism, "__merged_" + operation_name, user_id, get_model_id("SimpleClassDiagrams"), "Model")
|
|
|
merged_formalism_id = get_model_id("__merged_" + operation_name)
|
|
|
|
|
|
// Add tracability links at this level
|
|
|
- while (read_nr_out(all_formalisms) > 0):
|
|
|
+ while (set_len(all_formalisms) > 0):
|
|
|
source_formalism_id = set_pop(all_formalisms)
|
|
|
tracability_link = instantiate_link(core, "tracability", "", merged_formalism_id, source_formalism_id)
|
|
|
instantiate_attribute(core, tracability_link, "type", "merged")
|
|
@@ -1145,13 +1139,13 @@ String function transformation_add(user_id : String, source_models : Element, ta
|
|
|
String dst
|
|
|
|
|
|
keys = dict_keys(source)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
link = instantiate_link(core, "transformInput", "", model_id, source[key])
|
|
|
instantiate_attribute(core, link, "name", key)
|
|
|
|
|
|
keys = dict_keys(target)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
link = instantiate_link(core, "transformOutput", "", model_id, target[key])
|
|
|
instantiate_attribute(core, link, "name", key)
|
|
@@ -1190,14 +1184,14 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
to_ramify = set_create()
|
|
|
|
|
|
keys = dict_keys(source_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = source_models[key]
|
|
|
model_id = get_model_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, name)):
|
|
|
// Check whether or not it is SimpleClassDiagrams
|
|
|
- if (read_nr_out(get_instanceOf_links(model_id, get_model_id("SimpleClassDiagrams"))) > 0):
|
|
|
+ if (set_len(get_instanceOf_links(model_id, get_model_id("SimpleClassDiagrams"))) > 0):
|
|
|
if (bool_not(dict_in(source, key))):
|
|
|
dict_add(source, key, model_id)
|
|
|
set_add(to_ramify, create_tuple(key, get_full_model(model_id, get_model_id("SimpleClassDiagrams"))))
|
|
@@ -1211,13 +1205,13 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
return "Model not found: " + name!
|
|
|
|
|
|
keys = dict_keys(target_models)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
name = target_models[key]
|
|
|
model_id = get_model_id(name)
|
|
|
if (model_id != ""):
|
|
|
if (allow_read(user_id, name)):
|
|
|
- if (read_nr_out(get_instanceOf_links(model_id, get_model_id("SimpleClassDiagrams"))) > 0):
|
|
|
+ if (set_len(get_instanceOf_links(model_id, get_model_id("SimpleClassDiagrams"))) > 0):
|
|
|
if (bool_not(dict_in(target, key))):
|
|
|
if (dict_in(source, key)):
|
|
|
if (value_eq(model_id, source[key])):
|
|
@@ -1271,14 +1265,14 @@ String function cmd_transformation_add_MT(user_id : String, source_models : Elem
|
|
|
String dst
|
|
|
|
|
|
keys = dict_keys(source)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
dst = source[key]
|
|
|
link = instantiate_link(core, "transformInput", "", model_id, dst)
|
|
|
instantiate_attribute(core, link, "name", key)
|
|
|
|
|
|
keys = dict_keys(target)
|
|
|
- while (read_nr_out(keys) > 0):
|
|
|
+ while (set_len(keys) > 0):
|
|
|
key = set_pop(keys)
|
|
|
dst = target[key]
|
|
|
link = instantiate_link(core, "transformOutput", "", model_id, dst)
|
|
@@ -1297,7 +1291,7 @@ String function cmd_transformation_list():
|
|
|
|
|
|
result = "Success: "
|
|
|
models = allInstances(core, "Transformation")
|
|
|
- while (read_nr_out(models) > 0):
|
|
|
+ while (set_len(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
result = result + ((string_join(("[" + read_type(core, m)) + "]", string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name")))) + "\n")
|
|
|
|
|
@@ -1316,7 +1310,7 @@ String function cmd_transformation_list_full():
|
|
|
|
|
|
result = ""
|
|
|
models = allInstances(core, "Transformation")
|
|
|
- while (read_nr_out(models) > 0):
|
|
|
+ while (set_len(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
permissions = read_attribute(core, m, "permissions")
|
|
|
owner = read_attribute(core, set_pop(allAssociationDestinations(core, m, "owner")), "name")
|
|
@@ -1438,12 +1432,12 @@ String function cmd_group_owner_add(user_id : String, group_name : String, other
|
|
|
Element overlap
|
|
|
|
|
|
overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
- if (read_nr_out(overlap) == 0):
|
|
|
+ if (set_len(overlap) == 0):
|
|
|
instantiate_link(core, "owner", "", group_id, other_user_id)
|
|
|
|
|
|
overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
|
|
|
- if (read_nr_out(overlap) == 0):
|
|
|
+ if (set_len(overlap) == 0):
|
|
|
instantiate_link(core, "belongsTo", "", other_user_id, group_id)
|
|
|
|
|
|
return "Success"!
|
|
@@ -1469,9 +1463,9 @@ String function cmd_group_owner_delete(user_id : String, group_name : String, ot
|
|
|
Element overlap
|
|
|
|
|
|
overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
- if (read_nr_out(overlap) > 0):
|
|
|
+ if (set_len(overlap) > 0):
|
|
|
overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
- if (read_nr_out(overlap) > 0):
|
|
|
+ if (set_len(overlap) > 0):
|
|
|
model_delete_element(core, set_pop(overlap))
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -1498,7 +1492,7 @@ String function cmd_group_join(user_id : String, group_name : String, other_user
|
|
|
Element overlap
|
|
|
overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
|
|
|
- if (read_nr_out(overlap) == 0):
|
|
|
+ if (set_len(overlap) == 0):
|
|
|
instantiate_link(core, "belongsTo", "", other_user_id, group_id)
|
|
|
return "Success"!
|
|
|
else:
|
|
@@ -1523,12 +1517,12 @@ String function cmd_group_kick(user_id : String, group_name : String, other_user
|
|
|
Element overlap
|
|
|
overlap = set_overlap(allOutgoingAssociationInstances(core, other_user_id, "belongsTo"), allIncomingAssociationInstances(core, group_id, "belongsTo"))
|
|
|
|
|
|
- if (read_nr_out(overlap) > 0):
|
|
|
+ if (set_len(overlap) > 0):
|
|
|
model_delete_element(core, set_pop(overlap))
|
|
|
|
|
|
// Check if user was an owner as well
|
|
|
overlap = set_overlap(allIncomingAssociationInstances(core, other_user_id, "owner"), allOutgoingAssociationInstances(core, group_id, "owner"))
|
|
|
- if (read_nr_out(overlap) > 0):
|
|
|
+ if (set_len(overlap) > 0):
|
|
|
model_delete_element(core, set_pop(overlap))
|
|
|
|
|
|
return "Success"!
|
|
@@ -1550,7 +1544,7 @@ String function cmd_group_list(user_id : String):
|
|
|
|
|
|
result = ""
|
|
|
groups = allAssociationDestinations(core, user_id, "belongsTo")
|
|
|
- while (read_nr_out(groups) > 0):
|
|
|
+ while (set_len(groups) > 0):
|
|
|
group_id = set_pop(groups)
|
|
|
if (set_in(allOutgoingAssociationInstances(core, group_id, "owner"), user_id)):
|
|
|
admin = " A "
|
|
@@ -1637,12 +1631,12 @@ String function cmd_transformation_signature(user_id : String, transformation_na
|
|
|
|
|
|
result = "Success: "
|
|
|
inputs = allOutgoingAssociationInstances(core, model_id, "transformInput")
|
|
|
- while (read_nr_out(inputs) > 0):
|
|
|
+ while (set_len(inputs) > 0):
|
|
|
elem = set_pop(inputs)
|
|
|
result = string_join(string_join(string_join(string_join("I ", read_attribute(core, elem, "name")), " "), read_attribute(core, readAssociationDestination(core, elem), "name")), "\n")
|
|
|
|
|
|
outputs = allOutgoingAssociationInstances(core, model_id, "transformOutput")
|
|
|
- while (read_nr_out(outputs) > 0):
|
|
|
+ while (set_len(outputs) > 0):
|
|
|
elem = set_pop(outputs)
|
|
|
result = string_join(string_join(string_join(string_join("O ", read_attribute(core, elem, "name")), " "), read_attribute(core, readAssociationDestination(core, elem), "name")), "\n")
|
|
|
|