Skip to content

BPMN Transformer

bloge-bpmn-transformer translates BPMN 2.0 models into BLOGE artifacts. It can validate a BPMN process, generate .bloge DSL, or materialize an executable Graph directly when an OperatorRegistry is available.

Translation pipeline

BLOGE's BPMN support follows a conservative, diagnostics-first pipeline:

  1. BpmnXmlParser reads BPMN XML into an internal process model
  2. BpmnToBlogeTranslator lowers supported BPMN constructs into BLOGE's intermediate representation
  3. DslCodeGenerator renders .bloge text, or GraphTranslator produces an executable Graph
  4. TranslationResult<T> returns the generated artifact together with warnings and errors

The public entry point is BpmnTranslator.

Quick start

java
Path bpmnFile = Path.of("src/main/resources/order-process.bpmn");

OperatorMappingConfig mapping = new OperatorMappingConfig(
    List.of(
        new OperatorMappingRule(
            new BpmnMappingSelector("fetchCustomer", "serviceTask"),
            new BlogeMappingTarget("FetchCustomerOperator", ""),
            Map.of("customerId", "ctx.customerId")
        )
    ),
    Map.of("scriptTask", new DefaultMappingRule("__script__", "groovy"))
);

BpmnTranslator translator = new BpmnTranslator(
    mapping,
    new TranslationOptions(true, true, true, Duration.ofSeconds(5), ExpressionTranslationMode.AUTO)
);

TranslationResult<String> dsl = translator.translateToDsl(bpmnFile);

Supported BPMN scope

The module currently focuses on orchestration-oriented BPMN constructs that map cleanly to BLOGE:

  • start and end events
  • service, script, and user tasks
  • exclusive and parallel gateways
  • timer, message, and signal events
  • call activities and subprocess structures
  • sequence flows with task input/output mapping metadata

If a construct cannot be mapped safely, the translator emits diagnostics instead of inventing semantics.

Diagnostics model

TranslationResult<T> keeps both the translated output and the diagnostics produced during translation.

CodeMeaning
UNSUPPORTED_ELEMENTThe BPMN file contains an unsupported construct
UNMAPPED_OPERATORNo operator mapping matched a BPMN task that should become executable
COMPLEX_EXPRESSIONAn expression could not be translated one-to-one
POTENTIAL_DATA_LOSSTranslation is possible, but some BPMN meaning may be weakened

In strict mode, warnings can be promoted into hard failures for CI use.

Operator mapping strategy

Translation quality depends on the operator mapping table. BLOGE supports two layers:

  • explicit OperatorMappingRule entries for deterministic task mappings
  • DefaultMappingRule fallbacks for broader task categories such as script tasks

This keeps important tasks predictable while still allowing exploratory translation of larger BPMN models.

Known limitations

  • vendor-specific BPMN extensions are outside the public compatibility promise
  • unsupported gateway types remain diagnostics, not synthesized behavior
  • complex expression languages may require manual cleanup in generated DSL
  • direct graph translation still depends on a valid operator registry for the final executable graph
  1. translate BPMN to DSL
  2. review diagnostics
  3. inspect the generated .bloge file in Studio or editor tooling
  4. adjust operator mappings until the result is explicit and production-safe
  5. compile and execute the DSL through the normal BLOGE pipeline

Next steps