View Source wfnet_net (wfnet v0.1.0)

A set of functions for processing Workflow Net definitions.

Summary

Functions

Check/validate the graph of a workflow

Check that a WF definition is valid.

load the workflow into a digraph.

Load a workflow definition into an ETS table.

read a workflow file and return it as a list of task tuples.

Types

-type task() :: {task_type(), task_id(), task_succ(), task_data()}.
-type task_data() :: term().
-type task_id() :: integer().
-type task_pred() :: task_id() | [task_id()] | [].
-type task_rec() :: #task_rec{}.
-type task_state() :: inactive | done | waiting | running.
-type task_succ() :: task_id() | [task_id()] | [].
-type task_type() :: wfenter | wftask | wfands | wfandj | wfxors | wfxorj | wfexit.

Functions

-spec check_digraph(digraph:graph()) -> ok | {error, term()}.

Check/validate the graph of a workflow

We check for the following:

  1. There should be no leftover placeholder vertices.
  2. There should be exactly one wfenter, and with no predecessors.
  3. There should be exactly one wfexit, and with no successors.
  4. All other tasks must be on a path between wfenter and wfexit.
-spec check_wf([task()]) -> ok | {error, term()}.

Check that a WF definition is valid.

Check that the task tuples in a WF are valid.
-spec load_digraph(list()) -> {ok, digraph:graph()} | {error, term()}.

load the workflow into a digraph.

A new digraph containing the workflow is returned.

It is the responsibility of the caller to delete the digraph when no longer needed.
-spec load_ets([task()]) -> {ok, ets:table()} | {error, term()}.

Load a workflow definition into an ETS table.

The workflow definition, WF, is converted to digraph, and the ETS records are generated from the digraph vertices.

Once the ETS table is populated, the digraph will be deleted.
-spec read_file(file:name_all()) -> {ok, [term()]} | {error, term()}.
read a workflow file and return it as a list of task tuples.