process_enactment.rst 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Process Enactment
  2. =================
  3. A final operation that is useful to modellers, is the enactment of process models.
  4. When enacting a process model, a series of operations on models is automatically executed.
  5. Finding process models
  6. ----------------------
  7. To find process models, you can easily query the Modelverse for models that conform to *ProcessModel*.
  8. All such models can be executed, given that the models and operations they refer to, exist.
  9. Enacting process models
  10. -----------------------
  11. To enact the process model, such as *query_state_space*, you must execute the following operation::
  12. >>> process_execute("query_state_space", "my_", {})
  13. There are three parameters to this function, the first obviously being the name of the process model, as shown in *model_list*.
  14. The second parameter is a prefix for the models used in the process model.
  15. When executing a process model, data is processed and produced.
  16. By providing a prefix, the names of these models are first prefixed with the prefix, before they are resolved.
  17. As such, it becomes possible to execute a process in different contexts.
  18. .. note::
  19. This behaviour is likely to change in the future, with the process taking a mapping from the terms in the process model, to actual names.
  20. The third parameter is a dictionary of callbacks.
  21. For each activity, it is possible for users to define a callback function.
  22. This function will be invoked when the specific activity is executed.
  23. For example, a manual operation will require user input, for which this callback function can then serve.
  24. In this case, lets assume that an activity in the process model, termed *refine_petrinet*, is a manual operation and requires user interaction.
  25. The call then becomes::
  26. >>> def callback():
  27. ... # Any code required to create the Petrinet
  28. ... p = instantiate(None, "Place")
  29. ... t = instantiate(None, "Transition")
  30. ... instantiate(None, "P2T", (p, t))
  31. ... # Alternatively, we could have used raw_input() or so to prompt the user
  32. ...
  33. >>> process_execute("query_state_space", "my_", {"refine_petrinet": callback})
  34. When the process executes *refine_petrinet*, the callback function is executed, and the manual operation is terminated when the function terminates.
  35. Other types of operation, such as *model transformations* and *action language* can also have a callback function, but this is usually less important to end users and is therefore not elaborated on here.