|
@@ -15,13 +15,20 @@ Void function main():
|
|
|
// Initialize the Core Formalism
|
|
|
String core_location
|
|
|
String core_model
|
|
|
+ String core_model_location
|
|
|
+ String core_formalism_model
|
|
|
+ String scd_location
|
|
|
+ String scd_model
|
|
|
String admin_group
|
|
|
String admin_user
|
|
|
|
|
|
+ scd_location = "models/SimpleClassDiagrams"
|
|
|
core_location = "models/CoreFormalism"
|
|
|
+ core_model_location = "models/core"
|
|
|
|
|
|
// Create the Model itself and make public
|
|
|
core = instantiate_model(import_node(core_location))
|
|
|
+ export_node(core_model_location, core)
|
|
|
|
|
|
// Create admin group
|
|
|
admin_group = instantiate_node(core, "Group", "")
|
|
@@ -37,11 +44,34 @@ Void function main():
|
|
|
instantiate_link(core, "ownedBy", "", admin_group, admin_user)
|
|
|
instantiate_link(core, "belongsTo", "", admin_user, admin_group)
|
|
|
|
|
|
+ // Add the SimpleClassDiagrams formalism already
|
|
|
+ scd_model = instantiate_node(core, "Model", "")
|
|
|
+ instantiate_attribute(core, scd_model, "name", "SimpleClassDiagrams")
|
|
|
+ instantiate_attribute(core, scd_model, "location", scd_location)
|
|
|
+ instantiate_attribute(core, scd_model, "permissions", "221")
|
|
|
+ instantiate_link(core, "instanceOf", "", scd_model, scd_model)
|
|
|
+
|
|
|
+ // Make necessary links for the formalism to the owners
|
|
|
+ instantiate_link(core, "group", "", scd_model, admin_group)
|
|
|
+ instantiate_link(core, "owner", "", scd_model, admin_user)
|
|
|
+
|
|
|
// Add the core formalism already
|
|
|
+ core_formalism_model = instantiate_node(core, "Model", "")
|
|
|
+ instantiate_attribute(core, core_formalism_model, "name", "CoreFormalism")
|
|
|
+ instantiate_attribute(core, core_formalism_model, "location", core_location)
|
|
|
+ instantiate_attribute(core, core_formalism_model, "permissions", "221")
|
|
|
+ instantiate_link(core, "instanceOf", "", core_formalism_model, scd_model)
|
|
|
+
|
|
|
+ // Make necessary links for the formalism to the owners
|
|
|
+ instantiate_link(core, "group", "", core_formalism_model, admin_group)
|
|
|
+ instantiate_link(core, "owner", "", core_formalism_model, admin_user)
|
|
|
+
|
|
|
+ // Add the core model
|
|
|
core_model = instantiate_node(core, "Model", "")
|
|
|
- instantiate_attribute(core, core_model, "name", "CoreFormalism")
|
|
|
- instantiate_attribute(core, core_model, "location", core_location)
|
|
|
- instantiate_attribute(core, core_model, "permissions", "220")
|
|
|
+ instantiate_attribute(core, core_model, "name", "core")
|
|
|
+ instantiate_attribute(core, core_model, "location", core_model_location)
|
|
|
+ instantiate_attribute(core, core_model, "permissions", "200")
|
|
|
+ instantiate_link(core, "instanceOf", "", core_model, core_formalism_model)
|
|
|
|
|
|
// Make necessary links for the formalism to the owners
|
|
|
instantiate_link(core, "group", "", core_model, admin_group)
|
|
@@ -201,7 +231,7 @@ Void function model_create(model : Element, name : String, user_id : String, typ
|
|
|
String model_id
|
|
|
|
|
|
location = "/models/" + cast_id2s(model)
|
|
|
- export_node(model, location)
|
|
|
+ export_node(location, model)
|
|
|
|
|
|
// Manage meta-info
|
|
|
model_id = instantiate_node(core, "Model", "")
|
|
@@ -218,7 +248,7 @@ Void function model_overwrite(model : Element, name : String):
|
|
|
String model_id
|
|
|
|
|
|
location = "/models/" + cast_id2s(model)
|
|
|
- export_node(model, location)
|
|
|
+ export_node(location, model)
|
|
|
model_id = get_model_id(name)
|
|
|
|
|
|
// Change location in meta-data
|
|
@@ -241,41 +271,41 @@ Void function user_function_skip_init(user_id : String):
|
|
|
cmd = input()
|
|
|
if (cmd == "help"):
|
|
|
output("Model operations")
|
|
|
- output(" model_add -- Add a new model")
|
|
|
- output(" model_modify -- Modify an existing model")
|
|
|
- output(" model_delete -- [TODO] Delete a model and all related transformations")
|
|
|
- output(" model_list -- List all models")
|
|
|
- output(" model_list_full -- List all models with full info")
|
|
|
- output(" model_overwrite -- Overwrites a model with an uploaded model, leaving all metadata")
|
|
|
+ output(" model_add -- Add a new model")
|
|
|
+ output(" model_modify -- Modify an existing model")
|
|
|
+ output(" model_delete -- [TODO] Delete a model and all related transformations")
|
|
|
+ output(" model_list -- List all models")
|
|
|
+ output(" model_list_full -- List all models with full info")
|
|
|
+ output(" model_overwrite -- Overwrites a model with an uploaded model, leaving all metadata")
|
|
|
output("")
|
|
|
output("Transformation-specific operations")
|
|
|
- output(" transformation_add_MT_language -- Create a RAMified metamodel")
|
|
|
- output(" transformation_reRAMify -- RAMify a merged metamodel again")
|
|
|
- output(" transformation_add_MT -- Initialize a new model transformation")
|
|
|
- output(" transformation_add_AL -- [TODO] Initialize a new action language transformation")
|
|
|
- output(" transformation_add_EXT -- [TODO] Initialize a new external tool transformation")
|
|
|
- output(" transformation_execute -- Execute a transformation on a set of input models")
|
|
|
+ output(" transformation_add_MT_language -- Create a RAMified metamodel")
|
|
|
+ output(" transformation_reRAMify -- RAMify a merged metamodel again")
|
|
|
+ output(" transformation_add_MT -- Initialize a new model transformation")
|
|
|
+ output(" transformation_add_AL -- [TODO] Initialize a new action language transformation")
|
|
|
+ output(" transformation_add_EXT -- [TODO] Initialize a new external tool transformation")
|
|
|
+ output(" transformation_execute -- Execute a transformation on a set of input models")
|
|
|
output("")
|
|
|
output("Model permission operations")
|
|
|
- output(" permission_modify -- Change model permissions")
|
|
|
- output(" permission_owner -- Change model owner")
|
|
|
- output(" permission_group -- Change model group")
|
|
|
+ output(" permission_modify -- Change model permissions")
|
|
|
+ output(" permission_owner -- Change model owner")
|
|
|
+ output(" permission_group -- Change model group")
|
|
|
output("")
|
|
|
output("Group operations")
|
|
|
- output(" group_create -- Create a group")
|
|
|
- output(" group_delete -- Delete a group")
|
|
|
- output(" group_owner_add -- Add group owner")
|
|
|
- output(" group_owner_delete -- Remove group owner")
|
|
|
- output(" group_join -- Add someone to your group")
|
|
|
- output(" group_kick -- Kick someone from your group")
|
|
|
- output(" group_list -- List all groups you are a member of")
|
|
|
+ output(" group_create -- Create a group")
|
|
|
+ output(" group_delete -- Delete a group")
|
|
|
+ output(" group_owner_add -- Add group owner")
|
|
|
+ output(" group_owner_delete -- Remove group owner")
|
|
|
+ output(" group_join -- Add someone to your group")
|
|
|
+ output(" group_kick -- Kick someone from your group")
|
|
|
+ output(" group_list -- List all groups you are a member of")
|
|
|
output("")
|
|
|
output("Admin operations")
|
|
|
- output(" admin_promote -- Promote a user to admin status")
|
|
|
- output(" admin_demote -- Demote a user to normal status")
|
|
|
+ output(" admin_promote -- Promote a user to admin status")
|
|
|
+ output(" admin_demote -- Demote a user to normal status")
|
|
|
output("")
|
|
|
output("General operations")
|
|
|
- output(" account_delete -- Remove current user and revoke all permissions ")
|
|
|
+ output(" account_delete -- Remove current user and revoke all permissions ")
|
|
|
|
|
|
elif (cmd == "model_add"):
|
|
|
// Model addition operation, which uses model upload commands of the compiler
|
|
@@ -382,7 +412,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
// Need to fall back to the default approach, which is way slower
|
|
|
// 1) Create empty instance of merged metamodel
|
|
|
|
|
|
- ramified_metamodel_id = followAssociation(core, transformation_id, "instanceOf")
|
|
|
+ ramified_metamodel_id = set_pop(followAssociation(core, transformation_id, "instanceOf"))
|
|
|
trace_links = allOutgoingAssociationInstances(core, ramified_metamodel_id, "tracability")
|
|
|
merged_metamodel_id = ""
|
|
|
while (read_nr_out(trace_links) > 0):
|
|
@@ -416,7 +446,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
output_keys = dict_keys(outputs)
|
|
|
while (read_nr_out(output_keys) > 0):
|
|
|
key = set_pop(output_keys)
|
|
|
- desired_metamodel_id = followAssociation(core, outputs[key], "instanceOf")
|
|
|
+ desired_metamodel_id = set_pop(followAssociation(core, outputs[key], "instanceOf"))
|
|
|
split_off_model = model_split(merged_model, import_node(read_attribute(core, desired_metamodel_id, "location")), key)
|
|
|
|
|
|
// Check if the destination model already exists
|
|
@@ -449,9 +479,9 @@ Void function user_function_skip_init(user_id : String):
|
|
|
model_id = get_model_id(input())
|
|
|
if (model_id == ""):
|
|
|
if (allow_write(user_id, model_id)):
|
|
|
- if (allow_read(user_id, followAssociation(core, model_id, "instanceOf"))):
|
|
|
+ if (allow_read(user_id, set_pop(followAssociation(core, model_id, "instanceOf")))):
|
|
|
output("Waiting for model constructors...")
|
|
|
- new_model = construct_model_raw(import_node(read_attribute(core, followAssociation(core, model_id, "instanceOf"), "location")))
|
|
|
+ new_model = construct_model_raw(import_node(read_attribute(core, set_pop(followAssociation(core, model_id, "instanceOf")), "location")))
|
|
|
model_overwrite(new_model, model_id)
|
|
|
output("Model overwrite success!")
|
|
|
else:
|
|
@@ -502,7 +532,11 @@ Void function user_function_skip_init(user_id : String):
|
|
|
models = allInstances(core, "Model")
|
|
|
while (read_nr_out(models) > 0):
|
|
|
m = set_pop(models)
|
|
|
- output(string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(allAssociationDestinations(core, m, "instanceOf")), "name")))
|
|
|
+ log("at " + cast_e2s(m))
|
|
|
+ log("Name: " + cast_v2s(read_attribute(core, m, "name")))
|
|
|
+ log("Instance of " + cast_e2s(set_pop(followAssociation(core, m, "instanceOf"))))
|
|
|
+ log("Name: " + cast_e2s(read_attribute(core, set_pop(followAssociation(core, m, "instanceOf")), "name")))
|
|
|
+ output(string_join((string_join(" ", read_attribute(core, m, "name")) + " : "), read_attribute(core, set_pop(followAssociation(core, m, "instanceOf")), "name")))
|
|
|
|
|
|
elif (cmd == "model_list_full"):
|
|
|
// List all models with full info
|
|
@@ -580,7 +614,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
merged_formalism = model_fuse(all_formalisms)
|
|
|
|
|
|
location = "/models/" + cast_id2s(merged_formalism)
|
|
|
- export_node(merged_formalism, location)
|
|
|
+ export_node(location, merged_formalism)
|
|
|
|
|
|
// Manage meta-info
|
|
|
new_model_id = instantiate_node(core, "Model", "")
|
|
@@ -601,7 +635,7 @@ Void function user_function_skip_init(user_id : String):
|
|
|
ramified_formalism = ramify(merged_formalism)
|
|
|
|
|
|
location = "/models/" + cast_id2s(ramified_formalism)
|
|
|
- export_node(ramified_formalism, location)
|
|
|
+ export_node(location, ramified_formalism)
|
|
|
|
|
|
// Manage meta-info
|
|
|
new_model_id = instantiate_node(core, "Model", "")
|