Framework
AQL
A pure Swift implementation of the https://eclipse.dev/acceleo/documentation/ for model querying.
Overview
AQL provides a powerful expression language for querying and navigating ECore models. It supports navigation, collection operations, string manipulation, and type operations, making it ideal for model-driven engineering tasks.
This implementation follows the https://eclipse.dev/acceleo/documentation/ and is based on https://www.omg.org/spec/OCL/ semantics, whilst providing a type-safe Swift API for integration with the ECore metamodelling framework.
Key Features
-
Model navigation: Traverse models using intuitive dot notation
-
Collection operations: Filter, map, and aggregate collections
-
String operations: Comprehensive string manipulation
-
Type operations: Type checking, casting, and reflection
-
Boolean logic: Full support for logical expressions
-
Conditionals: If-then-else expressions
Quick Example
import AQL
import ECore
// Create execution context
let engine = ECoreExecutionEngine(models: ["model": myModel])
let context = AQLExecutionContext(executionEngine: engine)
// Parse a query
let parser = AQLParser()
let query = try parser.parse("self.attributes->select(a | a.isRequired)")
// Evaluate against a model element
let result = try await query.evaluate(in: context, self: myClass)
Topics
Essentials
Learn how to add AQL to your project and write your first model queries.
Learn the fundamental concepts of the Acceleo Query Language.
Execution
Execution context for Acceleo Query Language (AQL) expressions.
Expressions
Protocol for AQL expressions that can be evaluated within an execution context.
Represents property navigation (e.g., object.property or object.reference).
Represents collection operations in AQL (select, reject, collect, etc.).
Represents a literal value (String, Integer, Boolean, Real, null).
Represents a variable reference in AQL.
Represents let expressions for local variable bindings in AQL.
Structures
Represents binary operations in AQL (arithmetic, comparison, logical).
Represents method/operation calls in AQL.
Represents conditional expressions (if-then-else) in AQL.
Represents AQL string interpolation: 'some text ${expression} more text'.
Represents unary operations in AQL (logical negation, numeric negation).
Enumerations
Errors that can occur during AQL execution.