ArcFlow
Company
Managed Services
Markets
  • News
  • LOG IN
  • GET STARTED

OZ brings Visual Intelligence to physical venues, a managed edge layer that lets real-world environments see, understand, and act in real time.

Talk to us

ArcFlow

  • World Models
  • Sensors

Managed Services

  • OZ VI Venue 1
  • Case Studies

Markets

  • Sports
  • Broadcasting
  • Robotics

Company

  • About
  • Technology
  • Careers
  • Contact

Ready to see it live?

Talk to the OZ team about deploying at your venues, from a single pilot match to a full regional rollout.

Schedule a deployment review

© 2026 OZ. All rights reserved.

LinkedIn
ArcFlow Docs
Get Started
  • Get Started
  • Quickstart
  • Installation
  • Project Setup
  • Platforms
  • Bindings
  • Licensing
  • Pricing
Capabilities
  • Vector Search
  • Graph Algorithms
  • Sync
  • MCP Server (AI Agents)
  • Live Queries
  • Programs
  • Temporal
  • Spatial
  • Trusted RAG
  • Behavior Graph
  • Agent-Native
  • Event Sourcing
  • GPU Acceleration
  • Intent Relay
Concepts
  • World Model
  • Graph Model
  • Query Language (GQL)
  • Graph Patterns
  • SQL vs GQL
  • Parameters
  • Query Results
  • Persistence & WAL
  • Error Handling
  • Observations & Evidence
  • Confidence & Provenance
  • Proof Artifacts & Gates
  • Skills
GQL / WorldCypher
  • Overview
  • MATCH
  • WHERE
  • RETURN
  • OPTIONAL MATCH
  • CREATE
  • SET
  • MERGE
  • DELETE
  • REMOVE
  • WITH
  • UNION
  • UNWIND
  • CASE
  • Spatial Queries
  • Temporal Queries
  • Algorithms Reference
  • Triggers
Schema
  • Overview
  • Indexes
  • Constraints
  • Data Types
Functions
  • Built-in Functions
  • Aggregations
  • Procedures
  • Shortest Path
  • EXPLAIN
  • PROFILE
Skills
  • Overview
  • CREATE SKILL
  • PROCESS NODE
  • REPROCESS EDGES
Operations
  • CLI
  • REPL Commands
  • Snapshot & Restore
  • Server Modes & PG Wire
  • Persistence
  • Import & Export
  • Docker
  • Architecture
  • Cloud Architecture
  • Sync Protocol (Deep Dive)
Guides
  • Agent Integration
  • World Model
  • Graph Model Fundamentals
  • Trusted RAG
  • Using Skills
  • Behavior Graphs
  • Swarm & Multi-Agent
  • Migration Guide
  • Filesystem Workspace
  • From SQL to GQL
  • ArcFlow for Coding Agents
  • Data Quality & Pipeline Integrity
  • Code Intelligence
Tutorials
  • Knowledge Graph
  • Entity Linking
  • Vector Search
  • Graph Algorithms
Recipes
  • CRUD
  • Multi-MATCH
  • MERGE (Upsert)
  • Full-Text Search
  • Temporal Queries
  • Batch Projection
  • GraphRAG
Use Cases
  • Agent Tooling
  • Knowledge Management
  • RAG Pipeline
  • Fraud Detection
  • Sports Analytics
  • Grounded Neural Objects
  • Behavior Graphs
  • Autonomous Systems
  • Digital Twins
  • Robotics & Perception
Reference
  • TypeScript API
  • GQL Conformance
  • Compatibility Matrix
  • Glossary
  • Data Types
  • Operators
  • Error Codes
  • Known Issues

Aggregations & Window Functions

Aggregation Functions (11)#

Aggregate functions collapse multiple rows to a single value. Use inside RETURN or WITH — ArcFlow infers implicit GROUP BY from the surrounding non-aggregated columns.

