Diagram - Sequence Fragments
Author alternatives, loops, nested operand ownership and self-contained Interaction reuse.
#Usage
Start with Sequence basics for the store-installed module, explicit Interaction frame, messages and occurrences. Combined fragments add ordered operands and covered lifelines to that same descriptive model.
Use the Sequence setup with the module installed in the store. Keep the matching semantic root and copied inspector under Diagram.Root. The examples below include their complete model and controls.
#Choose alternative outcomes
Outcome has approved and else operands. Each branch message explicitly belongs to
its operand. Choose Reverse operands to move complete branch contents with the
operand order while retaining their identities. Undo restores both order and drawing
positions. Add review operand adds an unfinished branch. Try second else rejects:
only one alt operand may use the exactly trimmed guard else.
Select Outcome or an operand in Entity and use Edit selected element. The copied form exposes operator, covered lifelines, drawing position, guard and height. Guards describe intent; Diagram does not select or evaluate an alternative.
#Describe a loop and compare operators
Retry owns one operand containing check. Select an operator and Apply operator. Loop keeps explicit minimum/maximum counts; other operators remove those loop values. Try invalid loop bounds rejects a minimum greater than its maximum. Applying the unchanged profile may be a noop. Undo a changed profile in one step.
| Operator | Supported authoring contract and descriptive meaning |
|---|---|
alt | Ordered alternative operands; at most one exactly trimmed else guard. Siblings are mutually exclusive scopes for supported call/lifetime checks. |
opt | Exactly one operand describing optional behavior. |
loop | Exactly one operand and required loop: { min, max }; nonnegative safe-integer minimum, safe-integer maximum at least minimum or 'unbounded'. |
par | Ordered stored operands describing parallel behavior; Diagram does not schedule them. |
seq | Weak-sequencing description. A lifeline explicitly destroyed in an earlier operand cannot be reused in a later operand. |
strict | Strict-sequencing description with the same supported earlier-destruction check. It does not add a global Interaction execution clock. |
break | Exactly one operand and coverage of every lifeline in its enclosing scope. |
critical | Critical-region description; the profile accepts ordered operands without an executable lock. |
neg | Exactly one operand describing invalid behavior. |
assert | Exactly one operand describing asserted behavior. |
DIAGRAM_SEQUENCE_OPERATORS supplies these ten exact choices. At least one operand
is required for every fragment. Only loop has loop bounds. The copied form displays
* for an unbounded loop maximum; saved data uses 'unbounded'. Shared variants use
the same frame/form workflow; their semantic meaning remains descriptive.
#Nest fragments and transfer complete contents
Retry belongs to approved; check belongs to Retry's body. Choose Focus nested Retry and Fit selected to inspect the inner frame. Transfer audit into approved moves audit and both occurrences to approved with a drawing offset. Try visual-only membership rejects an occurrence drawn into a child region without actual operand membership. Undo restores the entire transfer.
transfer(ids, scopeId, delta = 0) stays inside one Interaction and closes over message,
occurrence, execution and complete nested-fragment dependencies. Participants and
lifelines remain root authorities. A fragment cannot transfer into its own descendant.
Changing position alone is not a transfer; covered lifelines, semantic scope, visual
parent and operand bounds must all agree.
Operand reordering and height changes shift affected nested positions with their owners. Sibling fragment drawing rectangles cannot overlap. Covered lifelines are explicit, distinct and a subset of enclosing coverage. Nested frames, guards, message labels and activation bodies need actual drawing space; enlarge the operand rather than ignoring a geometry diagnostic.
#Capture a self-contained fragment
Choose Capture Retry, then Paste captured Interaction. The capture includes Retry's covered participant/lifeline authorities and contents as an independent Interaction. Paste remaps identities; Undo removes the complete pasted graph. The demo keeps serialized transport in memory and restarts it with the example.
Try dependent fragment capture rejects Outcome because its accepted reply names submit outside the captured contents. Capture the whole Interaction or repair that external reference first. Capture does not guess a destination, include unrelated parent behavior or silently discard a reply/execution dependency.
captureDiagramSequenceFragment(model, fragmentId) returns a
primeui.diagram.fragment version-1 clipboard fragment with the independent Interaction
selected. It validates the source and captured projection. Generic clipboard/palette
transport can then remap the complete captured identities through the installed module.
Ordinary whole-Interaction copy includes its authority directly. A captured fragment
may also become a fragment palette item; use the public palette serializer/parser and
registered Sequence symbols described in Palette.
#Fragment and operand reference
| Data/API | Contract and defaults |
|---|---|
fragment | interactionId, enclosing scopeId, operator, name, explicit distinct covered lifeline IDs (1–100), ordered distinct operands IDs (1–32), finite nonnegative drawing position; loop only for loop. |
operand | Ownership, reciprocal fragmentId, guard up to 256 characters, explicit finite drawing height from 72 to 100000. Height is not elapsed time. |
| Ownership | Operand visual parent is its fragment; operand scopeId is the fragment's enclosing scope. Content scopeId is the operand ID. These different roles must not be merged. |
| Nesting | Acyclic, at most 16 levels; matched Interaction/layer/page, parent identity, coverage and drawing clearance. |
createFragment(id,scopeId,operator,covered,position,operands,name = '',loop?) | Creates the fragment and reciprocal operands together. Loop defaults to { min: 0, max: 'unbounded' } when omitted through this editor path. |
updateFragment(id,values) | Changes operator/name/coverage/position and desired loop data; moving the top shifts owned positions. Switching away from loop clears its bounds. |
addOperand(fragmentId,id,guard,height = 160) | Adds an ordered operand; operator cardinality and drawing space are still validated. |
updateOperand(id,guard,height?) | Keeps height when omitted; changed height shifts later owned contents. |
reorderOperands(fragmentId,ids) | Retains every current operand exactly once, in the desired order; contents shift with their owners. |
transfer(ids,scopeId,delta = 0) | Explicit same-Interaction ownership transfer with dependency closure and optional drawing offset. |
remove(id) | Fragment removal includes owned operands/contents. Move/remove operand contents before removing that operand; remaining cardinality/profile must stay valid. |
sequenceStructure, sequenceScopeAncestors | Resolve explicit scope layout/coverage and ancestry. They do not infer missing semantic identities. |
| Copied form actions | fragment, operand, addOperand, reorder, transfer, remove; DiagramSequenceInspectorModel supplies scope/lifeline/operand choices and draft/disabled/status state. |
All edits use the public semantic editor through DiagramSequenceRoot.run and share
current permissions, connection approval, controlled settlement and ordinary history.
The root owns busy/status; pending is not a saved update. Factories and capture functions
are distinct from commits. Each complete source registers the module/symbols, binds the
copied form, reports warnings and releases resources. Read only allows navigation
and inspection while rejecting writes.
General ordering constraints, gates, found/lost messages, interaction-use/ref frames, state invariants, executable guards and trace evaluation are outside this bounded profile. Preserve opaque unsupported data for explicit repair as described in Domain notation.