Structure
AQLCollectionExpression
Represents collection operations in AQL (select, reject, collect, etc.).
struct AQLCollectionExpression
Overview
Collection operations allow filtering, transformation, and querying of collections in AQL expressions. These operations follow OCL semantics.
Supported Operations
Filtering
-
select(iterator | condition)- Filter elements matching condition -
reject(iterator | condition)- Filter elements not matching condition
Transformation
-
collect(iterator | expression)- Transform each element
Querying
-
any(iterator | condition)- True if any element matches -
forAll(iterator | condition)- True if all elements match -
exists(iterator | condition)- True if any element matches (alias for any)
Properties
-
size()- Number of elements -
isEmpty()- True if collection is empty -
notEmpty()- True if collection is not empty -
first()- First element or null -
last()- Last element or null
Element Lookup
-
indexOf(element)- 0-based index of first matching element, or -1 if not found
Example Usage
// Filter: persons->select(p | p.age > 18)
let adultsExpr = AQLCollectionExpression(
source: personsExpr,
operation: .select,
iterator: "p",
body: ageComparisonExpr
)
// Transform: persons->collect(p | p.name)
let namesExpr = AQLCollectionExpression(
source: personsExpr,
operation: .collect,
iterator: "p",
body: nameNavigationExpr
)
// Query: persons->size()
let sizeExpr = AQLCollectionExpression(
source: personsExpr,
operation: .size
)
Topics
Initializers
Creates a collection operation expression.
Instance Properties
Optional body expression evaluated for each element.
Optional iterator variable name for operations that need it.
The operation to perform.
The source collection expression.
Instance Methods
Evaluates the expression within the specified execution context.
Enumerations
Collection operation type.
Relationships
Conforms To
See Also
Expressions
Protocol for AQL expressions that can be evaluated within an execution context.
Represents property navigation (e.g., object.property or object.reference).
Represents a literal value (String, Integer, Boolean, Real, null).
Represents a variable reference in AQL.
Represents let expressions for local variable bindings in AQL.