This document describes how Janus executes a registered query.
JanusQLParser: parses Janus-QL and derives live and historical query fragmentsQueryRegistry: stores registered query metadataJanusApi: coordinates startup, workers, status, and result deliveryHistoricalExecutor: executes SPARQL over stored historical dataLiveStreamProcessing: executes the live RSP-QL query and holds live/static data- HTTP server: exposes registration, control, inspection, and WebSocket result streaming
Registration stores:
- the raw Janus-QL query text
- the parsed query representation
- the default
baseline_mode - timestamps and execution counters
Registration does not start execution.
JanusApi::start_query() does the following:
- Loads query metadata from the registry.
- Checks whether the query is already running.
- Creates one result channel for both historical and live results.
- Spawns one historical worker per historical window.
- Starts the live processor if the query has live windows.
- Starts async baseline warm-up if the query has both historical and live windows.
- Stores runtime handles and returns a
QueryHandle.
Historical execution is per historical window.
- one SPARQL execution
- one batch of historical bindings
- one
QueryResultsent with sourceHistorical
- multiple SPARQL executions, one per computed window
- one result batch per window
- each batch sent with source
Historical
Historical execution is not merged into live state automatically unless baseline bootstrap is used.
Live execution uses LiveStreamProcessing.
Startup does the following:
- creates the live processor from generated RSP-QL
- registers all live streams referenced by live windows
- starts the live processor
- spawns MQTT subscribers for each live stream
- spawns a worker that forwards emitted live bindings as
QueryResult { source: Live }
Janus multiplexes historical and live results onto a single channel.
Each QueryResult contains:
query_idtimestampsource:HistoricalorLivebindings
The HTTP server forwards these results into a broadcast channel and exposes them over WebSocket.
Current execution states are:
RegisteredWarmingBaselineRunningStoppedFailed(String)Completed
Important behavior:
- hybrid live + historical baseline queries begin in
WarmingBaseline - live execution starts immediately
- status flips to
Runningwhen baseline warm-up finishes successfully
Janus keeps runtime state for:
- worker thread handles
- shutdown channels
- live processors
- MQTT subscribers
- query execution status
Janus does not keep a fully merged historical + live relation as one continuously maintained execution state.
If you use baselines, Janus keeps only the compact materialized baseline triples inside live static data, not all historical result rows.