Protocol
IModel
Protocol abstracting model access for transformation engines.
protocol IModel : Sendable
Overview
The IModel interface provides a framework-agnostic way to access and manipulate models, similar to Eclipse ATL’s IModel. This abstraction allows transformation engines to work with different modelling frameworks whilst maintaining consistent semantics.
Design Principles
-
Framework Independence: Abstract from specific ECore implementation details
-
Read/Write Control: Clear separation between source (read-only) and target (writable) models
-
Type Safety: Maintain Swift’s type system whilst providing dynamic model access
-
Thread Safety: All operations must be safe for concurrent access
Usage Example
let sourceModel: IModel = EcoreModel(resource: sourceResource, isTarget: false)
let targetModel: IModel = EcoreModel(resource: targetResource, isTarget: true)
let elements = sourceModel.getElementsByType(personClass)
let newPerson = try targetModel.createElement(ofType: personClass)
Topics
Instance Properties
Indicates if this model allows modifications.
The reference model (metamodel) for this model.
The underlying resource containing the model elements.
Instance Methods
Creates a new element of the specified metatype.
Returns all elements matching the given type.
Checks if an object belongs to this model.
Relationships
Inherits From
Inherited By
Conforming Types
See Also
Query and Execution
Core execution engine providing model navigation and query capabilities.
Query framework for ECore models inspired by OCL.