Skip to main content

Introduction

A bigraph model, or in some cases a signature model, may be converted to and loaded from several formats, including GraphML, BigMC, GXL, JLibBig and BigraphER.

Therefore, the module bigraph-converter of Bigraph Framework contains the corresponding encoders/pretty printers etc.

Exporting Bigraphs to other File Formats​

The following bigraph tools or libraries are supported by now:

  • BigMC
  • BigraphER
  • BigRed

Two conversion strategies are followed for exporting the internal bigraph structure of Bigraph Framework to various other file formats to be used by other tools. One that uses a pretty printer (e.g., BigMC, BigraphER), and one that uses adapter classes (e.g., BigRed).

Regarding the latter, BigRed itself provides some Java libraries to export XML files that we may also exploit. For the former, we cannot reuse existing code (because they are written in C or OCaml), thus, the framework provides a custom implementation for exporting bigraphs via a pretty printer interface.

Both approaches are explained in a general form in the following.

Note that the existing bigraph tools vary in their feature set. That means that not all properties specified in Bigraph Framework may be directly translated to the language supported by each tool.

For some cases (e.g., JLibBig), a different approach is chosen. They mostly rely on the following interfaces:

  • org.bigraphs.framework.converter.BigraphObjectDecoder<B extends Bigraph<?>, T>
  • org.bigraphs.framework.converter.BigraphObjectEncoder<B extends Bigraph<?>, T>

PrettyPrinter Approach​

The encoding follows the same principal schema for all supported third party bigraph tools and file formats (see below). For the actual encoding, the specific implementation of the interface org.bigraphs.framework.converter.ReactiveSystemPrettyPrinter has to be instantiated. The interface has the following public methods: <AUTOGENERATED_TABLE_OF_CONTENTS>

String toString(R system)​

Returns the result of a reactive system encoding as string.

void toOutputStream(R system, OutputStream outputStream)​

Redirects the result of an encoding to an output stream in Java. The generated output can be printed to the console or redirected to any other output stream such as a java.io.FileOutputStream.

Tools supported​

  • BigMC using org.bigraphs.framework.converter.bigmc.converter.BigMcTransformator
  • BigraphER using org.bigraphs.framework.converter.bigrapher.converter.BigrapherTransformator

Adapter Approach​

For each respective tool different adapters for signatures, agents and reaction rules are provided.

Tools supported​

  • BigRed
    • For example, the org.bigraph.model.SignatureAdapter shall be used with BigRed's org.bigraph.model.savers.SignatureXMLSaver

Loading Bigraphs from other File Formats​

Currently, bigraphs can be loaded only from BigRed XML files into Bigraph Framework. See here for more details.

See also Persisting Bigraphs to store and load bigraph models as *.ecore and *.xmi files.