Skip to main content

Crate ebi_bpmn

Crate ebi_bpmn 

Source
Expand description

A BPMN crate written in pure Rust

Contains a parser, a data structure and a writer. For now, this crate focuses on the behaviour of BPMN models; not on the data or resource perspectives. The crate provides methods to parse BPMN models, methods to write BPMN models, and methods to traverse the state space of a BPMN model.

A web-based tool to create BPMN models is bpmn.io.

This create is intended as a crate to be used in other software. If you are an end user, please consider using the Ebi crate & tool, which provides user-accessible algorithms that use BPMN.

§Usage

The main struct is BusinessProcessModelAndNotation, which contains methods for parsing, writing and state-space traversal. To create a BPMN model programmatically, consider the BPMNCreator struct.

To parse a BPMN model:

use std::io::prelude::*;
use std::io::BufReader;
use std::fs::File;
use ebi_bpmn::BusinessProcessModelAndNotation;
 
fn main() -> anyhow::Result<()> {
 let f = File::open("testfiles/model.bpmn")?;
 let mut reader = BufReader::new(f);
 
 let bpmn = BusinessProcessModelAndNotation::import_from_reader(&mut reader, true)?;
 
 let mut marking = bpmn.get_initial_marking()?.unwrap();
 assert_eq!(bpmn.get_enabled_transitions(&marking)?, vec![0]);
 bpmn.execute_transition(&mut marking, 0)?;
 
 Ok(())
}

Modules§

element
elements
partially_ordered_run
traits

Structs§

BPMNCreator
A struct that assists with creating BPMN models programmatically.
BPMNMarking
BPMNMessageFlow
A struct that represents a message flow in a BPMN model.
BPMNSequenceFlow
A struct that represents a sequence flow in a BPMN model.
BusinessProcessModelAndNotation
A struct with a Business Process Model and Notation (BPMN) model.
Container
StochasticBusinessProcessModelAndNotation
A struct with a stochastic Business Process Model and Notation (SBPMN) model.

Enums§

EndEventType
GatewayType
IntermediateEventType
StartEventType
Token

Type Aliases§

GlobalIndex