Introduction
Datalog has long served as the standard for recursive reasoning over large-scale datasets. However, modern applications—ranging from stream processing to financial auditing—increasingly require the ability to reason about time. DatalogMTL addresses this need by extending Datalog with metric temporal operators, allowing for queries over continuous time intervals. Despite its expressive power, reasoning in DatalogMTL is computationally intensive (ExpSpace-complete), often forcing a trade-off between scalability and theoretical completeness.
This paper introduces MeTeoR, the first practical and complete reasoning system for DatalogMTL. By integrating a high-performance materialization engine with an automata-based "safety net," MeTeoR achieves scalable reasoning on datasets containing tens of millions of temporal facts while guaranteeing termination.
The Challenge of Temporal Reasoning
The primary difficulty in DatalogMTL reasoning lies in balancing performance with completeness. Existing approaches generally fall into two categories:
- Materialization (Forward Chaining): This method is fast and scales well but risks non-termination. Temporal rules can derive facts infinitely into the future, leading to infinite loops.
- Automata-based/LTL Reduction: These methods are theoretically sound and guaranteed to terminate. However, they suffer from exponential state-space explosion, rendering them impractical for large, data-intensive tasks.
DatalogMTL introduces operators such as "always in the past" ($\boxminus_\rho$) or "sometime in the future" ($\Diamond_\rho$) over metric intervals. The formal semantics of these operators are crucial for understanding how the system derives new temporal facts.
The MeTeoR System
MeTeoR employs a hybrid architecture to overcome the limitations of previous methods. The system runs two main components in parallel:
Optimized Seminaïve Materialization
MeTeoR adapts the standard "seminaïve" evaluation strategy for temporal intervals. It ensures a non-repetition property, where each rule instance is applied at most once. A critical component of this efficiency is coalescing: when the system derives the same fact for overlapping intervals (e.g., Active@[1,5] and Active@[4,10]), it merges them into a single continuous interval (Active@[1,10]). This prevents memory bloat and redundant computations.
Rule Discarding and the Hybrid Algorithm
To further optimize performance, MeTeoR uses rule discarding. This technique identifies when a rule can no longer produce new information—for instance, when its non-recursive dependencies have been fully processed for a specific time range.
The core innovation is the Hybrid Algorithm. While the materialization thread handles the bulk of the "easy" data, a second thread uses an automata-based procedure to check for entailment. This ensures completeness and termination even when materialization might otherwise loop.
Evaluation and Key Insights
The authors evaluated MeTeoR using three benchmarks: Temporal LUBM, a real-world Weather Benchmark (containing up to 397 million facts), and the synthetic iTemporal benchmark.
Key findings include:
- The "99.7% Rule": Testing revealed that the fast materialization component alone could answer 99.7% of queries. This justifies the hybrid approach, using the expensive automata method only as a background safety net.
- Scalability: MeTeoR successfully processed datasets with over 10 million facts, a scale previously unreachable for complete DatalogMTL reasoners.
- Efficiency: Custom-built automata were found to be an order of magnitude faster than reducing DatalogMTL to standard Linear Temporal Logic (LTL) and using off-the-shelf reasoners.
Conclusion and Future Work
MeTeoR represents a significant advancement in practical temporal reasoning. By combining optimized materialization with a sound theoretical foundation, it enables large-scale reasoning with formal guarantees. Future work aims to extend the system to handle stratified negation, develop incremental reasoning for live data streams, and further scale the automata component for cases where materialization does not quickly reach a fixpoint.
The MeTeoR system is implemented in Python 3.8 and is available as an open-source project on GitHub.
Summary updated