Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Mutations

A mutation describes a reusable permitted change. It defines abstract roles, requirements for binding those roles, temporary resource uses, and persistent transformations. Declaring a mutation does not bind entities or approve an execution. Every mutation reference must begin at one of its abstract roles; concrete entity references are rejected so definitions remain reusable.

mutation "transport-payload" {
    roles [van payload destination]

    requires {
        @van.traits.vehicle
        @payload.traits.cargo
        @destination.traits.location
        @van.properties.located_at = @payload.properties.located_at
    }

    uses {
        reserve [@van @payload]
        observe [@destination.properties.located_at]

        occupy {
            @van.capacities.payload_mass += @payload.properties.mass
        }
    }

    transforms {
        @van.properties.located_at -> @destination.properties.located_at
        @payload.properties.located_at -> @destination.properties.located_at
    }
}

Roles and requirements

roles lists the abstract entities a mutation needs. requires contains expressions that describe acceptable bindings and required values.

roles [van payload destination]

requires {
    @van.traits.vehicle
    @van.conditions.readiness = ready
    @van.properties.fuel_volume > 0 l
}

The parser accepts role references but does not check that a role was declared, that roles are unique, or that resource and transformation references also appear in requires.

Resource uses

uses describes temporary access while a mutation is active.

SectionIntended meaning
observeRead an entity or component value.
shareShare an entity or component value.
reserveReserve an entity or component value.
occupyApply a temporary change to a component value.

The first three sections contain reference lists. occupy contains change expressions.

uses {
    observe [@destination.properties.located_at]
    reserve [@van @payload]

    occupy {
        @van.capacities.payload_mass += @payload.properties.mass
    }
}

Transformations

transforms describes persistent component changes.

OperatorMeaning
=Assign
+=Add and assign
-=Subtract and assign
*=Multiply and assign
/=Divide and assign
->Become
transforms {
    @van.properties.fuel_volume -=
        @van.$distance * @van.properties.fuel_per_distance

    @payload.properties.located_at ->
        @destination.properties.located_at
}

Every mutation section accepts drop edits, and drop mutation "identity" requests removal of a whole mutation.

Mutation declarations emit ordered create and update changes that the digital twin stores as definitions. Resource scheduling, role binding, requirement evaluation, and transformation execution remain outside the current OSL pipeline.