Skip to content

Repository for the prototype for the publish-subscribe Petri net model


Notifications You must be signed in to change notification settings


Repository files navigation

Petri net modeling of the Publish-Subscribe paradigm

This repository contains the plugins to transform services following the publish-subscribe paradigm into colored Petri nets. Models are created using Papyrus UML2. Such models are later annotated with the provided publish-subscribe profile.

This repository depends on the CPN Tools Toolkit.

Transformation patterns

The transformations patterns are documented in the plug-in, and more specifically in the doc/ file.

Installing the Publish-Subscribe Tools

In Eclipse, go to Help -> Install New Software... and use as the URL for the update site.

The Publish-Subscribe Tools require Eclipse Neon (4.6) or higher.

NOTE: Although the prototype may be used with newer Eclipse versions, the examples have been developed with Eclipse Neon (4.6). Due to Papyrus limitations, you may experience issues when opening them with a different version. Thus, we recommend using Eclipse Neon (or a close version), when willing to inspect the provided examples.

Quick Start

Next, we describe how to start using the plugins provided in this repository.

Create a new project to model a Publish-Subscribe service

To model a service that uses the publish-subscribe paradigm, we first need to create a Papyrus project.

To do this, the standard New element wizard from Eclipse can be used. Next screenshot shows how to start this wizard from the file menu (File -> New -> Other...).

Open the "New..." Wizard

The first screen of the wizard is organized into categories. In the Papyrus category, we find the Papyrus Project entry.

Create new Papyrus project

Once the new project wizard has been started, the first thing to configure is the kind of diagram to create. In this case, a UML diagram.

Set model name

Next, we are asked for the project name and the model file name.

Set Project name

In the next step, first, we define the name of the root element of the new model; second, for the kind of diagram to create (i.e., a sequence diagram); and third, for the profile to be pre-applied to the new diagram.

Initialize with a new Sequence Diagram

When clicking the Browse Registered Profiles button, the profile selection window appears. At this point, we can select the Publish-subscribe profile.

Pre-apply the Publish-Subscribe profile

Once the root element name, the diagram kind, and the profile application have been configured, the wizard can be finished.

Finish wizard

Modeling Overview

Next figure shows and overview of the Papyrus Modeling Perspective. In the figure, a newly created sequence diagram (to which we have added a new Lifeline) is shown. Since the Publish-Subscribe profile has been pre-applied, its stereotypes can be directly applied to the model elements.

Overview of the modeling IDE

Next, a detail of the properties view is shown. In the figure can be seen how a user can set the tagged values applied to a Resource.

Editing tagged values

Generating a CPN Tools Petri net

Once the modeling has been finished, the user can proceed to generate the correponding Petri net. Next screenshot shows that this functionality is provided by means of a pop-up menu.

Invoke the Petri net generation

When the generation is invoked from a UML model, the user is asked for the specific interaction he/she wants to transform.

Select the Interaction to be transformed

Once the generation has finished, a new file with the same name than the UML model file (but with the cpn extension) is placed into the workspace next to the source file. This file can be directly opened with CPN Tools if it is installed in the system.

Open the generated Petri net in CPN Tools

Next screenshot shows what an auntomatically generated Petri net looks like in CPN tools.

View of the automatically generated Petri net into CPN Tools

Customizing the QVTo transformation

The QVTo transformation included within the prototype can be customized at runtime. This can be done from the Eclipse's preferences. Next figure shows how to open the Eclipse's preferences window.

Open the Eclipse preferences

The location of the file containing specific transformation to be executed can be customized from the preference page located in Publish-Subscribe Tools -> Transformation. This allows having different transformations that can be switched at run time.

Setting the tranformation's URI

In addition, by using the Edit this file in the workspace link, the file is opened into the Eclipse platform with the default QVTo editor. Changes done in this editor are directly reflected in the transformation, which allows direclty customizing the QVT transformation easily without rebuilding the plug-ins.

Next image shows what the IDE looks like when the file is opened in the workbench. Once the file has been opened, the preferences window can be closed to proceed with the editing.

Transformation shown in the QVTo editor

Repository contents

Plug-in Projects

Simple plug-in containing some example models.

Plug-in containing the profile to annotate UML models of services following the publish-subscribe pattern.

M2M transformation from the UML2 metamodel (+ publish-subscribe annotations) to the CPN Tools metamodel.

Test plug-in containing some sample code demonstrating how the transformation is invoked.

Plug-in containing the UI contributions, i.e., preference pages, pop-up menus and dialogs.

Feature Projects

Feature for the Publish-Subscribe profile and associated transformations. Included plugins are:


Feature for the UI contributions. Included plugins are:


Feature for the SDK. Includes all the previous features, together with the CPN Tools Toolkit SDK, QVTo SDK and Papyrus SDK. Additional included plugins are: