Foundations for Streaming Model Transformations by Complex Event Processing
Total Page:16
File Type:pdf, Size:1020Kb
Softw Syst Model DOI 10.1007/s10270-016-0533-1 SPECIAL SECTION PAPER Foundations for Streaming Model Transformations by Complex Event Processing István Dávid1 · István Ráth2,3 · Dániel Varró2,4 Received: 6 May 2015 / Revised: 6 May 2016 / Accepted: 9 May 2016 © The Author(s) 2016. This article is published with open access at Springerlink.com Abstract Streaming model transformations represent a Our approach enables event streams to include model change novel class of transformations to manipulate models whose events which are automatically and continuously populated elements are continuously produced or modified in high vol- by incremental model queries. Furthermore, a reactive rule ume and with rapid rate of change. Executing streaming engine carries out transformations on identified complex transformations requires efficient techniques to recognize event patterns. We provide an integrated domain-specific lan- activated transformation rules over a live model and a poten- guage with precise semantics for capturing complex event tially infinite stream of events. In this paper, we propose patterns and streaming transformations together with an exe- foundations of streaming model transformations by innov- cution engine, all of which is now part of the Viatra reactive atively integrating incremental model query, complex event transformation framework. We demonstrate the feasibility of processing (CEP) and reactive (event-driven) transformation our approach with two case studies: one in an advanced model techniques. Complex event processing allows to identify rel- engineering workflow; and one in the context of on-the-fly evant patterns and sequences of events over an event stream. gesture recognition. Communicated by Dr. Jürgen Dingel and Wolfram Schulte. Keywords Streaming model transformations · Complex event processing · Live models · Change-driven This work was partially supported by the MBSE4Mechatronics project (Grant No. 130013) of the agency for Innovation by Science transformations · Reactive transformations and Technology in Flanders (IWT-Vlaanderen), and the MONDO (EU ICT-611125) project and the MTA-BME Lendület 2015 Research Group on Cyber-Physical Systems. 1 Introduction B István Dávid [email protected] Live models in smart cyber-physical systems Smart Cyber- István Ráth Physical Systems [56,57] are open, interconnected and [email protected] highly distributed complex systems expected to consist of 50 Dániel Varró billion smart objects and devices by 2020 [17], which inte- [email protected] grate simple sensors and actuators to the Internet-of-Things (IoT) [73] to exploit the user interface of mobile devices and 1 Department of Mathematics and Computer Science, the computational power of cloud-based infrastructures. In University of Antwerp, Middelheimlaan 1, 2020 Antwerp, Belgium many cases, they also connect traditional critical embedded systems where a failure may result in major financial loss, 2 Department of Measurement and Information Systems, Budapest University of Technology and Economics, Magyar severe damage or even casualties. tudósok krt. 2., Budapest 1117, Hungary Management of such smart systems frequently necessi- 3 IncQuery Labs Ltd., Bocskai út 77-79, Budapest 1113, tates soft real-time processing, and it may rely upon a closed Hungary control loop which observes data reported by sensors of the 4 MTA-BME Lendület Research Group on Cyber-Physical system, and interacts with actuators based upon some control Systems, Budapest, Hungary logic. Typical applications following such a scenario include 123 I. Dávid et al. run-time reconfiguration and optimization [19] of the under- while changes in other component are reported as events. lying system, knowledge maintenance in online machine For example, the optical sensors of a CPS may search for learning [38], distributed reasoning [41], etc. a specific pattern over a continuous stream of images, or a Many distributed systems in IoT implement the control runtime monitor (with small memory footprint) may look logic over a stream of events which may offer extreme scala- for a violation of a safety property with temporal constraints. bility in a distributed environment with a massive number Applying graph reasoning and transformation techniques in of nodes. Complex event processing (CEP) [37,58]offer the context of live models and IoT applications is still in an well-founded techniques to capture critical event sequences early research phase [41,60]. observed on the event streams within a given time window which require immediate reaction. The event stream is con- Contributions In [27], we identified a novel class of stream- sidered as an external component for the CEP engine, which ing transformations for live models where the models them- is loosely connected to the event sources, thus adapting a selves are not necessarily large or infinite, but they change CEP engine to consume model changes as events require or evolve at a very fast rate (for instance, 25 times per sec- significant manual programming effort [62]. ond), and it is the stream of model changes that requires However, a smart CPS also needs to autonomously per- efficient processing. In this paper, we innovatively combine ceive its operational context and adapt to changes in an open, complex event processing techniques with live model queries heterogeneous and distributed environment. For that purpose, and transformations where the current snapshot of the system and its operational con- text can be formally captured as a live model (also referred as (1) changes of a live model at different (but user-defined) models@runtime [15]) which continuously gets updated to level of granularity can be identified by changes of a reflect relevant changes in the underlying real system. Fur- query result set and then published as atomic events to thermore, operations executed on this live model may have one or more event streams similarly to external stimuli; immediate and direct effect on the running system. (2) relevant event sequences are identified by adapting com- plex event processing (CEP) techniques [37,58]; Toward streaming transformations over live models Scala- (3) transformation rules enable to react to such complex bility of models, queries and transformations has become a event sequences by manipulating the live models or send- key challenge in model-driven engineering [55] to handle ing further events. complex scenarios of industrial domains of critical embed- ded systems like automotive or avionics. Efficient graph Our technical contributions include reasoning [40] techniques (based on constraint or query languages [61,70,74]) assist in identifying critical model A a high-level integrated domain-specific language for cap- changes while reactions are regularly defined by rule-based turing complex event sequences over model changes techniques (such as graph transformation [12]). However, the defined by queries and specifying reactions as stream- same techniques fail to identify complex sequences of model ing transformations; changes. B precise foundations of this event processing DSL includ- The maintenance and manipulation of large models also ing syntax and semantics (both formal algebraic and initiated to come up with novel classes of model transfor- executable); mations. Change-driven transformations [14] consume or Cacomplex event processing engine tightly integrated produce changes of source and target models as their input into the Viatra reactive and incremental transforma- or output models, to enable transformations over partially tion framework [13]; materialized models and to reduce the amount of traceabil- D initial scalability measurements to assess the perfor- ity information required to be stored in the model. Sánchez mance of the framework in the context of live models Cuadrado and de Lara define streaming transformations as for gesture recognition; and a “special kind of transformation in which the whole input Eanewcase study of an advanced model-driven engineer- model is not completely available at the beginning of the ing tooling workflow in the context of CPS. transformation, but it is continuously generated“ [65]. An additional class of streaming transformations aims to tackle While the technical depth of presentation increased in gen- very large models by feeding a transformation process incre- eral wrt. the earlier version [27], contributions (B) and (E) mentally (keeping only a part of the model in memory at any are completely novel in the current paper. time). The main conceptual added value of our work is the seam- However, in the context of smart CPS, live models may less and tight integration between a reactive MT engine and evolve at a very fast rate, or they may not be fully material- a CEP engine to handle model changes as events and the ized, i.e., only a part of the live model is stored in memory other way around. As a result, graph reasoning and complex 123 Foundations for Streaming Model... event processing techniques can be simultaneously used in the context of live models without additional programming and integration efforts. Furthermore, introducing compound changes as atomic events significantly reduces the complex- ity of complex event patterns and their checking automata compared to a solution which relies only on a CEP engine. Structure of the paper In Sect. 2, we give a brief overview on our approach. Section 3 introduces a running example on complex event-driven live model synchronization aided by design space exploration. Section 4 defines the static Fig. 1 Structural