interaction.rst 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Basic Interaction
  2. =================
  3. As previously mentioned during the installation phase, the Modelverse is merely a collection of scripts.
  4. We briefly present how the Modelverse is structured, and introduce the most important scripts for general use.
  5. A more elaborate view on the architecture and the different scripts is only required for developers of the Modelverse.
  6. Simplified Architecture
  7. -----------------------
  8. The Modelverse architecture consists of three core concepts, which will be referred to throughout the documentation.
  9. Modelverse State (MvS)
  10. ^^^^^^^^^^^^^^^^^^^^^^
  11. The Modelverse State (MvS) is the memory of the Modelverse, and contains all data pertaining to it.
  12. This includes not only the different models created by the users, but also all metamodels, transformations, operations, but also all bootstrap files.
  13. Furthermore, it includes all execution state of operations being executed in the Modelverse.
  14. As such, the Modelverse State is the database of the Modelverse, which is the only component containing data.
  15. Only developers will ever have to directly interface with the Modelverse State.
  16. Modelverse Kernel (MvK)
  17. ^^^^^^^^^^^^^^^^^^^^^^^
  18. The Modelverse Kernel (MvK) is the execution core of the Modelverse, and connects to the Modelverse State to fetch the instructions to execute.
  19. All its execution information is stored in the MvS as well, and therefore it has to (theoretically) query the MvS for each and every instruction.
  20. It merely consists of a set of model transformation rules which take the current state of the MvS, and do a set of modifications on it.
  21. Only developers will ever have to directly interface with the Modelverse Kernel.
  22. Modelverse Interface (MvI)
  23. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  24. The Modelverse Interface (MvI) is the actual interface used by most users of the Modelverse.
  25. It provides any type of interface, whether it be graphical, textual, or any other interface.
  26. While this is the component that users interact with, there should be no (meta-)modelling knowledge whatsoever in this part, as it is only responsible for providing a user-friendly interface to the Modelverse.
  27. This component can make use of the provided wrapper, which does the binding with the Modelverse.
  28. Necessary scripts
  29. -----------------
  30. The Modelverse consists of a set of scripts.
  31. For most users, there are only three relevant scripts, none of them taking parameters:
  32. 1. *run_tests.py*, which runs all tests.
  33. 2. *run_local_modelverse.py*, which starts up a local Modelverse server, combining the MvS and MvK.
  34. 3. *prompt.py*, which connects to the local Modelverse and provides a minimal raw interface.
  35. Wrapper
  36. -------
  37. In addition to these scripts, we provide a simple Python-based wrapper for the Modelverse.
  38. As the Modelverse can run as a service, wrappers can be created in any language that supports XML/HTTPRequests.
  39. By default, a Python wrapper is provided, which is discussed in this documentation.
  40. This Python wrapper was used by a variety of MvI implementations supported today.
  41. Tools can include all Modelverse operations merely by including the *modelverse.py* file from the *wrappers* folder.
  42. The wrapper provides all necessary (meta-)modelling operations that can be used by the MvI.
  43. As the Modelverse is independent of its (visual/textual) user interface, we only discuss the Modelverse wrapper in this documentation.
  44. The wrapper functions are explained through the use of examples, in a tutorial-like fashion.
  45. A full overview of all wrapper functions is also provided at the end of the documentation.
  46. Initializing the Modelverse
  47. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  48. Before we start, we must connect to the Modelverse.
  49. This can be done by executing the operation *init*::
  50. >>> init("http://modelverse.uantwerpen.be")
  51. This assumes that there is a Modelverse running at the specified address.
  52. It is also possible to work fully locally.
  53. For that, you must start up a Modelverse at your own system by invoking the command::
  54. python scripts/run_local_modelverse.py
  55. Afterwards, connect to the local Modelverse through the usual *init* operation.
  56. Note that, for a local Modelverse, the init can be left empty::
  57. >>> init()
  58. Logging in
  59. ^^^^^^^^^^
  60. Now that we are connected to the Modelverse, we need to log in.
  61. Without logging in, the Modelverse has no clue which operations are permitted, and which models are readable, or even writable.
  62. To log in, use the *login* operation::
  63. >>> login("yentl", "secret password")
  64. The operation will succeed if it terminates normally, and throw a Python exception otherwise.
  65. When the username does not exist yet, it is created upon invocation.
  66. The provided password can be used in subsequent invocations of the Modelverse to login as this user again.
  67. If this command finished successfully, the Modelverse is ready to be used.