Documentation Language: Swift

Class

ATLExecutionContext

Execution context for ATL transformations, coordinating between ATL constructs and the ECore execution framework.

@MainActor final class ATLExecutionContext

Overview

The ATL execution context serves as the main coordination layer for ATL transformations, delegating heavy computational operations to the underlying ECoreExecutionEngine while managing ATL-specific state such as helpers, rules, and trace links on the MainActor.

Architecture

Following the established swift-ecore pattern:

Integration with ECore

The context bridges ATL concepts to ECore fundamentals:

Example Usage

let context = ATLExecutionContext(
    module: atlModule,
    sources: ["IN": sourceModel],
    targets: ["OUT": targetModel],
    executionEngine: engine
)

let result = try await context.evaluateHelper("myHelper", arguments: [value])

Topics

Initializers

?
init(module:sources:targets:executionEngine:commandStack:)

Creates a new ATL execution context.

Instance Properties

V
debug

Debug mode flag for systematic tracing.

V
executionEngine

The underlying ECore execution engine for heavy computation.

V
module

The ATL module being executed.

V
sources

Source models indexed by their aliases.

V
targets

Target models indexed by their aliases.

Instance Methods

F
addLazyBinding(_:)

Add a lazy binding for later resolution.

F
addLazyBindingWithContext(targetElement:property:expression:)

Add a lazy binding with current variable context captured.

F
addSource(_:resource:)

Add a source model to the context.

F
addTarget(_:resource:)

Add a target model to the context.

F
addTraceLink(ruleName:sourceElement:targetElements:)

Add a trace link between source and target elements.

F
callHelper(_:arguments:)

Call a helper function with arguments.

F
clearCaches()

Clear all caches in the execution engine.

F
clearErrorContext()

Clear the error context.

F
createElement(type:in:)

Create a new element in a target model using commands.

F
findElement(_:)

Find an element by ID across all models.

F
findElementsOfType(_:)

Find all elements of a given type using the execution engine.

F
getCacheStatistics()

Get cache statistics from the execution engine.

F
getErrorContext()

Get the current error context.

F
getSource(_:)

Get a source model by alias.

F
getTarget(_:)

Get a target model by alias.

F
getTraceLinks(for:)

Get trace links for a source element.

F
getVariable(_:)

Get a variable value from the current scope or scope stack.

F
navigate(from:property:)

Navigate a property from a source object using the execution engine.

F
popScope()

Pop the current variable scope from the stack.

F
pushScope()

Push a new variable scope onto the stack.

F
registerHelper(_:)

Register a helper function.

F
resolveLazyBindings()

Resolve all pending lazy bindings.

F
setVariable(_:value:)

Set a variable value in the current scope.

Relationships

Conforms To

See Also

Transformation Execution

C
ATLVirtualMachine

Actor responsible for executing ATL transformations.

S
ATLExecutionStatistics

Statistics tracking ATL transformation execution performance and behaviour. Comprehensive execution statistics for ATL transformation monitoring.