Introduction
Industrial environments generate vast quantities of sensor data that hold critical insights for operational efficiency. However, bridging the gap between raw logs and high-level concepts—such as identifying a "turbine power trip"—remains a significant challenge. This paper introduces datalogMTL, a practical logic language that combines Datalog with Metric Temporal Logic (MTL) to enable sophisticated temporal reasoning over large-scale industrial datasets using standard SQL databases.
The Challenge of Temporal Data
Engineers often need to query complex patterns like: "Find when the turbine's power was above 1.5MW for 10 seconds, followed by a specific drop within 3 seconds." Currently, extracting such information requires custom, brittle scripts because standard database languages (SQL) and ontology languages (OWL) lack native support for "metric" time—intervals with specific durations. While existing temporal logics exist, they are often either too weak (LTL) or computationally undecidable. The authors propose datalogMTL as a "sweet spot" that is expressive enough for engineering needs yet efficient enough for production environments.
Methodology: datalogMTL and SQL Rewriting
The core of the proposal is datalogMTL, a "Horn fragment" of Metric Temporal Logic.
- Logic Structure: It utilizes if-then rules combined with temporal operators (e.g., $\boxplus_{[0, 10s]}$ for "always for the next 10 seconds").
- Complexity: The authors proved that while general MTL is undecidable, this fragment is EXPSPACE-complete. Crucially, nonrecursive datalogMTL falls into the $AC^0$ category for data complexity, making it highly efficient for large datasets.
- Practical Implementation: For nonrecursive queries, the authors developed an algorithm to "rewrite" high-level logic into standard SQL queries. These queries leverage modern SQL window functions (like
LAG) to perform temporal joins directly within a PostgreSQL database, allowing the database engine to handle the heavy lifting.
Datasets and Evaluation
The approach was evaluated using two real-world use cases: the Siemens Turbine Data, consisting of sensor logs scaled to 320 months (~10 GB), and the MesoWest Weather Data, covering historical records across 19 US states (~18 GB).
Key Results and Scalability
The experiments demonstrated that datalogMTL scales effectively for industrial monitoring. The primary finding was linear scalability: execution time grows linearly with data size, confirming the approach's viability for large-scale applications. Even complex queries involving multiple temporal joins finished in acceptable timeframes (e.g., under 25 minutes for 11GB of weather data).
Conclusion and Future Work
By restricting logic to Horn clauses and leveraging existing SQL technology, the authors have created a framework that tames the complexity of MTL without losing practical expressivity. Future work will focus on supporting recursion in SQL rewriting, adding "since" and "until" operators, and adapting the framework for real-time streaming data and distributed processing to handle even larger datasets.
Summary updated