README.md 4.3 KB

Installation

Installing the Modelverse is unnecessary, as it is mere Python code and doesn't use installation scripts. All scripts which are generally useful are found in the 'scripts' directory, and are written in OS-independent Python code.

You will, however, need to install a dependency: the SCCD compiler and runtime.

Starting up the Modelverse

Starting up the Modelverse is easy: simply execute the scripts/run_local_modelverse.py script, with as parameter the port you want to use. By default, port 8001 is used.

Communicating with the Modelverse

Now that the Modelverse is running, you will want to communicate with it! To do this, you can use whatever tool you want, as long as it can send and receive XML/HTTPRequests. For example, a mere internet browser can already communicate with the Modelverse, though not in the most user-friendly way.

A nicer way is through the Python prompt script scripts/prompt.py. After that, it will print out all the output of the Modelverse, and send in all your queries directly to the Modelverse.

Python wrapper

To automatically communicate with the Modelverse in a programmatic way, a Python wrapper is provided. This wrapper is found in wrappers/modelverse.py, and provides Python functions that make the necessary Modelverse requests. At the moment, not all functions are implemented in the wrapper yet.

Performance

Performance of the Modelverse is currently rather low. This is primarily caused by the reliance on the action language, which is an explicitly modelled (and interpreted) language. Additionally, the Modelverse runs remotely, meaning that all requests have to pass over the network. Even when this is executed on the same machine, this causes quite some overhead.

Additional documentation

Some additional documentation can be found online in the Modelverse techreport, describing the internal workings of the Modelverse, as well as a brief introduction on how to use it. There is also in-depth documentation describing how to use the Modelverse and its various languages.

Tests

Running the tests is easy: simply execute scripts/run_tests.py in the main modelverse folder. This will invoke the necessary build commands (to create bootstrapping code etc.) and call the tests for each individual aspect of the Modelverse. Note that testing is done using py.test, which is the only dependency of the Modelverse (and only for tests, of course).

Using PyPy

Since all scripts chain the invocation with the same interpreter as originally invoking the script, you will need to install py.test for PyPy. Assuming that you already have PyPy installed, you can simply install py.test using these commands:

wget https://msdl.uantwerpen.be/files/get-pip.py
pypy get-pip.py --user
pypy -m pip install pytest --user

From then on, you can simply invoke all tests in PyPy using:

pypy scripts/run_tests.py

Example-driven DSML design

This repository is a fork of the Modelverse and extends it with a method to define a domain-specific language based on example models. To run it, first start the modelverse as described above. Then, upload all the required (meta)models with:

python2 main.py -u

After that, start the user interface in example-modeling mode to sketch example models for the DSML:

python2 main.py -exm

This will create an empty example model and opens the sketching UI, where the example model can be drawn on the canvas. Use the keyboard commands "G" to group a selected set of primitives, "T" to type a group and "A" to attribute a node.

Once a set of example models exists, the UI for instance modeling phase can be started with:

python2 main.py -im

Again, this will create an empty instance model. During instance modeling, the interface is constrained by the example models.

In order to edit existing models, append "-m [path/to/model]" to the above commands. All models reside in fixed paths, namely "models/example/exX" and "models/instance/imX", whereby X is an integer starting from 1. For example, to edit an example model, use

python2 main.py -exm -m models/example/ex1