Schematex

BPMN / Business Process

About BPMN diagrams

A BPMN diagram documents a business process β€” the activities, decisions, events, and message exchanges that happen across roles, departments, and systems. It's the dominant notation in enterprise BPM, ISO-9001 / SOX audits, and process-mining tooling. The only official serialization is BPMN 2.0 XML, which is verbose and hostile to LLM generation; Schematex provides a compact text DSL that produces a conformant visual subset.

Schematex implements OMG BPMN 2.0.2 / ISO/IEC 19510:2013 for the elements that real-world business analysts actually draw: pools, lanes, events (start / intermediate / end with none / message / timer triggers), activities (tasks with markers + collapsed subprocesses), gateways (XOR / OR / AND / event-based), and sequence / conditional / default / message flows.

Note β€” Schematex is a rendering library, not a process-execution engine. There is no token simulation, no XML round-trip, and no DI (Diagram Interchange) layer. v0.1 covers the visual subset most teams use; boundary events, expanded subprocesses, and the rare trigger types (cancel / compensation / escalation / signal / link) are deferred to v0.2+.

schematexΒ§ source-defined
Loan Application Approval BPMN LR β€” 1 pool(s), 8 flow object(s). Bank Clerk Underwriter yes no approve reject Application received Check completeness Complete? Risk score Underwriter review Decision Approved Rejected
28 lines Β· 469 chars
βœ“ parsedΒ·0.0 msΒ·0 B
100%

1. Your first BPMN diagram

Three sections: a one-line bpmn header, one or more pool { … } blocks, and a flows block. Inside each pool you put lane { … } blocks, and inside each lane you list flow objects as id: kind "label".

schematexΒ§ source-defined
BPMN diagram BPMN LR β€” 1 pool(s), 3 flow object(s). Service Worker Request Process Done
12 lines Β· 129 chars
βœ“ parsedΒ·0.0 msΒ·0 B
100%

Every flow object starts with an id, a colon, the kind, an optional sub-keyword (trigger / marker / gateway type), and a quoted label. Ids are referenced by flow lines.


2. Pools and lanes

A pool represents one participant β€” an organisation, a department, or a system. A lane subdivides a pool into roles. The pool label is rendered rotated 90Β° on the left edge of a horizontal pool.

pool "Customer" blackbox          // black-box pool β€” no internal flow
pool "Bank" {
  lane "Clerk" { … }
  lane "Underwriter" { … }
}

A black-box pool is a participant whose internal process you don't model β€” typically an external customer or partner. Black-box pools must contain zero flow objects (Schematex enforces this in the parser).

Sequence flow (-->) is not allowed to cross pool boundaries. Use a message flow (~~>) for cross-pool communication.


3. Events

Events are circles. Stroke weight encodes lifecycle role:

KindStrokeDSL
Startthin (1px)start
Intermediatethin double ringintermediate
Endthick (3px)end

The optional trigger keyword adds an inner glyph. v0.1 supports the three most common triggers β€” none (no glyph), message (envelope), and timer (clock face):

A: start                       // none-trigger
A: start message "Inbound"     // message-catch (unfilled envelope)
T: intermediate timer "60 min" // timer (clock face)
F: end "Done"

Filled glyph = throw, unfilled glyph = catch. Schematex picks the right fill automatically based on event kind.


4. Activities β€” tasks and subprocesses

Activities are rounded rectangles. The two v0.1 forms are task and a collapsed subprocess (the + marker indicates expandable detail):

B: task "Generic abstract task"
U: task user "User decides"
S: task service "API call"
SE: task send "Send email"
RE: task receive "Wait for reply"
M: task manual "Hand-stamp the form"
SC: task script "Run rule engine"

X: subprocess "Verify identity" collapsed

The task marker (small icon top-left) communicates who or what performs the work β€” a person (user), a software service (service), an outbound message (send), an inbound wait (receive), an out-of-system manual step (manual), or an automated script (script). When in doubt, omit the marker β€” it defaults to abstract.


5. Gateways

Gateways are diamonds. The inner glyph encodes branching semantics:

KindGlyphMeaningDSL
Exclusive (XOR)XTake exactly one outgoing branch (data-based)gateway xor
Inclusive (OR)OTake one or more outgoing branchesgateway or
Parallel (AND)+Take all outgoing branches concurrentlygateway and
Event-basedpentagon-in-circlePick the branch whose event fires firstgateway event

Schematex uses Bruce Silver's X glyph for XOR by default β€” that's the convention real BPMN audits expect. Most diagrams use XOR (data branch) and AND (parallel split / join); OR is rare and event-based mostly appears in race-condition models.


6. Connectors

Four connector types. Three of them stay inside a pool; only message flow is allowed to cross pool boundaries.

