Operators, quantifiers, aggregations, and collection handling in SEA™ DSL.
+ # Addition
- # Subtraction
* # Multiplication
/ # Division
> # Greater than
< # Less than
>= # Greater or equal
<= # Less or equal
= # Equal
!= # Not equal
and # Logical AND
or # Logical OR
not # Logical NOT
contains # String/array contains
startswith # String prefix
endswith # String suffix
matches # Regex match
before # Temporal before
after # Temporal after
during # Temporal during
has_role # Role check
().*, /+, ->, <, >=, <=, =, !=notandorCheck condition for all elements:
forall x in <collection>: (<expression>)
Examples:
// All flows have positive quantity
forall f in flows: (f.quantity > 0)
// All orders have customer
forall o in entities where o.name = "Order": (o.customer != null)
Check if at least one element satisfies condition:
exists x in <collection>: (<expression>)
Examples:
// At least one admin exists
exists r in roles: (r.name = "Admin")
// At least one payment flow exists
exists f in flows where f.resource = "Money": true
Built-in collections:
| Collection | Contains |
|---|---|
flows |
All Flow declarations |
entities |
All Entity declarations |
resources |
All Resource declarations |
instances |
All Instance declarations |
relations |
All Relation declarations |
Filtering:
forall f in flows where f.resource = "Money": (f.quantity > 0)
| Function | Description |
|---|---|
count |
Number of elements |
sum |
Sum of values |
min |
Minimum value |
max |
Maximum value |
avg |
Average value |
fn(x in <collection> [over last N "unit"]
[where <condition>] :
<expression>)
Examples:
// Count all flows
count(f in flows: 1)
// Sum payment amounts
sum(f in flows where f.resource = "Money": f.quantity)
// Average order value over last 30 days
avg(o in entities over last 30 "days"
where o.name = "Order":
o.amount)
// Max quantity
max(f in flows: f.quantity)
group_by(x in <collection> [where <condition>] : <key>)
{ <aggregation_expression> }
Example:
// Group flows by resource and count
group_by(f in flows: f.resource)
{ count(f: 1) }
Reference specific instances with @:
instance order123 of "Order" {
amount: 100 "USD",
status: "pending"
}
// Reference in expression
Policy order_check as: (@order123.amount > 50)
Policy positive_amount as: (amount >= 0)
Policy all_flows_positive as:
forall f in flows: (f.quantity > 0)
Policy large_orders_require_approval as:
forall o in entities where o.name = "Order" and o.amount > 10000:
(o.approved = true)
Policy payment_exists as:
exists f in flows where f.resource = "Money": (f.quantity > 0)
Policy order_has_payment as:
forall o in flows where o.name = "PlaceOrder":
exists p in flows where p.name = "ProcessPayment":
(p.orderId = o.orderId)
Metric "total_revenue" as:
sum(f in flows where f.resource = "Money": f.quantity)
@unit "USD"
Metric "daily_orders" as:
count(o in entities over last 24 "hours"
where o.name = "Order": 1)
@window 24 "hours"
@threshold 100
Last Updated: January 2026