Engine

TokLang.Engine — Module
TokLang.Engine

The whole tok language through the Rust engine: the checker of every layer, canonical text, BPMN, SVG, DMN and form export, BPMN and DMN import, decisions and simulation. The functions mirror the Python package (tok.api) and the R package (tokr).

The shared library comes from the binary package tok_jll, a dependency of TokLang.jl. available tells whether it can be loaded on this platform. Errors of the engine are thrown as TokError.

source

The library

Checking and text

TokLang.Engine.check — Function
check(text; lang="en", level="full", bpmn=true, class=nothing) -> Vector{Dict}

Diagnostics of tok check: dictionaries with the keys code, severity, line, id and message, sorted by line and code. class checks against a BPMN conformance class ("descriptive", "analytic", "common-executable", "full").

source

Export and import

TokLang.Engine.bpmn — Function
bpmn(text; layout=true, sidecar=nothing) -> String

BPMN 2.0 XML with diagram layout (tok bpmn). sidecar is the text of a layout sidecar (model.tok.layout) whose geometry is kept.

source
TokLang.Engine.svg — Function
svg(text; title=nothing, sidecar=nothing) -> String

SVG picture of the diagram (tok svg).

source
TokLang.Engine.export_files — Function
export_files(text; name="model", sidecar=nothing) -> Dict{String,String}

Every file tok export writes, as file name => content: NAME.bpmn, NAME.svg, the decision files and one .form per form.

source
TokLang.Engine.import_file — Function
import_file(xml; format="auto", keep_ids=true, layout=true) -> Dict

A BPMN 2.0 or DMN file as tok (tok import): a dictionary with format ("bpmn" or "dmn"), text, warnings and layout (the text of the layout sidecar of a BPMN file, or nothing).

source

Decisions and simulation

TokLang.Engine.eval_decision — Function
eval_decision(text, decision, values=Dict()) -> value

The value of a decision for the input values (tok eval). In a document of language 0.7 the decision is evaluated with everything it requires and the result is its value; in earlier documents the decision table alone gives a dictionary of outputs, a vector of them for hit policy collect, or nothing.

source
TokLang.Engine.simulate — Function
simulate(text; cases=nothing, seed=nothing, log=true, cases_table=true, xes=false,
         csv=false, lang="en") -> SimResult

Run the simulation of the Rust engine (tok sim). cases and seed override the attributes of simulate. xes=true adds the event log as XES (IEEE 1849-2016), csv=true the event log and the cases as the CSV text of tok sim --log and --cases-csv.

source
TokLang.Engine.SimResult — Type
SimResult

The result of simulate: kpi (the indicators of tok sim --json), report (the text tok sim prints), log (one dictionary per activity instance), cases (one per case), and on request xes, log_csv and cases_csv (otherwise nothing).

source
TokLang.Engine.sim_xes — Function
sim_xes(text; cases=nothing, seed=nothing) -> String

The event log of a simulation run as an XES document (tok sim --xes).

source
TokLang.Engine.sim_model — Function
sim_model(text; cases=nothing, seed=nothing) -> Dict

The simulation model of a document as the engine reads it: parameters of simulate, resources, variables, nodes with parsed distributions and timers, and sequence flows. The native simulator (TokLang.Sim) is built from it.

source

Command line and errors

TokLang.Engine.cli — Function
cli(args) -> Int

Run the tok command line of the engine with the arguments after the program name (cli(["sim", "model.tok", "--json"])) and return its exit status. The command writes to the standard output and error streams of the process.

source
TokLang.Engine.TokError — Type
TokError(kind, message, diagnostics)

An error reported by the engine. kind is one of "invalid_argument", "document" (the document has errors; diagnostics holds them), "render", "import", "unknown_decision", "decision", "feel", "distribution", "simulation", "io" and "internal".

source