Переглянути джерело

Updated documentation on MvC and mini_modify

Yentl Van Tendeloo 8 роки тому
батько
коміт
a66ad33dca
3 змінених файлів з 163 додано та 181 видалено
  1. 0 23
      core/mini_modify.alc
  2. 98 0
      doc/mini_modify.rst
  3. 65 158
      doc/mvc.rst

+ 0 - 23
core/mini_modify.alc

@@ -33,9 +33,6 @@ Element function modify(model : Element, write : Boolean):
 				output("  attr_add_code -- Add a coded attribute to an element")
 				output("  attr_del      -- Delete an attribute of an element")
 				output("  attr_modify   -- Modify an attribute of an element")
-				output("  constrain     -- Add a constraint function to the model")
-				output("  rename        -- Rename an existing element")
-				output("  modify        -- Modify the attributes of an element")
 				output("  retype        -- Change the type of an element")
 				output("  upload        -- Upload a completely new model")
 			else:
@@ -190,26 +187,6 @@ Element function modify(model : Element, write : Boolean):
 			else:
 				output("Permission denied")
 
-		elif (cmd == "rename"):
-			if (write):
-				output("Old name?")
-				String old_name_e
-				old_name_e = input()
-				if (dict_in(model["model"], old_name_e)):
-					output("New name?")
-					String new_name_e
-					new_name_e = input()
-					if (dict_in(model["model"], new_name_e)):
-						output("New name already used; aborting")
-					else:
-						dict_add(model["model"], new_name_e, model["model"][old_name_e])
-						dict_delete(model["model"], old_name_e)
-						output("Rename complete!")
-				else:
-					output("Unknown element; aborting")
-			else:
-				output("Permission denied")
-
 		elif (cmd == "nice_list"):
 			Element keys_m
 			String type

+ 98 - 0
doc/mini_modify.rst

@@ -0,0 +1,98 @@
+Model Modification Interface
+============================
+
+Model operations are grouped into a separate category of operations, as they work at the model-level instead of the root-level.
+In the MvC, these operations can only be executed after a *model_modify* operation.
+We distinguish two modes of access: read/write, and read-only.
+Read-only commands are always available (given that the model itself can be opened in the MvC layer), whereas read/write operations are only optionally visible.
+
+Read-only
+---------
+
+The first set of operations are the read-only operations.
+
+list
+^^^^
+
+Get a list of all elements in the model.
+Ignores hidden elements (*i.e.*, name starts with __), as these are artefacts of other operations.
+
+list_full
+^^^^^^^^^
+
+Get a full list of all elements in the model.
+
+nice_list
+^^^^^^^^^
+
+Get a pretty-printed list of alle elements in the model, including the value of their attributes.
+
+types
+^^^^^
+
+Get a list of all elements that can be instantiated in the metamodel.
+Ignores hidden elements of the metamodel.
+
+read
+^^^^
+
+Get detailed information on a specific element.
+
+verify
+^^^^^^
+
+Check if the model conforms to its resolved metamodel.
+
+exit
+^^^^
+
+Exit the model modification interface.
+
+Read/Write
+----------
+
+The second set of operations are the read/write operations, which are able to alter the model.
+Note that in the Modelverse, changes are immediately visible to other users as well.
+
+instantiate
+^^^^^^^^^^^
+
+Instantiate an element of the metamodel.
+This only creates the raw element, without any of its slots filled in or any associations.
+Used for both nodes and edges (classes and associations).
+
+delete
+^^^^^^
+
+Delete an element of the model.
+For nodes (classes), all related associations are removed as well.
+
+attr_add
+^^^^^^^^
+
+Instantiate a new attribute for this element.
+
+attr_add_code
+^^^^^^^^^^^^^
+
+Instantiate a new attribute for this element, using the code constructors for the value.
+
+attr_del
+^^^^^^^^
+
+Remove an attribute value of this element.
+
+attr_modify
+^^^^^^^^^^^
+
+Modify an existing attribute of this element.
+
+retype
+^^^^^^
+
+Change the type of an element.
+
+upload
+^^^^^^
+
+Overwrite the current model with an uploaded model through the model constructors.

+ 65 - 158
doc/mvc.rst

@@ -33,272 +33,179 @@ model_add
 Adds a new model to the Modelverse.
 Model content is specified using model constructors, which can be generated with the model compiler.
 
