|
@@ -12,7 +12,6 @@ include "metamodels.alh"
|
|
|
|
|
|
Element core = ?
|
|
|
|
|
|
-String scd_location = "models/SimpleClassDiagrams"
|
|
|
String core_location = "models/CoreFormalism"
|
|
|
String core_model_location = "models/core"
|
|
|
|
|
@@ -28,12 +27,14 @@ Void function main():
|
|
|
String core_formalism
|
|
|
Element scd
|
|
|
|
|
|
- scd = initialize_SCD(scd_location)
|
|
|
+ String scd_location
|
|
|
+ scd_location = "models/SimpleClassDiagrams"
|
|
|
+ scd = import_node(scd_location)
|
|
|
|
|
|
// Create the Model itself and make public
|
|
|
core_formalism = import_node(core_location)
|
|
|
core = instantiate_model(core_formalism)
|
|
|
- export_node(core_model_location, core)
|
|
|
+ export_node(core_model_location, core["model"])
|
|
|
|
|
|
// Switch all new users to the user_function
|
|
|
// This accesses the bootstrap level, so do not change this unless you know what you are doing
|
|
@@ -82,7 +83,7 @@ Void function main():
|
|
|
// 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, "location", scd_location + "/model")
|
|
|
instantiate_attribute(core, scd_model, "permissions", "221")
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", scd_model, scd_model)
|
|
|
instantiate_attribute(core, instance_of, "type_mapping", scd["type_mapping"])
|
|
@@ -94,7 +95,7 @@ Void function main():
|
|
|
// 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, "location", core_location + "/model")
|
|
|
instantiate_attribute(core, core_formalism_model, "permissions", "221")
|
|
|
instance_of = instantiate_link(core, "instanceOf", "", core_formalism_model, scd_model)
|
|
|
instantiate_attribute(core, instance_of, "type_mapping", core_formalism["type_mapping"])
|
|
@@ -124,12 +125,10 @@ Void function main():
|
|
|
// Note that if there are no admin users left, it will be very difficult to manage, as nobody will have admin permissions!
|
|
|
return !
|
|
|
|
|
|
-Element function get_full_model(model_id : String):
|
|
|
- Element m
|
|
|
+String function get_instanceOf_link(model_id : String):
|
|
|
Element all_links
|
|
|
String choice
|
|
|
|
|
|
- m = create_node()
|
|
|
all_links = allOutgoingAssociationInstances(core, model_id, "instanceOf")
|
|
|
|
|
|
if (read_nr_out(all_links) > 1):
|
|
@@ -139,9 +138,24 @@ Element function get_full_model(model_id : String):
|
|
|
|
|
|
choice = set_pop(allOutgoingAssociationInstances(core, model_id, "instanceOf"))
|
|
|
|
|
|
+ return choice!
|
|
|
+
|
|
|
+Element function get_full_model(model_id : String):
|
|
|
+ Element m
|
|
|
+ Element all_links
|
|
|
+ String choice
|
|
|
+
|
|
|
+ choice = get_instanceOf_link(model_id)
|
|
|
+
|
|
|
+ m = create_node()
|
|
|
dict_add(m, "model", import_node(read_attribute(core, model_id, "location")))
|
|
|
dict_add(m, "type_mapping", read_attribute(core, choice, "type_mapping"))
|
|
|
- dict_add(m, "metamodel", import_node(read_attribute(core, readAssociationDestination(core, choice), "location")))
|
|
|
+
|
|
|
+ if (readAssociationDestination(core, choice) == model_id):
|
|
|
+ // Found the meta-circular level, so we can stop!
|
|
|
+ dict_add(m, "metamodel", m)
|
|
|
+ else:
|
|
|
+ dict_add(m, "metamodel", get_full_model(readAssociationDestination(core, choice)))
|
|
|
|
|
|
return m!
|
|
|
|
|
@@ -349,6 +363,7 @@ Void function model_create(model : Element, name : String, user_id : String, typ
|
|
|
|
|
|
Void function model_overwrite(model : Element, model_id : String):
|
|
|
String location
|
|
|
+ String instanceOf_link
|
|
|
|
|
|
location = "/models/" + cast_id2s(model)
|
|
|
export_node(location, model["model"])
|
|
@@ -357,6 +372,10 @@ Void function model_overwrite(model : Element, model_id : String):
|
|
|
unset_attribute(core, model_id, "location")
|
|
|
instantiate_attribute(core, model_id, "location", location)
|
|
|
|
|
|
+ instanceOf_link = get_instanceOf_link(model_id)
|
|
|
+ unset_attribute(core, instanceOf_link, "type_mapping")
|
|
|
+ instantiate_attribute(core, instanceOf_link, "type_mapping", model["type_mapping"])
|
|
|
+
|
|
|
return!
|
|
|
|
|
|
Boolean function check_is_typed_by(model_id : String, metamodel_id : String):
|