wrappers.rst 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. Wrappers
  2. ========
  3. Several wrappers can be defined for the Modelverse, as the Modelverse is merely a service running externally.
  4. To communicate effectively, and automatically, a programming language wrapper is recommended.
  5. Nonetheless, it is possible to communicatie manually as well.
  6. These are some of the implemented wrappers.
  7. Prompt
  8. ------
  9. The simplest wrapper is the prompt wrapper, which merely sends the input and output directly to the user.
  10. This wrapper has almost no code, but requires users to manually decide which content to send next.
  11. It has no built-in integration with any model or action language compilers.
  12. Nonetheless, it is an easy way to test out the raw communication protocol manually.
  13. Python
  14. ------
  15. The first real wrapper is the Python-based wrapper.
  16. It provides a set of functions for use by Python code.
  17. These functions wrap not only the interface, but also provides simple error handling through the use of Python exceptions and contains the model and action language compilers.
  18. An overview of all functions and associatied exceptions is provided below.
  19. All operations happen *synchronously*, meaning that they block until the Modelverse has performed the requested operation.
  20. Note that some functions are only applicable in a certain *context*.
  21. In practice, this means that you should first issue the *init* and *login* operations, as otherwise your connection with the Modelverse will not have started up yet.
  22. Functions
  23. ^^^^^^^^^
  24. .. function:: init(address_param="http://127.0.0.1:8001", timeout=20.0)
  25. Explanation of init.
  26. .. function:: login(username, password)
  27. Explanation
  28. .. function:: model_add(model_name, metamodel_name, model_code=None)
  29. Explanation
  30. .. function:: upload_code(code)
  31. Expl
  32. .. function:: model_delete(model_name)
  33. Expl
  34. .. function:: model_list()
  35. Expl
  36. .. function:: model_list_full()
  37. Expl
  38. .. function:: verify(model_name)
  39. Expl
  40. .. function:: model_overwrite(model_name, new_model_code=None)
  41. Expl
  42. .. function:: user_logout()
  43. Expl
  44. .. function:: user_delete()
  45. Expl
  46. .. function:: model_render(model_name, mapper_name)
  47. Expl
  48. .. function:: transformation_between(source, target)
  49. Expl
  50. .. function:: transformation_add_MT_language(metamodels, RAMified_name)
  51. Expl
  52. .. function:: transformation_add_MT(RAMified_metamodel, source_metamodels, target_metamodels, operation_name, code)
  53. Expl
  54. .. function:: transformation_add_AL(source_metamodels, target_metamodels, operation_name, code)
  55. Expl
  56. .. function:: transformation_add_MANUAL(source_metamodels, target_metamodels, operation_name)
  57. Expl
  58. .. function:: transformation_execute_AL(operation_name, input_models_dict, output_models_dict, callback=lambda i: None)
  59. Expl
  60. .. function:: transformation_execute_MANUAL(operation_name, input_models_dict, output_models_dict, callback=lambda i: None)
  61. Expl
  62. .. function:: transformation_execute_MT(operation_name, input_models_dict, output_models_dict, callback=lambda i: None)
  63. Expl
  64. .. function:: transformation_list()
  65. Expl
  66. .. function:: transformation_RAMify(metamodel_name, RAMified_metamodel_name)
  67. Expl
  68. .. function:: process_execute(process_name, prefix, callbacks)
  69. Expl
  70. .. function:: permission_modify()
  71. Expl
  72. .. function:: permission_owner()
  73. Expl
  74. .. function:: permission_group()
  75. Expl
  76. .. function:: group_create()
  77. Expl
  78. .. function:: group_delete()
  79. Expl
  80. .. function:: group_owner_add()
  81. Expl
  82. .. function:: group_owner_delete()
  83. Expl
  84. .. function:: group_join()
  85. Expl
  86. .. function:: group_kick()
  87. Expl
  88. .. function:: admin_promote()
  89. Expl
  90. .. function:: admin_demote()
  91. Expl
  92. .. function:: element_list(model_name)
  93. Expl
  94. .. function:: types(model_name)
  95. Expl
  96. .. function:: types_full(model_name)
  97. Expl
  98. .. function:: read(model_name, ID)
  99. Expl
  100. .. function:: read_attrs(model_name, ID)
  101. Expl
  102. .. function:: instantiate(model_name, typename, edge=None, ID="")
  103. Expl
  104. .. function:: delete_element(model_name, ID)
  105. Expl
  106. .. function:: attr_assign(model_name, ID, attr, value)
  107. Expl
  108. .. function:: attr_assign_code(model_name, ID, attr, code)
  109. Expl
  110. .. function:: attr_delete(model_name, ID, attr)
  111. Expl
  112. .. function:: read_outgoing(model_name, ID, typename)
  113. Expl
  114. .. function:: read_incoming(model_name, ID, typename)
  115. Expl
  116. .. function:: read_association_source(model_name, ID)
  117. Expl
  118. .. function:: read_association_destination(model_name, ID)
  119. Expl
  120. Exceptions
  121. ^^^^^^^^^^
  122. .. exception:: ModelverseException
  123. Expl
  124. .. exception:: UnknownError
  125. Expl
  126. .. exception:: UnknownIdentifier
  127. Expl
  128. .. exception:: UnknownType
  129. Expl
  130. .. exception:: NotAnAssociation
  131. Expl
  132. .. exception:: UnsupportedValue
  133. Expl
  134. .. exception:: CompilationError
  135. Expl
  136. .. exception:: NoSuchAttribute
  137. Expl
  138. .. exception:: UnknownModel
  139. Expl
  140. .. exception:: ConnectionError
  141. Expl
  142. .. exception:: ModelExists
  143. Expl
  144. .. exception:: PermissionDenied
  145. Expl
  146. .. exception:: InvalidMode
  147. Expl
  148. .. exception:: InterfaceMismatch
  149. Expl
  150. Custom
  151. ------
  152. Other wrappers can be made as desired, in whatever language required.
  153. This is due to the fact that the Modelverse communicates only through XML/HTTPRequests.
  154. As such, all languages that support this, can simply mimic the interface used by any of the implemented wrappers.