-Script:
-
-    +-----------------------------------+--------------------+
-    | Modelverse                        | Client             |
-    +===================================+====================+
-    | Creating new model!               |                    |
-    +-----------------------------------+--------------------+
-    | Model type?                       |                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_type         |
-    +-----------------------------------+--------------------+
-    | Model name?                       |                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_name         |
-    +-----------------------------------+--------------------+
-    | Waiting for model constructors... |                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_constructors |
-    +-----------------------------------+--------------------+
-    | Model upload success!             |                    |
-    +-----------------------------------+--------------------+
-
 model_modify
 ^^^^^^^^^^^^
 
-    +-----------------------------------+--------------------+
-    | Modelverse                        | Client             |
-    +===================================+====================+
-    | Which model do you want to modify?|                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_name         |
-    +-----------------------------------+--------------------+
-    | << mini_modify >>                 |                    |
-    +-----------------------------------+--------------------+
+Switches the interface to model-scope operations of a specific model.
 
 model_list
 ^^^^^^^^^^
 
-    +-----------------------------------+--------------------+
-    | Modelverse                        | Client             |
-    +===================================+====================+
-    | model_A : Model_A                 |                    |
-    +-----------------------------------+--------------------+
-    | model_A : Model_A                 |                    |
-    +-----------------------------------+--------------------+
-    | ...                               |                    |
-    +-----------------------------------+--------------------+
-    | model_Z : Model_Z                 |                    |
-    +-----------------------------------+--------------------+
+Give an overview list of all models, showing their name and type.
 
 model_list_full
 ^^^^^^^^^^^^^^^
 
-    +---------------------------------------+--------------------+
-    | Modelverse                            | Client             |
-    +=======================================+====================+
-    |   123  user group   model_A : Model_A |                    |
-    +---------------------------------------+--------------------+
-    |   123  user group   model_B : Model_B |                    |
-    +---------------------------------------+--------------------+
-    | ...                                   |                    |
-    +---------------------------------------+--------------------+
-    |   123  user group   model_Z : Model_Z |                    |
-    +---------------------------------------+--------------------+
+Give a detailed overview list of all models, showing their name, type, permissions, owner, and group.
 
 model_overwrite
 ^^^^^^^^^^^^^^^
 
-    +-----------------------------------+--------------------+
-    | Modelverse                        | Client             |
-    +===================================+====================+
-    | Which model to overwrite?         |                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_name         |
-    +-----------------------------------+--------------------+
-    | Waiting for model constructors... |                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_constructors |
-    +-----------------------------------+--------------------+
-    | Model overwrite success!          |                    |
-    +-----------------------------------+--------------------+
+Overwrite an existing model. Similar to *model_add*, but keeps existing meta-information to the model intact.
 
 verify
 ^^^^^^
 
-    +-----------------------------------+--------------------+
-    | Modelverse                        | Client             |
-    +===================================+====================+
-    | Which model to verify?            |                    |
-    +-----------------------------------+--------------------+
-    |                                   | model_name         |
-    +-----------------------------------+--------------------+
-    | OK                                |                    |
-    +-----------------------------------+--------------------+
+Verify whether a model conforms to the specified metamodels.
 
 Transformation-specific operations
 ----------------------------------
 
+The second set of operations are specific to model transformations.
+
 transformation_add_MT_language
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-    +------------------------------------------------------+--------------------+
-    | Modelverse                                           | Client             |
-    +======================================================+====================+
-    | Formalisms to include (terminate with empty string)? |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_A       |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_B       |
-    +------------------------------------------------------+--------------------+
-    |                                                      | ...                |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_Z       |
-    +------------------------------------------------------+--------------------+
-    |                                                      | <<empty string>>   |
-    +------------------------------------------------------+--------------------+
-    | Name of the RAMified transformation metamodel?       |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name         |
-    +------------------------------------------------------+--------------------+
-
+Create a new RAMified metamodel out of several existing metamodels.
+The generated metamodel can be used to instantiate a model transformation.
 
 transformation_add_MT
 ^^^^^^^^^^^^^^^^^^^^^
 
