Code Monkey home page Code Monkey logo

fountainedge's Introduction

Fountainedge

Fountainedge is a simple workflow engine written in Elixir that roughly models forks and joins as described in the paper, Process Modeling Notations and Workflow Patterns by Stephen A. White, IBM Corporation. Uses Graphviz for graphical representations as UML Activity Diagrams.

Execution of tasks is not supported; however, such functionality could be built on top.

The workflow is modelled as graphs consisting of nodes and edges. Parallel forks and joins are tracked using tokens.

Example

test6

Define a schema:

alias Fountainedge.{Workflow, Schema, Node, Edge}
schema = %Schema{
  nodes: [
    %Node{id: 100, type: :initial},
    %Node{id: 1, label: "Decision"},
    %Node{id: 2, label: "Choice 1"},
    %Node{id: 3, label: "Choice 2"},
    %Node{id: 4, label: "Before Forking"},
    %Node{id: 5, type: :fork, join: 9},
    %Node{id: 6, label: "Parallel 1.1"},
    %Node{id: 7, label: "Parallel 1.2"},
    %Node{id: 8, label: "Parallel 2"},
    %Node{id: 9, type: :join},
    %Node{id: 10, label: "After Joining"},
    %Node{id: 11, type: :final},
  ],
  edges: [
    %Edge{id: 100, next: 1},
    %Edge{id: 1, next: 2, attributes: [label: "Y"]},
    %Edge{id: 1, next: 3, attributes: [label: "N"]},
    %Edge{id: 2, next: 4},
    %Edge{id: 3, next: 4},
    %Edge{id: 4, next: 5},
    %Edge{id: 5, next: 6},
    %Edge{id: 5, next: 8},
    %Edge{id: 6, next: 7},
    %Edge{id: 7, next: 6},
    %Edge{id: 7, next: 9},
    %Edge{id: 8, next: 9},
    %Edge{id: 9, next: 10},
    %Edge{id: 10, next: 11},
  ],
}   

Initialise the workflow:

workflow = Workflow.initialize(schema)

Get a list of valid out edges:

Fountainedge.out_edges(workflow)
# [%Edge{id: 1, next: 2}]

Transition along an out edge:

workflow = Fountainedge.transition(workflow, %Edge{id: 1, next: 2})

Graphing:

Fountainedge.Graph.graph(workflow)
|> Graphvix.Graph.compile(filename, :svg)

Installation

This package can be installed by adding fountainedge to your list of dependencies in mix.exs:

def deps do
  [
    {:fountainedge, "~> 1.0.0"}
  ]
end

Author

2019 (c) Damien Bezborodov

fountainedge's People

Contributors

bezborodow avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.