Abstract
As stream processing evolves into "stream reasoning"—the application of logical rules to continuous data—a diverse array of languages and engines has emerged without a unifying theoretical foundation. This paper introduces a formal, logic-based framework to define the "ideal semantics" of stream reasoning. By providing a common mathematical ground, the framework enables the analysis, comparison, and extension of existing systems such as CQL, C-SPARQL, and Reactive ASP. This work bridges the gap between the Semantic Web, Knowledge Representation, and Database communities by formalizing how time and data are interpreted in streaming contexts.
The Challenge of Unifying Stream Reasoning
The proliferation of smart cities, IoT devices, and sensor networks has necessitated moving beyond simple stream processing toward complex logical inference on continuous data. However, because this challenge spans multiple computer science disciplines, various engines like CQELS, C-SPARQL, and StreamLog have been developed in isolation.
Currently, conceptually identical queries can yield different results across different engines. Without a formal specification, it is impossible to determine if these discrepancies arise from implementation bugs or fundamental differences in temporal interpretation. The authors address this by proposing a rigorous formal framework that describes exactly what a stream reasoning language can express and how it should behave.
Formalizing Streams and Logic
The proposed framework adopts a logic-oriented view of data streams. Rather than relying on fixed database schemas, streams are defined as functions mapping discrete time points to sets of logical atoms. For example, a stream might record a tram arrival tr(a, p1) at time point 2.
To handle the unbounded nature of these streams, the authors formalize generalized window functions:
- Time-based windows: Selecting data based on specific time intervals.
- Tuple-based windows: Selecting data based on the count of recent events (e.g., the last three trams).
- Partition-based windows: Grouping data by attributes before applying tuple counts.
Evaluation is handled by adapting modal logic with specific operators. These include $\Diamond$ (sometime), $\Box$ (always), and $@_t$ (exact time). A key innovation is the $\boxplus_i$ (window operator), which extracts a specific substream to be evaluated. By treating these window operators as first-class citizens, they can be nested directly within queries to express complex temporal relationships.
Key Insights
Theoretical Completeness and the Future
While standard stream processing is typically retrospective, this framework generalizes window definitions to include arbitrary intervals, including the future. Although real-time engines cannot see the future, this mathematical completeness is vital for theoretical analysis and simulation-based planning tasks.
Nested Windows as Native Logic
By embedding window operators directly into logical syntax, the framework can natively express queries that traditional languages struggle with. For instance, asking if a bus arrived within a specific window of the last two trams requires nested temporal contexts. This framework handles such queries without the need for hardcoded timestamps in the data schema.
A Rosetta Stone for Stream Engines
The framework acts as a translation layer. The authors demonstrate that the semantics of widely-used languages like CQL (Continuous Query Language) can be mapped directly to their modal logic operators. This proves the framework's utility as a comparative tool for evaluating the expressive power of different engines.
Results and Future Directions
As a theoretical contribution, the paper focuses on qualitative results rather than quantitative benchmarks. It successfully defines a formal semantics capable of emulating CQL's snapshot semantics and relation-to-stream operators while extending them to handle nested windows.
However, the authors acknowledge that this "ideal" semantics does not yet account for real-world issues like network latency or dropped data. Future work aims to incorporate rule-based semantics to capture advanced engines like Reactive ASP, support reasoning over time intervals rather than just points, and bridge the gap between abstract theory and distributed system implementations.
Summary updated