aggregate
Compute aggregations like COUNT, SUM, MIN, MAX, and AVG over matching facts to analyze data patterns and extract insights from structured information.
Instructions
Compute aggregations over matching facts. Supports COUNT (number of matches), SUM, MIN, MAX, and AVG over a numeric argument at a specified position. Example: COUNT all score(player, ?) facts, or AVG scores at argIndex=1.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| predicate | Yes | The predicate to aggregate over | |
| args | Yes | Pattern arguments — use ?x as wildcards, concrete values to constrain | |
| operation | Yes | Aggregation operation: COUNT, SUM, MIN, MAX, or AVG | |
| argIndex | No | 0-based argument position to aggregate for SUM/MIN/MAX/AVG (ignored for COUNT) | |
| scope | No | Optional scope filter |