-    +------------------------------------------------------+--------------------+
-    | Modelverse                                           | Client             |
-    +======================================================+====================+
-    | RAMified metamodel to use?                           |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name         |
-    +------------------------------------------------------+--------------------+
-    | Supported metamodels:                                |                    |
-    +------------------------------------------------------+--------------------+
-    |    model_A                                           |                    |
-    +------------------------------------------------------+--------------------+
-    |    model_B                                           |                    |
-    +------------------------------------------------------+--------------------+
-    |    ...                                               |                    |
-    +------------------------------------------------------+--------------------+
-    |    model_Z                                           |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      |                    |
-    +------------------------------------------------------+--------------------+
-    | Which one do you want to use as source (...)?        |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_A       |
-    +------------------------------------------------------+--------------------+
-    | Model added as source                                |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_B       |
-    +------------------------------------------------------+--------------------+
-    | Model added as source                                |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | ...                |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_Z       |
-    +------------------------------------------------------+--------------------+
-    | Model added as source                                |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | <<empty string>>   |
-    +------------------------------------------------------+--------------------+
-    | Which one do you want to use as target (...)?        |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_A       |
-    +------------------------------------------------------+--------------------+
-    | Model added as target                                |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_B       |
-    +------------------------------------------------------+--------------------+
-    | Model added as target                                |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | ...                |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name_Z       |
-    +------------------------------------------------------+--------------------+
-    | Model added as target                                |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | <<empty string>>   |
-    +------------------------------------------------------+--------------------+
-    | Name of new transformation?                          |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_name         |
-    +------------------------------------------------------+--------------------+
-    | Waiting for model constructors...                    |                    |
-    +------------------------------------------------------+--------------------+
-    |                                                      | model_constructors |
-    +------------------------------------------------------+--------------------+
+Add a new model transformation schedule, including the rules.
 
 transformation_add_AL
 ^^^^^^^^^^^^^^^^^^^^^
 
+Add a new action language model that operates on models.
+
 transformation_add_MANUAL
 ^^^^^^^^^^^^^^^^^^^^^^^^^
 
+Add a new manual model transformation.
+
 transformation_execute
 ^^^^^^^^^^^^^^^^^^^^^^
 
+Execute an existing transformation. Automatically finds out the type and executes the relevant interface.
+
 transformation_list
 ^^^^^^^^^^^^^^^^^^^
 
+List known transformations and their type.
+
 transformation_list_full
 ^^^^^^^^^^^^^^^^^^^^^^^^
 
+List known transformations and their type, as well as permissions, owner, and group.
+
 transformation_detail
 ^^^^^^^^^^^^^^^^^^^^^
 
+Give details on a single transformation, such as the source and target formalisms.
+
 transformation_RAMify
 ^^^^^^^^^^^^^^^^^^^^^
 
+RAMify an existing metamodel again.
+Useful if the related metamodel has changed.
+
 Process operations
 ------------------
 
+The third set of operations is related to the execution and operation on an FTG+PM.
+
 process_execute
 ^^^^^^^^^^^^^^^
 
+Execute an existing process model.
+
 Model permission operations
 ---------------------------
 
+The fourth set of operations is related to model access control management.
+
 permission_modify
 ^^^^^^^^^^^^^^^^^
 
+Modifies the permission of a specified model.
+
 permission_owner
 ^^^^^^^^^^^^^^^^
 
+Modifies the owner of a specified model.
+
 permission_group
 ^^^^^^^^^^^^^^^^
 
+Modifies the group of a specified model.
+
 Group operations
 ----------------
 
+The fifth set of operations is related to the management of groups.
+
 group_create
 ^^^^^^^^^^^^
 
+Create a new group, and become its administrator.
+
 group_delete
 ^^^^^^^^^^^^
 
+Delete a group for which you are administrator.
+
 group_owner_add
 ^^^^^^^^^^^^^^^
 
+Add a new user as administrator to a group of which you are an administrator.
+
 group_owner_delete
 ^^^^^^^^^^^^^^^^^^
 
+Remove a user as administrator from a group of which you are an administrator.
+
 group_join
 ^^^^^^^^^^
 
+Add a new user to a group of which you are an administrator.
+
 group_kick
 ^^^^^^^^^^
 
+Remove a user from a group of which you are an administrator.
+
 group_list
 ^^^^^^^^^^
 
+List all known groups.
+
 Admin operations
 ----------------
 
+The sixth set of operations is related to administrator operations.
+
 admin_promote
 ^^^^^^^^^^^^^
 
+Promote another user as administrator as well.
+
 admin_demote
 ^^^^^^^^^^^^
 
+Demote another user from administrator status.
+
 General operations
 ------------------
 
+The final set of operations consists of miscellaneous operations.
+
 self-destruct
 ^^^^^^^^^^^^^
 
+Destroy the current user, revoking all permissions of owning models.
+
 exit
 ^^^^
+
+Exit the current task, while keeping the user intact.