FunctionSyntaxDescription
countcount(expr)Number of non-null values
count(DISTINCT)count(DISTINCT expr)Distinct non-null values
sumsum(expr)Sum of numeric values
avgavg(expr)Arithmetic mean
minmin(expr)Minimum value
maxmax(expr)Maximum value
collectcollect(expr)Collect values into a list
percentilepercentile(expr, p)Percentile (p: 0.0–1.0)
stdevstdev(expr)Sample standard deviation
variancevariance(expr)Sample variance
medianmedian(expr)Median (50th percentile)
MATCH (n:Person)
RETURN n.department AS dept,
       count(n) AS headcount,
       avg(n.salary) AS avg_salary,
       percentile(n.salary, 0.95) AS p95_salary,
       stdev(n.salary) AS salary_std
-- Collect names per city
MATCH (n:Person)
RETURN n.city, collect(n.name) AS residents
-- Count distinct values
MATCH (n:Transaction)
RETURN count(DISTINCT n.account_id) AS unique_accounts

Window Functions (7)#

Window functions compute a value over a moving window of rows. Unlike aggregation functions, they do not collapse rows — each row gets its own computed value.

Syntax:

function() OVER (
  [PARTITION BY column, ...]
  [ORDER BY column [ASC|DESC], ...]
  [ROWS BETWEEN N PRECEDING AND CURRENT ROW]
)
FunctionDescription
lag(expr, N)Value from N rows before the current row within the partition
lead(expr, N)Value from N rows after the current row within the partition
row_number()Sequential integer position within each partition (1-based)
percent_rank()Relative rank as a fraction (0.0–1.0)
stddev_pop(expr)Population standard deviation over the window frame
dense_rank()Rank without gaps (tied rows share a rank)

LAG — look back#

MATCH (n:DailyBar)
RETURN n.symbol, n.date, n.close,
  lag(n.close, 1) OVER (PARTITION BY n.symbol ORDER BY n.date) AS prev_close

Previous day's price, grouped per symbol and ordered by date.

LEAD — look forward#

MATCH (n:DailyBar)
RETURN n.symbol, n.date, n.close,
  lead(n.close, 5) OVER (PARTITION BY n.symbol ORDER BY n.date) AS next_5d_close

Rolling statistics#

MATCH (n:DailyBar)
RETURN n.symbol, n.date, n.close,
  avg(n.close) OVER (
    PARTITION BY n.symbol ORDER BY n.date
    ROWS BETWEEN 199 PRECEDING AND CURRENT ROW
  ) AS sma_200,
  stddev_pop(n.close) OVER (
    PARTITION BY n.symbol ORDER BY n.date
    ROWS BETWEEN 59 PRECEDING AND CURRENT ROW
  ) AS vol_60d

200-day simple moving average and 60-day volatility, per symbol.

ROW_NUMBER — position within partition#

MATCH (n:Product)
RETURN n.category, n.name, n.revenue,
  row_number() OVER (PARTITION BY n.category ORDER BY n.revenue DESC) AS rank_in_category

Rank products within each category by revenue.

PERCENT_RANK — cross-sectional ranking#

MATCH (n:DailyBar)
RETURN n.symbol, n.date,
  percent_rank() OVER (PARTITION BY n.date ORDER BY n.close) AS cross_sectional_rank

Rank each symbol by its closing price on each date. Returns 0.0 (lowest) to 1.0 (highest).


Live Window Views#

Window functions work inside CREATE LIVE VIEW:

-- Maintained incrementally as new bars arrive
CREATE LIVE VIEW rolling_volatility AS
  MATCH (n:DailyBar)
  RETURN n.symbol, n.date,
    stddev_pop(n.close) OVER (
      PARTITION BY n.symbol ORDER BY n.date
      ROWS BETWEEN 59 PRECEDING AND CURRENT ROW
    ) AS vol_60d

Each new DailyBar triggers a delta update — only the affected partition is recomputed, not the full result set.


HAVING — post-aggregation filter#

HAVING filters after aggregation completes, unlike WHERE which filters before:

MATCH (n:Person)
WITH n.department AS dept, count(n) AS headcount, avg(n.salary) AS avg_sal
HAVING headcount > 5 AND avg_sal > 80000
RETURN dept, headcount, avg_sal

See Also#

  • Window Functions in Live Views — incremental maintenance
  • Algorithms — graph algorithms (PageRank, Louvain, etc.)
Try it
Open ↗⌘↵ to run
Loading engine…
← PreviousBuilt-in FunctionsNext →Procedures