Git Product home page Git Product logo

er2petriflow's Introduction

ER 2 Petriflow

This project was originally developed as part of a submission to the ATAED 2022 Workshop.

This project contains a tool that is capable of converting Entity-Relations (ER) diagrams into a set of executable Petriflow processes.

This project runs requires Java 16 or newer, as it uses the new multi-line strings.

Using the tool

The maven project contained in this repository must be built locally into an executable jar file.

The tool can then be run from the command line:

java -jar ./ER2Petriflow.jar <input-file-path> [output-file-path]

The <input-file-path> argument is required and must specify a path to a JSON file containing an ER diagram. The format of the diagram must correspond to the one generated by the free tool available here.

The [output-file-path] argument is optional. If no argument is specified the current working directory is used as the output directory. A ZIP file will be generated in the output directory containing the converted Petriflow processes as XML files. The Petriflow processes can be viewed/edited using the free tool available here. The Petriflow processes can be uploaded to a process engine and executed here (requires free registration).

Examples

Example ER diagrams can be found in the ER diagrams directory in the root of this repository. Further, examples can be found in the unit test resource files located under src/test/resources.

Conversion

The tool converts the input ER diagram into a set of executable Petriflow files according to the following rules.

Converting entities

Each entity in the input diagram is converted into a unique Petriflow process with a predefined structure according to the following rules:

image image

  • The process inherits the name of the entity specified in the diagram
  • Each attribute of the entity is converted according to the following rules:
    • A data variable is created for each attribute
    • The title of the data variable is inherited from the attribute name specified in the diagram
    • The type of the data variable must be specified in the diagram by separating it from the title with a semicolon :. Data variable types are converted as follows:
      • All attribute types are case insensitive
      • Any of text, string, varchar specify a Petriflow Text data variable
      • Any of number. int, integer, float, double specify a Petriflow Number data variable
      • date specifies a Petriflow Date variable
      • No other types are currently supported
    • If the attribute is marked as unique (visually denoted as underlined) a post-set Petriflow action will be generated for it that will change the title of the case to a concatenation of values of all attributes marked as unique
    • The created data variable is referenced in the form of the layout transition in the process
  • All forms in the generated process use the legacy layout

Converting relations

Each relation in the input diagram is converted into a unique Petriflow process with a predefined structure, furthermore all processes of entities that participate in a relation are modified according to the following rules:

image image image

  • The process inherits the name of the relation specified in the diagram
  • Each attribute of the relation is converted according to the same rules as attributes of entities, with the following exceptions:
    • Attributes marked as unique have no special effect and are not shown in the title of their cases
  • A namespace-scoped function is created in the process that takes a prefix Text field as the first argument followed by a sequence of string or null attributes
    • The maximal meaningful number of string or null attributes passed to this function si equal to the number of entities the relation connects
    • a null value in a given position specifies, that entities of the given type should be filled
    • a string value must represent a case id of some entity instance of the given type
    • the function returns a Map<Case, List<Case>> object that corresponds to the search result and maps Relation process instances to a list of Entity process instances that the relation instance connects
    • the search will find all Relation instances, that connect the specified entity ids, null values will be filled with search results, string values will remain constant in all results
  • The process of each connected entity is modified as follows:
    • a new transition View <relation-name> is added to the process model and connected with a read arc with the created place (see third image)
    • a new Text data variable is added to the process, this data variable is referenced in the newly added transition
    • a pre-get action is added to this data variable, that finds all relation instances that connect this entity with other entities and displays their titles as a HTML table

N-ary relations

The example image displays a binary relation, but other arities are supported as well. When modeling non-binary relations the following caveats must be kept in mind:

  • unary relations are unsupported
  • relations with arity greater than 2 are fully supported and functional according to the specification provided in the previous section

The tool for creation of ER diagrams does not allow a relation node to connect more than two entity nodes. In their official documentation they specify that such relations should be modeled using the associative entity feature. Therefore, this is the syntax supported by our tool as well. The name of the N-ary relation is in such case taken from the associative entity node. Relation attributes can in this case be connected to any of the elements of the associative entity, or the relation nodes and will all be collected and resolved as belonging to the represented relation.

The following image displays a ternary relation with four attributes, that connects three entities with no attributes.

image

er2petriflow's People

Contributors

minop avatar

Watchers

 avatar

Forkers

mirosemko

er2petriflow's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.