A --> B                  // sequence flow (default)
G --? "yes" --> C        // conditional sequence (label is a guard)
G --* "default" --> D    // default flow (one per gateway, max)
"Customer" ~~> A : "Submit application"   // message flow
E ~~> "Customer" : "Notify approval"      // message flow back
  • --> is the workhorse β€” solid line + filled triangle arrowhead.
  • --? "label" --> adds a small unfilled diamond at the source. Use it when leaving an activity directly on a guarded outcome. (At a gateway, the conditional label suffices; the diamond glyph isn't drawn.)
  • --* "label" --> adds a slash mark at the source. One default flow maximum per gateway β€” Schematex enforces this.
  • ~~> is dashed with an open arrowhead and a small unfilled circle at the source. Source or target may be a quoted pool name (for black-box participants) or an object id.

7. Validation

The parser refuses diagrams that violate BPMN semantics, with line-numbered errors:

RuleError
Sequence flow crosses poolsequence flow 'A --> B' crosses pool boundary β€” use message flow (~~>)
Message flow inside one poolmessage flow 'A ~~> B' must cross pool boundaries
Black-box pool has internalsblack-box pool "X" cannot contain lanes
Two default flows from same gatewaygateway 'G' has 2 default flows (max 1)
Duplicate id within a poolduplicate id 'A'
Unknown source / targetunknown source 'X' in sequence flow

These checks fire during parse, so an LLM gets a usable signal before the layout pass.


8. Larger example β€” pizza order with black-box customer

A canonical BPMN tutorial: an external customer (whose process we don't model) places an order with a pizzeria split into Clerk / Chef / Delivery lanes, with a rework loop on the chef's quality check.

schematexΒ§ source-defined
Pizza order BPMN LR β€” 2 pool(s), 7 flow object(s). Customer Pizzeria Clerk Chef Delivery yes no Place order Pizza delivered Order received Take order Make pizza Pizza ok? Rework Deliver Done
32 lines Β· 485 chars
βœ“ parsedΒ·0.0 msΒ·0 B
100%

The rework loop (D --> C) creates a back-edge that the layout's cycle-break detects via DFS β€” the longest-path layering then proceeds on the forward DAG so columns stay sensible.


9. Limitations of v0.1

These are deferred to a later release. If your diagram needs one, file an issue with the use case:

  • Boundary events β€” events attached to an activity edge (timer, error, escalation, compensation). Currently you have to model the boundary as a free-floating intermediate event with manual flows.
  • Expanded subprocesses β€” collapsed subprocess works; expanded inline blocks (subprocess "X" { … }) are deferred.
  • Rare event triggers β€” error / escalation / cancel / compensation / signal / link / conditional / multiple / parallel-multiple. Use none or message as a placeholder.
  • Transaction / call activities β€” render as normal tasks for v0.1.
  • Loop and multi-instance markers β€” bottom-center activity glyphs; deferred.
  • Artifacts β€” data object / data store / group / text annotation. Deferred.
  • BPMN 2.0 XML import / export β€” out of scope. Schematex computes layout from DSL; no DI layer to round-trip.

Ready-to-use scenarios from the examples gallery:

bpmnΒ·Β§ OMG BPMN 2.0.2 / ISO/IEC 19510:2013
Loan Application Approval BPMN LR β€” 1 pool(s), 8 flow object(s). Bank Clerk Underwriter yes no approve reject Application received Check completeness Complete? Risk score Underwriter review Decision Approved Rejected
Loan application approval (BPMN)
Single-pool, two-lane BPMN of a bank loan approval workflow. Clerk completeness check feeds underwriter risk-scoring + review with two end states (approved / rejected). Canonical BPMN test case 7.2.
finance
bpmnΒ·Β§ OMG BPMN 2.0.2 / ISO/IEC 19510:2013
Pizza order BPMN LR β€” 2 pool(s), 7 flow object(s). Customer Pizzeria Clerk Chef Delivery yes no Place order Pizza delivered Order received Take order Make pizza Pizza ok? Rework Deliver Done
Pizza order with black-box customer (BPMN)
Two-pool BPMN β€” external Customer (black-box) and a Pizzeria with Clerk / Chef / Delivery lanes. Exercises message flows across pools, manual / send task markers, and a rework loop on the chef's quality check. Canonical BPMN test case 7.1.
retail
bpmnΒ·Β§ OMG BPMN 2.0.2 / ISO/IEC 19510:2013
Production incident response BPMN LR β€” 2 pool(s), 13 flow object(s). Monitoring Engineering On-call L1 On-call L2 Comms P1 P2-P3 info Alert Status Page received Acknowledge Triage Severity? Investigate Root cause Implement fix Deploy patch Status page 30 min Update users Post-mortem Resolved
Production incident response (BPMN)
Three-lane BPMN of an on-call rotation handling a production page β€” L1 triage, L2 investigation, and a Comms lane that posts status updates. Exercises timer intermediate event, severity-based XOR routing, and a self-loop on the triage gate.
software & it

Found this useful?

Schematex is free, fully open source, and zero-dependency. A star helps other developers discover it.