Lecture Notes in Business Information Processing Series Editors Wil van der Aalst Eindhoven Technical University, The Netherlands John Mylopoulos University of Trento, Italy Michael Rosemann Queensland University of Technology, Brisbane, Qld, Australia Michael J. Shaw University of Illinois, Urbana-Champaign, IL, USA Clemens Szyperski Microsoft Research, Redmond, WA, USA
56
Marco Montali
Specification and Verification of Declarative Open Interaction Models A Logic-Based Approach
13
Author Marco Montali University of Bologna V.le Risorgimento 2, 40136 Bologna, Italy E-mail:
[email protected]
Library of Congress Control Number: 2010931106 ACM Computing Classification (1998): H.3.5, I.2.4, F.4.1, D.2.11, J.1 ISSN ISBN-10 ISBN-13
1865-1348 3-642-14537-X Springer Berlin Heidelberg New York 978-3-642-14537-7 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting, reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer. Violations are liable to prosecution under the German Copyright Law. springer.com © Springer-Verlag Berlin Heidelberg 2010 Printed in Germany Typesetting: Camera-ready by author, data conversion by Scientific Publishing Services, Chennai, India Printed on acid-free paper 06/3180 543210
Dedicated to Valentina and Giulia, and to Evita and Micol.
Foreword
Many emerging settings, such as business process management systems, clinical guidelines, services composition/choreographies and multi-agent systems, are characterized by a distribution of activities and resources and by exhibiting complex dynamics. This is due to their intrinsic openness, to the autonomy of their stakeholders, and to the unpredictability of the environment in which they are situated. To understand such dynamics and to develop methods and tools apt to accommodate modeling and reasoning about them is a very challenging goal. All these systems center around the interaction of the involved parties. Interaction, in turn, must be disciplined so as to ensure that the interacting entities comply with external regulations, norms, business rules, and internal policies. Such forces have the effect of constraining the courses of interaction, and can be thus grouped under the umbrella term of business constraint. Business constraints constitute a form of declarative knowledge: they restrict the set of compliant courses of interaction, without explicitly stating how the interacting entities must behave. Unfortunately, traditional modeling approaches have a closed and procedural nature, and thus require writing down explicitly all the compliant behaviors, producing “spaghetti-like” models which tend to sacrifice flexibility and readability. In this respect, a shift toward open and declarative modeling abstractions is needed. However, the adoption of declarative open interaction models poses two challenging questions: how can we specify them, and what is their semantics? How is it possible to support their design, execution, verification and analysis? In this book, Montali answers both of these fundamental questions. A broad survey of the state of the art is given, where Montali puts forward convincing evidence that closed, procedural approaches must be complemented with open and declarative ones. He then presents a great deal of background material on various languages and techniques belonging to different, usually unrelated, domains such as business process management, logic programming, knowledge representation and reasoning and multi-agent systems.
VIII
Foreword
The main theme of the book is the integration and extensions of all these contributions within a computational logic-based framework called CLIMB. The result is a unified, synergic, and comprehensive framework, where non-IT experts can graphically specify interaction models, automatically obtaining a corresponding formal representation and a set of fully automated sound and complete verification facilities. CLIMB exploits both the declarative advantages of computational logic and its computational power. On the one hand, computational logic defines a declarative and meaningful semantics to open and declarative interaction models. On the other hand, it provides a plethora of effective reasoning techniques that support interaction models prior to, during, and after their execution. The book contains one of the most clever corpora of ideas centered around the application of computational logic-based techniques for the specification and verification of interaction models. It constitutes a solid and motivating ground for future developments. The technical excellence of the book and the significance of its multifarious contributions will be a valuable asset for researchers of diverse scientific communities, practitioners in emerging application domains, and future generations of doctoral students.
May 2010
Paola Mello
Preface
This book contains a revised and extended version of the dissertation the author wrote in the Artificial Intelligence Division of the Department of Electronics, Computer Science and Systems at the University of Bologna, Italy. The dissertation was submitted to the University of Bologna in conformity with the requirements for the degree of Doctor of Philosophy in April 2009. It was honored with the 2009 “Marco Cadoli” prize, awarded by the Italian Association for Logic Programming to the most outstanding theses focused on computational logic and discussed between 2007 and 2009.
Abstract The advent of distributed and heterogeneous systems has laid the foundation for the birth of new architectural paradigms, in which many separated and autonomous entities collaborate and interact, with the aim of achieving complex strategic goals, impossible to be accomplished on their own. A non-exhaustive list of systems targeted by such paradigms includes business process management, clinical guidelines and careflow protocols, service-oriented computing, and multi-agent systems. It is largely recognized that engineering these systems requires novel modeling techniques. In particular, many authors are claiming that an open, declarative perspective is needed to complement the closed, procedural nature of the state-of-the-art specification languages, toward flexibility, usability, and verifiability. For example, the ConDec language has been recently proposed to target the declarative and open specification of business processes, overcoming the over-specification and over-constraining issues of classical procedural approaches, which tend to force unnecessary rigidity on the way the systems sub-parts coordinate. On the one hand, the success of such novel modeling languages strongly depends on their usability by non-IT savvy: they must provide an appealing, intuitive graphical front-end. On the other hand, they
X
Preface
must be apt to verification, in order to guarantee the trustworthiness and reliability of the developed model, as well as to ensure that the actual executions of the system effectively comply with it. The claim of this book is that computational logic is a suitable supporting framework for declarative open interaction models. In particular, the CLIMB (Computational Logic for the verIfication and Modeling of Business constraints) framework is proposed to address the specification, verification, execution, monitoring, and analysis of interaction models. After having introduced the main distinctive features of open declarative interaction models and motivated their suitability in different application domains, we propose to adopt an extended version of the ConDec language for their graphical specification. We then show how all the (extended) ConDec constructs can be automatically formalized by using a subset of the SCIFF language. SCIFF is a framework based on computational logic (Abductive Logic Programming in particular), which encompasses a rule-based language with a clear declarative semantics for specifying the interaction, and a family of proof procedures for concretely addressing reasoning and verification. We illustrate how such reasoning techniques can be successfully exploited to provide support and verification capabilities along the whole life cycle of the targeted systems. A number of challenging tasks are addressed, including static verification of properties, composition and interoperability of interaction models, run-time compliance verification, monitoring, and mining. The investigation is carried out spanning from theoretical aspects, such as proofs of formal properties and comparison with temporal logics, to practical applications, experimental evaluations, case studies, and tools. The book is organized in four parts. Part I: Specification. Chapter 2 gives a very accessible and precise overview of the application domains. Chapter 3 provides a critical overview of the ConDec language and introduces the framework of propositional linear temporal logic. Chapter 4 presents the CLIMB rule-based language, discusses its declarative semantics, and proves some interesting formal properties. Chapter 5 draws a bridge between the CLIMB and the ConDec languages, by proposing a translation and by running a theoretical investigation about the expressiveness of the two formalisms. Chapter 6 introduces and studies some very significant extensions to ConDec. Chapter 7 concludes this part with a discussion of related work and a summary. Part II: Static Verification. Chapter 8 introduces the problem of interaction model design-time verification. Chapter 9 presents two proofprocedures for reasoning from CLIMB specifications, and formally investigates their properties of termination, soundness, and completeness. Chapter 10 addresses the static verification of ConDec models. Chapter 11 conducts an experimental evaluation of the proposed methods, by comparing their performance with that of model checkers. Chapter 12 discusses related work and gives a summary of this second part.
Preface
XI
Part III: Runtime and A Posteriori Verification. Chapter 13 introduces the problem of open declarative interaction model run-time verification, and discusses the application of the and proof-procedures to the run-time verification of interacting entities with respect to ConDec models. Chapter 14 presents a reactive form of event calculus, axiomatized on top of SCIFF, which enables monitoring and enacting ConDec models. Chapter 15 presents innovative declarative process mining techniques based on CLIMB, and it describes two implemented tools and their application. Chapter 16 concludes with related work and summary. Part IV: Conclusions and Future Work.
Ac
ow ed
e ts
First and foremost, I would like to thank my supervisor, Prof. Paola Mello, for having constantly supported and encouraged my research activity. She guided me through the intriguing world of computational logic with her deep knowledge and open mind. Thanks to Federico Chesani, for having shared with me every working day as a colleague and a friend. His observations and feedback have been fundamental to finalizing my thoughts. Thanks to Paolo Torroni, for having always encouraged me to pursue my research and for having shared with me his strong research attitude. A special thanks goes to Marco Gavanelli, for his constant support on the SCIFF Framework. I am grateful to Prof. Bob Kowalski, for having first inspired and then appreciated my work. I am greatly indebted to Prof. Wil van der Aalst and Maja Pesic. The insightful and illuminating discussions I had with them during my two visits at TU/e strongly contributed to shaping the ideas presented in this book. Without their work on ConDec and declarative business process management, this book would have never been possible. Last but not least, I would like to thank all the people who contributed to my education and research. In alphabetical order: Marco Alberti, Matteo Baldoni, Cristina Baroglio, Alessio Bottrighi, Anna Ciampolini, Carlo Giannelli, Evelina Lamma, Michela Milano, Fabrizio Riguzzi, Davide Sottara, Sergio Storari, Paolo Terenziani, Alessandra Toninelli. My research activity has been partially supported by the FIRB Project TOCAI.IT: Knowledge-Oriented Technologies for Enterprise Aggregation in Internet and by the PRIN 2005 Project Languages for the Specification and Verification of Agents Interaction Protocols. “Words cannot describe everything. The heart’s message cannot be delivered in words.” — Mu-mon 1228. Grazie a Valentina e Giulia. Grazie a mamma, pap` a e Anna. Grazie ai nonni e agli zii. Grazie ad Annetta e Gigi. Grazie ai Marco – Kebir e Cmyk. Grazie ad Antonio. Grazie a Matteo. Grazie a Cate e Luchino. E grazie Bologna. May 2010
Marco Montali
Acronyms
ALP B2B B2C BDD BMK BP BPM BPMN CEC CEP CG CHR CLIMB
Abuctive Logic Programming Business-To-Business Business-To-Consumer ordered Binary Decision Diagram Basic Medical Knowledge Business Process Business Process Management Business Process Modeling Notation Cached Event Calculus Complex Event Processing Clinical Guideline Constraint Handling Rules Computational Logic for the verIfication and Modeling of Business constraints CLP Constraint Logic Programming EBS Event-Based System EC Event Calculus FOL First Order Logic ILP Inductive Logic Programming KB Knowledge Base LP Logic Programming LTL propositional Linear Temporal Logic MAS Multi-Agent System MTL Metric Temporal Logic NAF Negation As Failure QoS Quality of Service REC Reactive Event Calculus SCIFF Social Constrained IFF Framework sciff SCIFF Proof Procedure g-sciff g-SCIFF Proof Procedure SOA Service Oriented Architecture
XIV
SOC TPTL UML WfMS WS
Acronyms
Service Oriented Computing Timed Propositional Temporal Logic Unified Modeling Language Workflow Management System Web Service
Contents
1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 Main Contributions of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.1 Specification of Open Declarative Interaction Models . . . 1.1.2 Static Verification of Interaction Models . . . . . . . . . . . . . . 1.1.3 Run-Time Verification, Monitoring and Enactment Facilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1.4 A-Posteriori Verification and Declarative Process Mining 1.2 Organization of the Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.1 Part I: Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Part II: Static Verification . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.3 Part III: Run-Time and A-Posteriori Verification . . . . . . 1.2.4 Part IV: Conclusion and Future Work . . . . . . . . . . . . . . . . 1.3 Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1 3 3 4 4 5 6 6 7 8 8 8
Part I Specification 2
Declarative Open Interaction Models . . . . . . . . . . . . . . . . . . . . . . 2.1 An Informal Characterization of Interaction Models . . . . . . . . . . 2.1.1 Interaction Abstractions: Activity, Event, Execution Trace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.2 Characterization of Time . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.3 Compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.4 Flexibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.1.5 Openness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Business Process Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2.1 Modeling Business Processes . . . . . . . . . . . . . . . . . . . . . . . . 2.2.2 Limits of Procedural Business Process Modeling . . . . . . . 2.3 Service Oriented Computing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Service Oriented Architecture . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Orchestration and Choreography . . . . . . . . . . . . . . . . . . . .
11 11 11 13 14 16 19 20 22 23 25 25 26
XVI
3
4
Contents
2.3.3 Limits of Procedural Choreography Modeling . . . . . . . . . 2.4 Multi-Agent Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5 Clinical Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.5.1 Basic Medical Knowledge and Clinical Guidelines . . . . . . 2.5.2 Semi-Openness of Clinical Guidelines . . . . . . . . . . . . . . . . 2.6 Lesson Learnt: Compliance vs. Flexibility . . . . . . . . . . . . . . . . . . . 2.7 Desiderata for a Supporting Framework . . . . . . . . . . . . . . . . . . . . 2.7.1 Internal Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.7.2 Participation to an External Life Cycle . . . . . . . . . . . . . . . 2.8 The CLIMB Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29 34 36 37 38 39 41 42 43 44
The ConDec Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.1 ConDec in a Nutshell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 ConDec Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Existence Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.2 Choice Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.3 Relation Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.4 Negation Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.5 Branching Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4 ConDec at Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.1 The Order Management Choreography in Natural Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.2 The Order Management Choreography as a Contract . . 3.4.3 Identification of Activities . . . . . . . . . . . . . . . . . . . . . . . . . . 3.4.4 Elicitation of Business Constraints . . . . . . . . . . . . . . . . . . . 3.4.5 Completing the ConDec Model . . . . . . . . . . . . . . . . . . . . . . 3.5 Usability of ConDec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6 Linear Temporal Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.1 LTL Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.6.2 Syntax of Linear Temporal Logic . . . . . . . . . . . . . . . . . . . . 3.6.3 Semantics of Linear Temporal Logic . . . . . . . . . . . . . . . . . 3.7 Translating ConDec into Linear Temporal Logic . . . . . . . . . . . . . 3.7.1 The Translation Function . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.2 LTL Entailment as a Compliance Evaluator . . . . . . . . . . . 3.7.3 Linear Temporal Logic and Finite ConDec Traces . . . . .
47 47 48 49 49 50 51 54 56 57 58 58 59 60 63 64 67 68 68 69 70 70 71 72
The CLIMB Rule-Based Language . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 The CLIMB Language in a Nutshell . . . . . . . . . . . . . . . . . . . . . . . 4.2 The CLIMB Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Event Occurrences and Execution Traces . . . . . . . . . . . . . 4.2.2 Constraint Logic Programming . . . . . . . . . . . . . . . . . . . . . . 4.2.3 Expectations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.4 Integrity Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.5 The Static Knowledge Base . . . . . . . . . . . . . . . . . . . . . . . . .
77 77 79 79 81 83 85 90
Contents
XVII
4.2.6 SCIFF-lite and Composite Events . . . . . . . . . . . . . . . . . . . 93 4.3 CLIMB Declarative Semantics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 4.3.1 Abduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.3.2 Abductive Logic Programming . . . . . . . . . . . . . . . . . . . . . . 98 4.3.3 Formalizing Interaction Models and Their Executions . . 99 4.3.4 SCIFF-lite Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 4.3.5 CLIMB Abductive Explanations . . . . . . . . . . . . . . . . . . . . 102 4.3.6 On the Formal Definition of Compliance . . . . . . . . . . . . . . 105 4.4 Formal Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.4.1 Equivalence Modulo Compliance . . . . . . . . . . . . . . . . . . . . 109 4.4.2 Compositionality Modulo Compliance . . . . . . . . . . . . . . . . 110 4.4.3 Replaceability of Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 5
Translating ConDec into CLIMB . . . . . . . . . . . . . . . . . . . . . . . . . . 115 5.1 Translation of a ConDec Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 5.2 Translation of Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 5.3 Embedding a Qualitative Characterization of Time into a Quantitative Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 5.3.1 Temporal Contiguity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 5.3.2 Compact Execution Traces . . . . . . . . . . . . . . . . . . . . . . . . . 119 5.4 Translation of ConDec Constraints . . . . . . . . . . . . . . . . . . . . . . . . 121 5.4.1 Translation of Existence Constraints . . . . . . . . . . . . . . . . . 121 5.4.2 Translation of Choice Constraints . . . . . . . . . . . . . . . . . . . 123 5.4.3 Translation of Relation and Negation Constraints . . . . . 125 5.5 Dealing with Branching ConDec Constraints . . . . . . . . . . . . . . . . 128 5.6 Translation of a ConDec Choreography . . . . . . . . . . . . . . . . . . . . . 130 5.7 Equivalence of ConDec Constraints . . . . . . . . . . . . . . . . . . . . . . . . 130 5.8 Soundness of the Translation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 5.8.1 Trace Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 5.8.2 Behavioral Equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.8.3 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.8.4 On the Expressiveness of SCIFF . . . . . . . . . . . . . . . . . . . . 137
6
Extending ConDec. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 6.1 Metric Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 6.1.1 Temporal Contiguity in a Quantitative Setting . . . . . . . . 140 6.1.2 Quantitative Formalization of Chain Constraints . . . . . . 141 6.1.3 Init Constraint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 6.1.4 Extending ConDec with Quantitative Temporal Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 6.2 Data Aware Aspects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 6.2.1 Examples of Data Aware Business Constraints . . . . . . . . 145 6.2.2 The MXML Meta Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 . 148 6.2.3 The Life Cycle of Non Atomic Activities in ConDec 6.3 Modeling Data in ConDec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
XVIII Contents
6.3.1 Representing Non Atomic Activities and Data . . . . . . . . 149 6.3.2 Modeling Data Aware Conditions . . . . . . . . . . . . . . . . . . . 150 6.3.3 Modeling the Submit&Review Process Fragment . . . . . . 154 6.4 Formalizing Data Aware Aspects in CLIMB . . . . . . . . . . . . . . . . 155 6.4.1 Formalizing Data and Data Aware Conditions . . . . . . . . 155 6.4.2 Formalizing the Effect of Roles . . . . . . . . . . . . . . . . . . . . . . 156 6.4.3 Formalizing the Activity Life Cycle . . . . . . . . . . . . . . . . . . 159 7
Related Work and Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 7.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 7.1.1 Business Process Management . . . . . . . . . . . . . . . . . . . . . . 163 7.1.2 Clinical Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 7.1.3 Service Oriented Computing . . . . . . . . . . . . . . . . . . . . . . . . 169 7.1.4 Multi-Agent Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 7.2 Summary of the Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Part II Static Verification 8
Static Verification of Declarative Open Interaction Models 177 8.1 Desiderata for Static Verification Technologies . . . . . . . . . . . . . . 177 8.2 Verification of a Single Model vs. a Composition of Models . . . 179 8.3 Static Verification of Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 8.3.1 Existential vs. Universal Properties . . . . . . . . . . . . . . . . . . 180 8.3.2 General vs. Particular Properties . . . . . . . . . . . . . . . . . . . . 181 8.3.3 On the Safety-Liveness Classification . . . . . . . . . . . . . . . . . 182 8.3.4 A ConDec Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 8.4 A-Priori Compliance Verification . . . . . . . . . . . . . . . . . . . . . . . . . . 186 8.5 Composing ConDec Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 8.5.1 Compatibility between Local Models . . . . . . . . . . . . . . . . . 188 8.5.2 Augmenting ConDec with Roles and Participants . . . . . . 190 8.5.3 From Openness to Semi-Openness . . . . . . . . . . . . . . . . . . . 192 8.6 Conformance with a Choreography . . . . . . . . . . . . . . . . . . . . . . . . 196
9
Proof Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201 9.1 The SCIFF Proof Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 9.1.1 Fulfilled, Violated and Pending Expectations . . . . . . . . . . 202 9.1.2 Data Structures and Proof Tree . . . . . . . . . . . . . . . . . . . . . 203 9.1.3 Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 9.2 Formal Properties of the SCIFF Proof Procedure . . . . . . . . . . . . 214 9.2.1 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 9.2.2 Completeness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 9.2.3 Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 9.2.4 ConDec and Termination of the SCIFF Proof Procedure218 9.3 The g-SCIFF Proof Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Contents
XIX
9.3.1 Generation of Intensional Traces . . . . . . . . . . . . . . . . . . . . 219 9.3.2 Data Structures Revisited . . . . . . . . . . . . . . . . . . . . . . . . . . 220 9.3.3 Transitions Revisited . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 9.3.4 Linking the Proof Procedures . . . . . . . . . . . . . . . . . . . . . . . 222 9.4 Formal Properties of the g-SCIFF Proof Procedure . . . . . . . . . . 223 9.4.1 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 9.4.2 Completeness Modulo Trace Generation . . . . . . . . . . . . . . 223 9.4.3 Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 9.5 Implementation of the Proof Procedures . . . . . . . . . . . . . . . . . . . . 227 10 Static Verification of ConDec Models with g-SCIFF . . . . . . . 229 10.1 Existential and Universal Entailment in CLIMB . . . . . . . . . . . . . 229 10.1.1 Specification of Properties with ConDec . . . . . . . . . . . . . . 229 10.1.2 Formalizing Existential and Universal Entailment . . . . . . 231 10.2 Verification of Existential Properties with g-SCIFF . . . . . . . . . . 232 10.2.1 Conflict Detection with g-SCIFF . . . . . . . . . . . . . . . . . . . . 233 10.2.2 Existential Entailment with g-SCIFF . . . . . . . . . . . . . . . . 233 10.3 Verification of Universal Properties with g-SCIFF . . . . . . . . . . . 234 10.3.1 Complementation of Integrity Constraints . . . . . . . . . . . . 234 10.3.2 Reducing Universal to Existential Entailment . . . . . . . . . 236 10.4 ConDec Loops and Termination of g-SCIFF . . . . . . . . . . . . . . . . 239 10.4.1 Constraints Reformulation . . . . . . . . . . . . . . . . . . . . . . . . . . 240 10.4.2 Looping ConDec Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 10.5 A Preprocessing Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 11 Experimental Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 11.1 Verification Procedure with g-SCIFF . . . . . . . . . . . . . . . . . . . . . . . 251 11.2 Scalability of the g-SCIFF Proof Procedure . . . . . . . . . . . . . . . . . 253 11.2.1 The Branching Responses Benchmark . . . . . . . . . . . . . . . . 253 11.2.2 The Alternate Responses Benchmark . . . . . . . . . . . . . . . . 255 11.2.3 The Chain Responses Benchmark . . . . . . . . . . . . . . . . . . . 258 11.3 Static Verification of ConDec Models as Model Checking . . . . . 261 11.3.1 Existential and Universal Entailment of ConDec Properties in LTL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 11.3.2 ConDec Properties Verification as Satisfiability and Validity Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262 11.3.3 Model Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 11.3.4 Reduction of Validity and Satisfiability to Model Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 11.3.5 Verification Procedure by Model Checking . . . . . . . . . . . . 268 11.4 Comparative Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 11.4.1 The Order&Payment Benchmarks . . . . . . . . . . . . . . . . . . . 269 11.4.2 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
XX
Contents
12 Related Work and Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 12.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 12.1.1 Verification of Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 12.1.2 A-Priori Compliance Verification . . . . . . . . . . . . . . . . . . . . 281 12.1.3 Model Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 12.1.4 Interoperability and Choreography Conformance . . . . . . 284 12.2 Summary of the Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Part III Run-Time and A-Posteriori Verification 13 Run-Time Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 13.1 The Run-Time Verification Task . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 13.2 SCIFF-Based Run-Time Verification . . . . . . . . . . . . . . . . . . . . . . . 291 13.2.1 Reactive Behavior of the SCIFF Proof Procedure . . . . . . 292 13.2.2 Open Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 13.2.3 Semi-Open Reasoning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 13.3 The SOCS-SI Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 13.4 Speculative Run-Time Verification . . . . . . . . . . . . . . . . . . . . . . . . . 300 13.4.1 The Need for Speculative Reasoning . . . . . . . . . . . . . . . . . 300 13.4.2 Speculative Verification with the g-SCIFF Proof Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 13.4.3 Interleaving the Proof Procedures . . . . . . . . . . . . . . . . . . . 303 14 Monitoring and Enactment with Reactive Event Calculus . . 305 14.1 Monitoring Issues and SCIFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 14.2 Event Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 14.2.1 The Event Calculus Ontology . . . . . . . . . . . . . . . . . . . . . . . 308 14.2.2 Domain-Dependent vs. Domain-Independent Axioms . . . 309 14.2.3 Reasoning with Event Calculus . . . . . . . . . . . . . . . . . . . . . . 310 14.3 The Reactive Event Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 14.3.1 Axiomatization of the Reactive Event Calculus . . . . . . . . 312 14.3.2 Monitoring an Event Calculus Specification with the SCIFF Proof Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 14.4 REC Illustrated: A Personnel Monitoring Facility . . . . . . . . . . . . 316 14.4.1 Formalizing the Personnel Monitoring Facility in REC . 316 14.4.2 Monitoring a Concrete Instance . . . . . . . . . . . . . . . . . . . . . 318 14.4.3 The Irrevocability Issue . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319 14.5 Formal Properties of REC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 14.5.1 Soundness, Completeness, Termination . . . . . . . . . . . . . . . 320 14.5.2 Irrevocability of REC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 14.6 Monitoring Optional ConDec Constraints with REC . . . . . . . . . 324 14.6.1 Representing ConDec Optional Constraints in the Event Calculus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 14.6.2 Identification and Reification of Violations . . . . . . . . . . . . 328
Contents
XXI
14.6.3 Compensating Violations . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 14.6.4 Monitoring Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 14.7 Enactment of ConDec Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 14.7.1 Showing Temporarily Violated Constraints . . . . . . . . . . . 336 14.7.2 Blocking Non Executable Activities . . . . . . . . . . . . . . . . . . 336 14.7.3 Termination of the Execution . . . . . . . . . . . . . . . . . . . . . . . 339 14.8 jREC: Embedding REC Inside a JAVA-Based Tool . . . . . . . . . . 340 15 Declarative Process Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 15.1 Declarative Process Mining with ProM, SCIFF Checker and DecMiner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 15.2 The SCIFF Checker ProM Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . 346 15.2.1 CLIMB Textual Business Constraints . . . . . . . . . . . . . . . . 347 15.2.2 A Methodology for Building Rules . . . . . . . . . . . . . . . . . . . 348 15.2.3 Specification of Conditions . . . . . . . . . . . . . . . . . . . . . . . . . 349 15.2.4 Trace Analysis with Logic Programming . . . . . . . . . . . . . . 350 15.2.5 Embedding SCIFF Checker in ProM . . . . . . . . . . . . . . . . . 351 15.3 Case Studies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 15.3.1 The Think3 Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 15.3.2 Conformance Verification of a Cervical Cancer Screening Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 15.3.3 Quality Assessment in Large Wastewater Treatment Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 15.4 The DecMiner ProM Plug-in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 15.4.1 Inductive Logic Programming for Declarative Process Discovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 15.4.2 Embedding DecMiner into the ProM Framework . . . . . . 362 15.5 The Checking–Discovery Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 16 Related Work and Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 16.1 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 16.1.1 Run-Time Verification and Monitoring . . . . . . . . . . . . . . . 367 16.1.2 Enactment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 16.1.3 Process Mining . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 16.2 Summary of the Part . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Part IV Conclusion and Future Work 17 Conclusion and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 17.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 17.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 17.2.1 Termination of Static Verification and ConDec Extensibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 17.2.2 Reactive Event Calculus and Operational Support . . . . . 381
XXII
Contents
17.2.3 17.2.4 17.2.5 17.2.6
Integration of Regulative and Constitutive Rules . . . . . . 381 Development of an Editor and Enactment Prototype . . . 382 Service Contracting and Discovery in the Semantic Web 383 Integration of Declarative and Procedural Models . . . . . 383
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
1 Introduction If the only tool you have is a hammer, you tend to see every problem as a nail. — Abraham Maslow
The advent of distributed and heterogeneous systems has laid the foundation for the birth of new architectural paradigms, which enable to attack the complexity of the targeted domain by splitting it up into several interacting components. In the field of software engineering, the difference between these paradigms and the classical centralized and monolithic ones has been identified since 1975, when DeRemer and Kron conied the two terms of programmingin-the-small vs programming-in-the-large [91]. A non exhaustive list of systems addressed by programming-in-the-large paradigms includes Business Process Management (BPM) [261], Careflow Protocols and Clinical Guidelines (CGs) [229], Service Oriented Computing (SOC) [134] and Multi-Agent System (MAS) [260]. For example, BPM systems help organizations in decomposing the work into sub-units, whose execution is then delegated to different parties. The behavior of these parties must be disciplined so as to obtain, from their cooperation, the achievement of strategic business goals, such as supplying a service or delivering a product. In all these settings, the focus of the engineering process is on the interaction between the entities composing the system. Modeling and managing the interaction dimension is a challenging task, which has been traditionally tackled by means of procedural specification languages, such as BPMN [263] for BPM, Glare [233] for CGs, BPEL [16] for Web Service (WS) orchestration and AUML [33] for Multi-Agent interaction protocols. However, the ongoing challenges posed by the new Internet era require very flexible and adaptable interaction models able to cope with unpredictable, changing and dynamic environments, where the autonomy of interacting entities and the possibility of exploiting new opportunities must be preserved as much as possible [268] and the expertise of workers must be exploited at best [192]. These arguments have been put forward by several key initiatives and challenges of the European Union’s Programme for Research and
M. Montali: Declarative Open Interaction Models, LNBIP 56, pp. 1–8, 2010. c Springer-Verlag Berlin Heidelberg 2010
2
1 Introduction
Technological Development, such as the Global Computing 1 and the Internet of Services 2 , attesting their utmost importance. In these contexts, procedural, “closed” approaches show some critical drawbacks with respect to flexibility [243, 73, 30, 118]: they require to explicitly enumerate all the ordering constraints among the activities undertaken by the interacting entities, tending to introduce unnecessary rigidity on the way the system’s subparts coordinate with each other. To overcome these drawbacks, open and declarative approaches are gaining consensus as a way to capture regulations, constraints, policies and best practices involved in the domain under study in a flexible way [268, 246, 192, 8, 173]. They separate logic aspects (inherent to the problem itself) from control aspects (related to one specific way to solve the problem), as advocated by Kowalski since 1979 [144]. While a procedural style of modeling forces the modeler to produce a rigid scheme defining one fixed algorithm for disciplining the work, ruling out many acceptable possibilities, declarative approaches are more flexible in nature, since they focus on the (minimal) set of constraints that must be guaranteed to successfully interact. In order to enable the effective adoption of such novel modeling techniques, two fundamental requirements must be satisfied: • they must provide an appealing, intuitive graphical front-end, for the sake of usability by non-IT savvy; • they must be apt to verification, in order to guarantee the trustworthiness and reliability of the developed models, as well as to ensure that the actual executions of the system effectively comply with them. In this book, we characterize the notion of open and declarative interaction models along different dimensions, motivating why they are a suitable choice for complementing the closed and procedural nature of current specification languages, for the sake of flexibility. To support our claim, we consider several significant application domains, namely BPM, SOC, CGs and MASs. We then deeply investigate the use of Computational Logic to formalize and reason upon open declarative interaction models. In particular, we propose an integrated framework, called CLIMB (Computational Logic for the verIfication and Modeling of Business constraints), able to meet both the fundamental requirements of usability and verifiability, thanks to the combination of the ConDec graphical language for specification and the Computational Logicbased SCIFF framework for verification and support. ConDec has been recently proposed by Pesic and van der Aalst [191, 192] for tackling the flexible, declarative and open modeling of Business Processes (BPs). Instead of rigidly defining the flow of interaction, ConDec is able to directly translate business goals, regulations, domain requirements and policies to corresponding constraints between activities, providing a number 1 2
http://cordis.europa.eu/ist/fet/gc.htm http://cordis.europa.eu/fp7/ict/ssai/home_en.html
1.1 Main Contributions of the Book
3
of control-independent abstractions for interconnecting activities, alongside the more traditional ones. The explicit enumeration of the execution traces is avoided, because a ConDec diagram implicitly supports all the execution traces which comply with the modeled constraints. To equip ConDec with a formal semantics and with reasoning and verification capabilities, we propose a complete and automatic translation of all its constructs to the CLIMB formal language. The CLIMB notation is a sub-set of the SCIFF language, which has been originally developed for specifying the rules of engagement disciplining Interaction Protocols in open MASs [8]. The language is associated with a clear declarative semantics which formally captures the notion of compliance of the system’s executions with the prescribed rules. The SCIFF framework provides the g-sciff and sciff proof procedures to reason about the developed models during the design phase as well as during and after the system’s executions. We present the peculiar feature of both proof procedures, studying how they can be combined for giving complete support to the targeted systems, from static verification to enactment, run-time verification&monitoring, a-posteriori verification and mining. The feasibility and effectiveness of the approach are investigated spanning from theoretical aspects, like proofs of formal properties and comparison with temporal logics, to practical applications, experimental evaluations, real industrial case studies and concrete tools.
1.1 Main Contributions of the Book The main novel contributions of this monograph in the specification and verification of interaction models can be grouped into five categories: • • • • •
specification of open declarative interaction models; static verification of interaction models; run-time verification of interaction models; monitoring and enactment facilities; a-posteriori verification and declarative process mining.
1.1.1 Specification of Open Declarative Interaction Models In the book, open declarative interaction models are characterized both in an informal and formal way. The abstractions of activity, event, time, compliance, flexibility and openness are introduced, discussing their grounding in several challenging application domains: BPM, SOC, CGs and MASs. The notion of Event-Based System (EBS) is introduced to comprehensively characterize all these domains. A sound and well-founded framework for specifying declarative open interaction models is provided. Declarative open interaction models target EBSs by providing a good balance between compliance and flexibility, overcoming
4
1 Introduction
over-specification and over-constraining issues. The framework, called CLIMB, centers around the formalization of the ConDec language in terms of reactive rules, expressed in a fragment of the SCIFF language. The translation has a twofold advantage: on the one hand, non IT-savvy have the possibility of developing specifications by working at the graphical level of ConDec, avoiding the direct manipulation of rules; on the other hand, ConDec is equipped with an underlying formal semantics, tailored to the notion of compliance. Thanks to the expressiveness of SCIFF, ConDec is then extended along different dimensions: data-related aspects, non atomic activities and metric temporal constraints (delays and deadlines). The resulting specification framework is compared to the one of propositional Linear Temporal Logic (LTL). The theoretical investigation provides some insights into the qualitative and quantitative characterization of time, shows that the CLIMB-based formalization of ConDec is sound with respect to the LTL-based one, and ultimately points out that SCIFF is strictly more expressive than LTL. 1.1.2 Static Verification of Interaction Models Although declarative technologies improve readability and modifiability, and help reducing programming errors, what makes systems trustworthy and reliable is formal verification. Static verification aims at verifying the model during the design phase, before the execution. It provides support for guaranteeing a-priori that the model will behave, during the execution, in a consistent manner, enabling the premature identification of errors and undesired situations which, if encountered at run-time, could be costly to repair or could even compromise the entire system. The book identifies several kinds of relevant static verification tasks, covering both single interaction models as well as the composition of multiple models, and taking into account also the possible presence of a global choreography model. It then shows how such verification tasks can be either undertaken by the g-sciff proof procedure, or reduced to a model checking problem. Being CLIMB formalized on top of a fragment of First Order Logic, it suffers from semi-decidability issues, and cannot guarantee termination in the general case. To overcome termination issues, we propose a preprocessing technique which analyzes the ConDec model at hand, detecting the presence of potential sources of non termination, and taking proper countermeasures if it is the case. An extensive quantitative evaluation of g-sciff is carried out, investigating its performance and scalability. Its behavior is compared to the one of state of the art explicit and symbolic model checkers. 1.1.3 Run-Time Verification, Monitoring and Enactment Facilities After the design phase, an interaction model is instantiated and executed inside an EBS. Each instance is grounded to a set of concrete interacting
1.1 Main Contributions of the Book
5
entities, whose (unpredictable) behavior must comply with the prescriptions of the model. Two different scenarios arise, depending on whether the interacting entities belong to the same system in which the model has been developed or not. If so, they must be supported during the execution, keeping them constantly informed about the impact of their actions on the prescriptions of the model, and about the enabled and forbidden activities. This task is called enactment. If, instead, interacting entities belong to a third party system, or act in a completely autonomous, uncontrollable and possibly untrusted manner, they must be monitored, assessing whether they are effectively behaving as expected and detecting the occurrence of a violation as soon as possible. Run-time verification and monitoring deal with this issue. In the book, the sciff and g-sciff proof procedures are combined to deal with run-time verification, guaranteeing that possible violations are identified as soon as possible. Furthermore, a reactive version of the Event Calculus (EC) [146, 218] is axiomatized on top of SCIFF, investigating its formal properties and using it to tackle a number of challenging issues: • modeling of properties that vary over time, and characterization of the effects of activities; • monitoring ConDec (optional) constraints; • prompt detection and reification of violations, generating alarm events; • support for compensation mechanisms. It is shown how the joint exploitation of all these reasoning techniques can support the enactment of ConDec models, detecting the execution of activities which would surely lead to eventually encounter a violation, and tracking the status of each constraint. 1.1.4 A-Posteriori Verification and Declarative Process Mining A plethora of EBSs store all the events occurred during the execution of their instances, enabling their retrieval and a-posteriori analysis. The set of stored execution traces provides a fundamental insight about the real behavior of the system. It is therefore extremely important to provide suitable technologies for analyzing such execution traces, e.g. to compare the real behavior with the designed models, or to assess whether business goals have been effectively achieved or not. In the BPM field, this task is commonly called process mining. Nevertheless, its application is not restricted to business process models, but it can seamlessly target any EBS equipped with logging facilities. The application of the declarative technologies presented in this book gives raise to declarative process mining. In particular, two fully implemented mining techniques are presented in the book. The first tool, called SCIFF Checker, verifies whether the collected execution traces comply with (reactive) business rules, specified using a textual pseudo-natural notation which resembles the CLIMB language. Its application on three concrete and heterogeneous industrial case studies is reported.
6
1 Introduction
The second tool, called DecMiner, is one of the few attempts present in the literature to discover declarative models. In particular DecMiner contains a discovery algorithm which applies Inductive Logic Programming techniques to derive a general declarative specification starting from two sets of execution traces, where the first set represent correct behaviors, while the second one encompasses the undesired ones. The derived specification is expressed either in CLIMB or ConDec, thus providing both a textual and graphical representation of the produced results. Both tools have been fully implemented as part of the ProM framework [238], one of the most popular process mining environments.
1.2 Organization of the Book The book is organized in four parts: I. II. III. IV.
Specification; Static Verification; Run-Time and A-Posteriori Verification; Conclusions and Future Work.
1.2.1 Part I: Specification The first part of the book focuses on the graphical and formal specification of declarative open interaction models. Chapter 2 gives an accessible and precise overview of different application domains (Business Process Management, Service Oriented Computing, Clinical Guidelines and Multi-Agent Systems) in which declarativeness and openness are needed to complement the state of the art procedural and closed approaches. In particular, the need for declarative and open approaches is advocated to provide a suitable balance between compliance and flexibility. An informal definition of open and declarative interaction models is provided, introducing the logical architecture of a desired supporting framework. Chapter 3 provides a critical overview of the ConDec language, originally developed by Pesic and van der Aalst for the flexibile specification of Business Processes with a declarative and open flavor. The usability of ConDec is empirically assessed in the light of the cognitive dimensions of notations [122]. The framework of propositional Linear Temporal Logic (LTL) is introduced, sketching how it has been exploited to formalize ConDec. Chapter 4 presents the CLIMB rule-based language, a fragment of the SCIFF Computational Logic-based language, which addresses the formal specification of interaction protocols in open Multi-Agent Systems. The syntax and declarative semantics of the language are presented, giving
1.2 Organization of the Book
7
a formal account to the notion of compliance. Finally, some interesting formal properties related to the CLIMB fragment are discussed. Chapter 5 throws a bridge between the CLIMB and the ConDec languages, by proposing an automatic translation of each ConDec construct into a set of CLIMB rules. In this way, ConDec is equipped with a meaningful, declarative semantics. Interaction models can be specified at the graphical level, automatically obtaining the corresponding formal representation. A theoretical investigation about LTL and CLIMB is provided, assessing the equivalence of the CLIMB-based and the LTL-based representations of ConDec, and comparing their expressiveness. Chapter 6 introduces and studies some very significant extensions to ConDec, exploiting the first-order nature of the CLIMB language. In particular, ConDec is extended with metric temporal constraints, data-aware conditions, and a non atomic model of activities. It is shown that all the proposed extensions can be expressed in CLIMB, thus guaranteeing that the ConDec-CLIMB mapping is still valid. Chapter 7 concludes this part with a discussion of related work and a summary. 1.2.2 Part II: Static Verification The second part of the book deals with the static verification of interaction models, providing support during their design phase. Chapter 8 introduces the problem of design-time verification in open declarative interaction models. In particular, the existential and universal verification of properties are defined, dealing not only with single interaction models, but also with the composition of local models, as well as with their conformance to a global choreography specification. Chapter 9 presents two proof-procedures (sciff and g-sciff) to be used for reasoning from CLIMB specifications, and formally investigates their properties of termination, soundness and completeness. Chapter 10 addresses the static verification of ConDec models by means of the g-sciff proof procedure. After having shown how all the verification techniques presented in the previous chapter can be tackled by g-sciff, we delve into the problem of non-termination, describing a preprocessing procedure for identifying and treating two critical classes of ConDec models, which could cause the proof procedure to run indefinitely. Chapter 11 conducts an experimental evaluation of the proposed methods, showing that g-sciff is an effective technology for statically verifying ConDec models. It is presented how the static verification tasks can be also formulated as a model checking problem, comparing the performance of g-sciff with that of state-of-the-art model checkers. Chapter 12 discusses related work and gives a summary of this second part.
8
1 Introduction
1.2.3 Part III: Run-Time and A-Posteriori Verification In the third part of the book, the run-time and a-posteriori verification of interaction models is presented, providing support during and after their execution. Chapter 13 introduces the problem of open declarative interaction model run-time verification, and discusses the application of the sciff and g-sciff proof-procedures to the run-time verification of interacting entities with respect to ConDec models. Chapter 14 discusses the issue of monitoring the interacting entities during the execution. A reactive form of Event Calculus is axiomatized on top of sciff, enabling dynamic reasoning facilities over the effects of actions and the status of each ConDec constraint. These features are exploited to monitor ConDec optional constraints, to catch and reify violations, and to deal with compensation mechanisms. The combination of REC and the two proof procedures is finally exploited to address the enactment of ConDec models. Chapter 15 presents innovative a-posteriori verification techniques based on CLIMB. Such techniques are applied to event logs containing the execution traces of already completed instances of the system under study, towards declarative process mining. In particular, two declarative process mining tools are presented, reporting the experience made in some real case studies. Chapter 16 concludes with related work and summary. 1.2.4 Part IV: Conclusion and Future Work The last part of the book contains the conclusion and a discussion of open challenges and future work.
1.3 Web Site All the verification techniques, tools, benchmarks and examples presented in the book can be download from http://www.lia.deis.unibo.it/research/climb/ The web site contains also instructions, errata, papers and any additional information.
Part I
Specification
2 Declarative Open Interaction Models The limits of my language mean the limits of my world — Ludwig Wittgenstein
In this Chapter, we provide an informal yet precise characterization of open declarative interaction models along different dimensions, namely modeling abstractions, time, compliance, degree of flexibility and degree of openness. We then give an overview of several application domains in which interaction plays a central role: Business Process Management (BPM), Service Oriented Computing (SOC), Clinical Guidelines (CGs) and Multi-Agent Systems (MASs). We discuss the drawbacks of procedural and closed approaches when dealing with such settings, motivating why we claim that they should be complemented with an open and declarative perspective. Finally, we describe a generic framework for managing the life cycle of open declarative interaction models, spanning from their design to their execution, monitoring and a-posteriori verification, and propose how to fill its building blocks.
2.1 An Informal Characterization of Interaction Models The complexity of today’s information systems poses important engineering challenges. Thanks to the increasing pervasiveness of networks, computers and communication modalities, this complexity is often faced decomposing them, delegating the execution of their sub-parts to a set of autonomous, distributed and possibly heterogeneous entities. These entities interact and collaborate to the aim of achieving the overall goal of the system. Models developed to describe these systems are called interaction models. 2.1.1 Interaction Abstractions: Activity, Event, Execution Trace An interaction model focuses on the dynamics of a system rather than on its static organization: its purpose is to target the overall behavior that must be guaranteed by the interacting entities towards the fruitful accomplishment of the system’s strategic goals while respecting, at the same time, its requirements and constraints. For example, the items involved in an auction must M. Montali: Declarative Open Interaction Models, LNBIP 56, pp. 11–45, 2010. c Springer-Verlag Berlin Heidelberg 2010
12
2 Declarative Open Interaction Models
be sold by adhering to the rules and norms which discipline how offers can be placed by bidders, and how the winner is finally determined by the auctioneer. The dynamics of a concrete interaction is called instance of the system. An instance grounds the interaction model on a specific initial contexts and data, and is executed by a concrete set of participants playing the roles involved in the interaction model. E.g., in an emergency ward the sequence of treatments, exams, drug administrations executed by a group of health-care professionals on a single patient constitutes an instance of the “emergency ward management system”. The execution evolves as the interacting entities perform relevant activities, that represent (atomic) units of work, i.e., the steps of the in which the involved actors have to do something. They are the basic abstractions upon interaction models are built. The execution of an activity causes one or more relevant events to occur; each event is associated to a single time point. An activity is said to be atomic if its execution is traced by means of a single event, non atomic otherwise. Each instance is then completely characterized by the finite set of correlated events which occur during its execution; this set will be referred to as execution trace (or simply trace). In particular, we will use the term partial execution trace if the trace covers only a part of the instance evolution, complete otherwise. The set of complete execution traces characterizing the execution of all the system’s instances is called event log. In the general case, activities encompass actions made by a single participants without involving the other ones (e.g., the revision of a mechanical part) as well as communication between different participants (e.g., informing the customer that a given item is out of stock). Example 2.1.1 (Interaction Model). The set of policies and rules, disciplining the executions of an e-commerce payment protocol involving a customer and a seller, is an interaction model, whose (atomic) activities are the set of message templates supported by the protocol. An instance of the protocol is characterized by a sequence of messages following its templates, exchanged between two agents playing the role of customer and seller. For example, supposing that alice is a customer and hatter a seller, the sequence of events • alice sends a payment message to hatter at time 5, referring to item tea; • at time 7, hatter replies to alice informing her that tea is out of stock; could represent the execution trace describing an instance of the protocol. Being the concept of event the core first-class object of interaction models, in the remainder of the book we will refer to the targeted systems as Event-Based Systems (EBSs)1 .
1
In the context of this book, the term Event-Based System (EBS) has a broader meaning than in the distributed systems setting, where the focus is on events exchanged by software components at the middleware level [179].
2.1 An Informal Characterization of Interaction Models
13
2.1.2 Characterization of Time Since interaction models focus on the dynamics of a system, the temporal dimension plays a central role in them. Events occur “in time”, and therefore the ontological characterization of time has a deep impact on the nature of interaction models. From a foundational point of view, the time ontology can be characterized along many different dimensions, which link atemporal assertions with a temporal reference and provide a meaning to such a temporal reference, denoting its structure and its temporal entities together with their relations [257]. We focus here only on the most relevant aspects for our purposes; the interested reader may refer to [216, 257] for a comprehensive survey on the topic. First of all, it is important to remember that in EBSs the temporal entities correspond to event occurrences. The two temporal primitive candidates for denoting the occurrence of an event are points vs intervals. The point-based temporal primitive associates event occurrences to single instants, whereas the interval-based primitive provides intervals and their durations as firstclass objects. For example, the sentence “the white rabbit arrived at work at 9:00 o’clock” has a point-based nature, whereas “yesterday the rabbit was not at home” relies on a interval-based approach. Temporal primitives are located in time, and therefore the second step consists in the definition of the temporal ordering among primitives, i.e., of the structure of time. In particular, a time structure could be: Linear vs. Branching. If the time structure has a linear topology, then each time instant has exactly one predecessor and one successor2; conversely, a branching structure enables multiple precedessors (branching in the past) and/or successors (branching in the future). Bounded vs. Unbounded. A bounded time structure states that there exists an initial (final) time point which does not have predecessors (successors); if it is not the case, then time is unbounded. Hybrid approaches combine the two notions, stating that time is bounded with respect to the initial time but not to the final time or vice-versa. Finally, temporal entities are connected by means temporal relations. Let us focus on the basic binary relations. They strongly depend on the chosen primitive: in the point-based case, equality (=), inequality (=) and precedence (<) suffice, whereas in the interval-based case 13 different basic relations exist [11]. These relations express relative positions of event occurrences, and are called qualitative. An example of binary, point-based temporal relation is contained in the following sentence: “the white rabbit arrived at work before Alice”. Basic relations are then combined by means of logical operators, such as conjunction and disjunction, to obtain more complex constraints. However, this is still not enough: quantitative relations can be introduced to predicate 2
If the structure is bounded on the past (future), then the only exception is the initial (final) time.
14
2 Declarative Open Interaction Models
upon “distances” between temporal entities [216], expressing the chronological nature of an EBS. Quantitative constraints may be used to express latencies (“the rabbit took 20 minutes to get to work”) and deadlines (“the rabbit should arrive at work before 9:00 o’clock”). In the remainder of this book, we will rely on the following assumptions: Time is point-based. As discussed in Sect. 2.1.1, activities are the basic building blocks of interaction models, and they are represented and traced by one or more corresponding atomic events. In the real world, the event logs storing the execution traces characterizing the executions of an EBS are indeed composed by event occurrences associated to single time points [253]. Time is bounded. Each execution trace has a fixed starting time, corresponding to the time at which the instance is created by the interacting entities, and a final time, whose value is not known a-priori, at which the interaction will terminate. Boundedness on the final time is needed because interaction models are developed to achieve a desired state of affairs (such as a business goal) in finite time, or to finitely detect that such a state of affairs cannot be reached. Time is linear. As pointed out in [255], the debate around linear vs branchingtime frameworks goes back to early 1980s. Each one has its own strengths and weaknesses, and none of them has ultimately dominated the other. We opt for linear time building on [255], where Vardi argues that branchingtime approaches are unintuitive and hard to use, while linear-frameworks are more intuitive and understandable, while maintaining a satisfactory level of expressiveness. Furthermore, it is worth noting that in our setting execution traces are sequences of events [253], and therefore they fit well in a lineartime framework. Obviously, the choice of linear time does not undermine the possibility of accommodating alternatives and decisions during the execution, which is a fundamental requirement towards flexibility: according to Rescher and Urquhart [201], it is the course of interaction which branches in a linear time structure, and therefore we have a “branching in time” instead of a “branching of time”. We do not instead fix whether the temporal relations have a qualitative or a quantitative nature. We leave this choice open discussing its impact on interaction models throughout the book. 2.1.3 Compliance According to Merriam-Webster3 Compliance is the act of conforming, submitting, or adapting (as to a regulation or to another’s wishes) as required or requested. 3
http://www.merriam-webster.com
2.1 An Informal Characterization of Interaction Models
15
In the context of interaction models, such requirements and requests refer to the set of stated rules and regulations concerning any aspect of the targeted system, taking into account internal and external stakeholders. The need for compliance has seen a rapid growth in the last years, due to the outbreak of high-profile financial scandals (like Enron and WorldCom in the USA). New legislation, such as the Sarbanes-Oxley Act, has been produced as a response, increasing the investment of companies in corporate governance and in the corresponding tools and methodologies, to support the alignment and monitoring of their BPs with respect to external regulations. In particular, Zhang has estimated that companies are paying a total amount of $1.4 trillion market costs in order to meet the requirements imposed by the Sarbanes-Oxley Act [270]. Under the umbrella of the generic term “compliance rule”, we find a plethora of different kinds of knowledge, including: • business goals; • internal policies, protocols and best practices; • internal control-flow aspects, defining ordering constraints on the way certain activities must be executed; • business rules, used by the interacting entities to take strategic decisions during the execution; • business contracts, use to regulate the mutual obligations between the system under study and external customers or companies, including for example the negotiated Quality of Service (QoS); • organizational policies and procedures, such as administrative and security policies; • external regulations and norms, referring to jurisdictional and legislative concerns (the Sarbanes-Oxley Act is a notable example). Compliance rules then play a twofold role: on the one hand, they embody the internal knowledge used to guide the behavior of interacting entities, whereas on the other hand they recommend how to act according to the law. They can be therefore perceived as an aspect of the interaction model which introduces centralized (i.e., independent from the single participants) decisions about how to carry out the execution [191]4 . Since the overall effect of compliance rules is to constrain the behavior of the involved parties, restricting the acceptable execution traces, we will refer to them as (business) constraints. A key aspect of business constraints is that they need to be practicable. As pointed out by Ross [204], being practicable means that “a person who knows about a business rule could observe a relevant situation (including his or her own behavior) and decide directly whether or not the business was complying with the business rule”5 . An instance of the targeted system is said to be 4 5
In [191], the term support is adopted in place of compliance. Business rules are a special kind of business constraints, namely business constraints that are under the internal business jurisdiction.
16
2 Declarative Open Interaction Models
correct or compliant with an interaction model if its execution trace adheres to all its business constraints. If an execution trace is compliant with the model, we say that the model supports such a trace. Example 2.1.2 (Business constraints in the medical setting). Let us focus on the medical domain, introducing some business constraints which reflect the different kinds of knowledge identified above. • The sequence of steps that must be followed to perform a laboratory analysis on a specimen, constitutes an internal protocol. • The set of regulations governing the privacy of patients is an external legislative concern. • When a person is hospitalized, a business contract is stipulated between the inpatient and the health-care structure; the contract must be then honored by both parties thereafter. • The fact that “each time a patient has an examination, then a corresponding report must be delivered by the health-care structure within one month”, is an example of administrative policy. • The four eyes principle (also called two-man rule) is an internal policy stating that a certain critical action must be performed by two different persons; e.g., a report produced from a laboratory analysis must be subject to a double approval, performed by two different physicians. A slightly different version of the four eyes principle states that two activities cannot be performed by the same entity. As we will see throughout the book, business constraints are of very different kinds. Let us provide some examples to attest this variety: • “when the order is successfully committed by the customer, the seller is committed to deliver the order within 7 days at most” is a time-ordered constraint (involving a quantitative time constraint); • “the application form must be sent by e-mail and via fax” is a timeunordered constraint; • “the ATM machine will accept at most three payment attempts” is a cardinality constraint; • “after having closed an order, it is not possible to add further items” is a negative constraint; • “when the customer must pay for the order, she can choose between credit card or cash as suitable payment methods” represents an opaque, non deterministic choice. 2.1.4 Flexibility Roughly speaking, flexibility is the model’s capability of embracing change and promptly adapting to it. A flexible approach leaves the entities as much as possible free of exploiting their own expertise to take strategic decisions,
2.1 An Informal Characterization of Interaction Models
17
evaluate opportunities and find the best way to interact. In [215], Schonenberg et al. identify a taxonomy of four distinct types of flexibility, which act on different stages of the system’s life cycle, and involve either the modeling language used to specify interaction, or the underlying supporting environment. We briefly recall them in the context of interaction: Flexibility by design. The ability of accommodating flexibility directly at the language level, dealing with it during the design of an interaction model. This requires a specification language able to leave many possible alternatives open to the interacting entities, which can then dynamically select the best way of execution. Flexibility by underspecification. The ability of the modeling language to support incomplete specifications, and of the environment to support the “late modeling” of the unspecified fragments, during the execution. Here, flexibility is guaranteed by the fact that parts of the interaction model can be defined on-the-fly. Flexibility by deviation. The ability of the support system of accommodating (occasional) deviations from the “fixed” prescriptions contained in the model, which is not required to be flexibility-oriented. Flexibility by change. The ability of the environment to handle both occasional and permanent unforeseen behaviors, enabling, for the latter situation, the possibility of changing the interaction model. In this book, we will mainly focus on flexibility by design, towards the development of flexible models starting from their creation and along their whole life cycle. While the other types of flexibility mainly focus on the execution phase, i.e., the interacting entities are supported in the resolution of flexibility issues at run-time, the purpose of flexibility by design is to equip the modeler with suitable abstractions for accounting with such issues. When it comes to the characterization of the “flexibility by design” dimension, at the two opposite sides we find procedural approaches versus declarative ones. Given a problem to be solved, the difference between these two perspectives can be roughly summarized as follows: • a procedural approach aims at defining a rigid, specific solution to the problem; • a declarative approach focuses instead on the problem itself, aiming at the identification of its requirements, features and constraints, and delegating the synthesis of a solution to a general-purpose algorithm. Declarative approaches separate logic aspects (what should be accomplished) from control aspects (how to accomplish it), in the spirit of the well-known Kowalski’s pseudo-equation [144]: ALGORIT HM = LOGIC + CON T ROL In other words, declarative models specify what should be done without being concerned with how it should be done.
18
2 Declarative Open Interaction Models
In the context of interaction models, a procedural specification is a complete description of the allowed flows of activities, that must be strictly followed when executing an instance (low degree of flexibility), whereas a declarative specification focuses on the (minimal) set of business constraints that must be guaranteed in order to correctly interact (high degree of flexibility). Example 2.1.3 (Flattening of a list). To concretely show the difference between a declarative and a procedural style of modeling, let us present a simple case study focused on programming languages. In particular, let us consider the problem of flattening a list: given a list of lists In, devise and implement an algorithm which returns a list corresponding to the flattening of In. If In is a simple element, then the result should be a list containing that element. For example, when applied to the list [f, [l, a, [t]], [m, e]], the algorithm must produce the flattened list [f, l, a, t, m, e] as result. When the modeler faces the problem by adopting a declarative perspective, she must focus on the inherent characteristics of the problem, i.e., on the definition of “flattening”, trying to reformulate it in a clear and precise manner. An unambiguous definition is: • the flattening of the empty list is the empty list; • the flattening of a simple element is the list containing that element; • the flattening of a non-empty list L corresponds to the concatenation of the lists obtained by flattening the head and the tail of L. This definition can be directly represented using the Prolog declarative language [49, 227]: flatten([],[]). flatten(El,[El]):- atom(El). flatten([H|T],Lout):flatten(H,Hout), flatten(T,Tout), append(Hout,Tout,Lout). This program expresses the logic part of the algorithm, whereas control is provided by the general purpose Prolog engine, based on SLD(NF)-resolution [143]. Differently from declarative programming, a procedural/imperative programming style would instead require to synthesize a specific flow of instructions to solve the problem. Listing 1 reports a possible solution in pseudo-code, where a Lisp-style terminology is used for lists.
2.1 An Informal Characterization of Interaction Models
1 2 3 4 5 6 7 8 9 10 11
19
function: flatten(In, the list to be flattened) returns : Out, the flattened version of In begin if empty(In) then return emptyList(); else if atom(In) then return cons(In,emptyList()); else Hout ← flatten(head(In)); Tout ← flatten(tail(In)); return append(Hout ,Tout ); end end
Algorithm 1: flatten(In)
2.1.5 Openness An interaction model contains a finite number of activities and (flow) constraints. A question then arises: how does the interaction model relates with the information that has not been explicitly captured? Again, there are two opposite extremes: • a closed interaction model makes the assumption that all the behaviors which have not been explicitly enumerated in the model are forbidden; • an open interaction model makes the opposite hypothesis, leaving the behavior of interacting entities unconstrained unless explicitly specified. An open interaction model is therefore suitable for dealing with open system, i.e. systems in which “the behavior of the members and their interactions cannot be predicted in advance” [132]. Semi-open approaches mediate between these two extremes, supporting the development of closed models which partially embrace unpredicted events and executions, e.g. when certain (exceptional) conditions arise, or when certain “special” events are involved. Example 2.1.4 (closure vs openness). Let us consider the following business constraints: “you have to do a, then b, and then c”. Under a closed interpretation of these business constraints, the word “then” is considered as a very strict ordering relationship, and thus only the execution trace containing the exact sequence a → b → c would be supported by the model. Conversely, by adopting an open perspective the word “then” can be interpreted in different ways, ranging from a completely closed interpretation to a completely open one. This latter interpretation only imposes that the execution trace contains a, b and c in the requested order, but other activities can be performed as well, in an arbitrary order, number and position with respect to a, b and c.
20
2 Declarative Open Interaction Models
Therefore, infinite compliant traces can be produced . For example, the execution trace b → a → d → b → c → e would be accepted; the execution trace b → a → d → c → b → e would be instead rejected, because after the execution of b no activity c is executed, contradicting one of the required business constraints. With an open perspective, the mere presence of positive business constraints, i.e., constraints stating what should be done under certain circumstances, expressing the mandatory behaviors, is not sufficient to capture the complexity of EBSs. In fact, each open interaction model would always support an infinite number of execution traces, provided that they at least satisfy the mandatory behavior requested by the business constraints. To overcome this limit, an open modeling language should support also negative business constraints, to state what cannot be done under certain circumstances, expressing the forbidden behaviors. The combination of positive and negative constraints makes it possible to cover a variety of cases, and even to partially close the model, as attested by the following example. Example 2.1.5 (negative business constraint). Let us consider the following business constraint: “when a payment request is received by the bank, then the bank must immediately update the account of the requestor”. Here, the term “immediately” suggests that the ordering relation between the reception of the payment and the account update must be interpreted in a strict, closed manner. To deal with such a constraint in an open setting, a combination of two different rules could be adopted: • a first positive constraint expresses the ordering between the two activities, i.e., that after a payment reception, the account must be updated; • a second negative constraint expresses that the two activities must be executed next to each other, namely that no further activity can occur in between. It is worth noting that openness and flexibility are tightly related. An open modeling language is apt to flexibility by design: the ability of accommodating the execution of unforeseen activities, which is an essential feature of open approaches, is the first step towards embracing change.
2.2 Business Process Management Companies can reach their business goals and produce a specific service or product that is of value to the customer only if all the involved participants and activities are well coordinated and regulated. To achieve this goal, a collection of related activities aimed at finalizing a service or product is organized in a Business Process (BP). As defined in [261]:
2.2 Business Process Management
execution traces
21
diagnosis
on uti ec ex
de sig n
feedback
Business Process life cycle
Business Process
Fig. 2.1. The Business Process life cycle
A Business Process consists of a set of activities that are performed in coordination in an organizational and technical environments. These activities jointly realize a business goal. Each Business Process is enacted by a single organization, but it may interact with BPs performed by other organizations. Business Process Management (BPM) is a collection of methods and techniques for assisting business practitioners, employees and the technical staff in the management of BPs along their entire life cycle [97], depicted in Fig. 2.1. The first phase of the BPM life cycle is the design stage, in which the BPs of the company are analyzed and modeled. To develop a BP model, process modeling languages are employed. Such languages typically provide a graphical notation, for the sake of readability and user-friendliness. The obtained model is then implemented in a BPM system, an information system acting as an engine for the execution of process models. The execution engine guides the work of the involved participants, supporting the enactment of different process instances. Each performed activity is tracked inside the information system, storing all the generated execution traces. In the last diagnosis phase, the information recorded in the collected traces is analyzed to evaluate whether business goals have been effectively achieved, exploiting the outcome of this analysis to take new strategic decisions. The outcome of the diagnosis stage is then used as a feedback for the original BP models, in order to improve them and better align them with the internal expected outcome and the needs of external stakeholders.
22
2 Declarative Open Interaction Models
A start event
A task
Identify Payment Method
Cash
An end event Accept Cash
Payment method?
A sequence flow Credit Card
Prepare Package for Customer
Process Credit Card
A gateway "decision"
Fig. 2.2. A simple Business Process (BP) modeled in BPMN (adapted from [262])
2.2.1 Modeling Business Processes In the last years, a huge number of BP modeling languages have been proposed by industry and academia. Some notable examples are BPMN [184], YAWL [231], XPDL [265] and BPEL [183]6 . Despite their graphical differences and specific peculiarities, all these languages mainly focus on the control-flow perspective of BPs, i.e., on defining the possible orderings in which activities can be executed over time. Concerning control-flow aspects, they all rely on three abstraction types: activity, the atomic unit of work; sequence flow, the basic connection defining a strict ordering relation between two activities, i.e., that they must be performed next to each other; gateway, a point in the process where the flow splits into multiple flows, or multiple flows are merged into a single flow. Example 2.2.1 (A BPMN model). Fig. 2.2 shows a simple BP represented in BPMN. The first activity that must be performed when executing an instance of the BP is the Identify Payment Method activity, used to identify which kind of payment is preferred by the customer. Then, depending on the preferred payment, one between the Accept Cash activity and the Process Credit Card is chosen (the decision is represented by a diamond-shaped gateway). Finally, a package is prepared for the customer, leading the instance to its conclusion. As shown in Example 2.2.1, specification languages following the “sequence flows&gateways” paradigm lead to produce procedural and closed models. They are procedural because the language imposes to explicitly tackle all the ordering constraints among activities, synthesizing a set of pre-defined ways 6
A comprehensive pattern-oriented evaluation of the major BPM modeling languages, including standards, open-source and commercial solutions, is being carried out by the Workflow Patterns [239] initiative. Check it out at http://www.workflowpatterns.com
2.2 Business Process Management
23
for accomplishing the business goal (in the example, receiving the payment and preparing the package); BPs then become a rigid scheme representing one fixed algorithm for orchestrating the work. They are closed because the execution of each activity is allowed and mandatory at a given time only if the flow has currently reached that activity; by considering Fig. 2.2, the person responsible for packages can and must begin to prepare a package only after the cash has been accepted or the credit card has been processed. Example 2.2.2 (Execution traces compliant with a BPMN model). Let us again focus on the Business Process Modeling Notation (BPMN) model depicted in Fig. 2.2. Due to the closure of Business Process Modeling Notation (BPMN), the model supports only two execution traces: • the sequence start → Identify Payment Method → Accept Cash → Prepare Package for Customer → end, when the customer chooses to pay by cash; • the sequence start → Identify Payment Method → Process Credit Card → Prepare Package for Customer → end, when the customer chooses to pay by credit card. 2.2.2 Limits of Procedural Business Process Modeling A procedural and closed perspective in BPs modeling is suitable when the domain under study presents a high degree of predictability and repetitiveness. This is the case of production workflows [152]). Such workflows have an intrinsic rigid nature: they aim at providing full support for well-structured BPs, imposing the explicit definition of all the allowed pathways. There are application domains in which such a rigidness is not only preferable, but is a mandatory requirement: just think to e-banking transactions. However, there are also a plenty of situations where BPs are unpredictable and frequently changing. Processes in Small and Medium Enterprises, medical treatments, groupware systems, disaster recovery procedures are examples of domains characterized by different degrees of autonomy, unpredictability and turbulence, where the ability of adapting to environmental changes and to the acquisition of new knowledge is a key requirement. In all these cases, the experience, knowledge, imagination and creativity of domain experts play a vital role, and should not be clipped by the rigidity of closed, procedural approaches. A procedural style of modeling clashes with the unstructured declarative knowledge of business practitioners, who perceive each BP as a “container” of many different aspects, including business goals, business rules, external regulations, internal policies and best practices (see Sect. 2.1.3). To fill this gap, the connection between business experts and BP models is mediated by the presence of a technical person, whose assignment is to extract all the relevant business constraints from the experts, trying to combine the whole set of constraints towards the synthesis of a compliant procedural specification (see Fig. 2.3).
24
2 Declarative Open Interaction Models business constraints
policies
knowledge level
declarative model
design level
procedural model
business rules
regulations
legislation
Fig. 2.3. Procedural vs declarative perspective in Business Process modeling
The limits of procedural and closed BP modeling languages have been put forward by many authors [241, 259, 249], who argue that to be successfully adopted, BPM technologies must make a trade-off between controlling the way workers do their business (compliance) and turning them loose to exploit their expertise during the execution (flexibility). Stemming from this observation, different BP modeling languages and management systems have been developed to accommodate the types of flexibility discussed in Sect. 2.1.4, like for example Adept2 [84], Flower [39] and ConDec [192, 193]. In her PhD dissertation [191], Pesic carries out a deep investigation of these limits, pointing out that the procedural nature of contemporary BPM approaches tends to determine the way companies organize work, forcing them to adjust their BPs to the underlying management system. This fact has a twofold impact: • people perceive the system as an obstacle, performing their concrete work outside the system and recording what has been done in a separate moment; • due to the gap between people’s preferred way of work and the system’s way of work, the risk of designing inappropriate BPs increases. In particular, the modeler could both incur in the risk of introducing noncompliant undesired behaviors, as well as of loosing acceptable executions. Furthermore, there is also an intrinsic difficulty related to the translation of the business constraints into corresponding execution flows. This last issue will be discussed in Sect. 2.3.3 for the case of service choreographies, which are subject to the same problems when trying to derive a procedural specification starting from a set of declarative business constraints.
2.3 Service Oriented Computing
25
Service Registry find
publish
network Service Consumer
interact
Service Provider
Contract
Fig. 2.4. Service Oriented Architecture
2.3 Service Oriented Computing Service Oriented Computing (SOC) is an emerging computing paradigm which employs services as the basic components towards the development of largescaled distributed applications in heterogeneous environments. Its underlying enabling technologies and languages are reaching a good level of maturity and a widespread adoption, drawing the interest of both software vendors and scientists [243]. As stated in [187]: The visionary promise of SOC is a world of cooperating services where application components are assembled with little effort into a network of services that can be loosely coupled to create flexible dynamic business processes and agile applications that may span organizations and computing platforms. Roughly speaking, services are self-contained software components which incapsulate computing functionalities, exposing their core business competencies over a network in the form of an usage contract/interface. Third-parties may utilize an exposed functionality by means of standardized languages and protocols, without a direct access to its concrete implementation. 2.3.1 Service Oriented Architecture The basic Service Oriented Architecture (SOA) is depicted in Fig. 2.4. The architecture involves three roles and three fundamental operations: • The service registry maintains a list of known service contracts together with their location, and provides support for searching a certain functionality, returning the location of a service able to accomplish it. • The service provider encapsulates a business function (or a set of business functions), exposing a corresponding usage contract, which can be sent to a service registry for publishing it.
26
2 Declarative Open Interaction Models
• The service consumer is the participant which requires a given functionality. If it is not aware of services able to accomplish the requested functionality, it has the possibility to consult the service registry in order to find a suitable service. After having retrieved the contract and location of a suitable service, the consumer can finally interact with the provider by invoking the desired functionality as described in the contract. Heterogeneous service providers and consumers can effectively interact only if the three operations of publishing, finding and interacting as well as the service contracts rely on standardized languages and protocols. Each concrete SOA implementation must then fix its standards and protocols, tailored to the underlying network in which the implementation is deployed. Thanks to the widespread diffusion of the Internet, the web implementation of SOA is nowadays the most popular. In the web implementation, the functionalities provided by business applications are encapsulated within Web Services, whose usage contracts can be retrieved and used by consumers through a stack of Internet standards including: • HTTP for the transmission of messages. • XML for the representation of the messages content, and as the basis upon which the WS-specific languages are built; • SOAP [124] as an XML-based lightweight communication protocol intended for exchanging structured information, defining the format of messages. • WSDL [68], an XML format for describing the usage contracts (also called interfaces) of services; each service is characterized as an endpoint operating on messages, providing at the same time an abstract definition of the supported operations and messages, and a concrete binding to an underlying network protocol and message format. • UDDI [236], a registry that stores services usage contracts and supports a set of standardized, publicly accessible XML-based APIs for publishing WSDL descriptions to the repository and querying the repository in different ways. 2.3.2 Orchestration and Choreography The role of service consumer could be played by a human user but also by another service provider; in this way, the functionalities realized by single services can be composed, giving birth to complex collaborative distributed business applications. Organizations can mutually benefit from each other by exposing their own functionalities and exploiting third-party services. The focus shifts from a functional view of services as business units offering “atomic” operations, to the (distributed) BPs regulating the interaction inside a service composition. Two different complementary approaches can be followed to realize/perceive a service composition [190]: orchestration and choreography (see Fig. 2.5).
2.3 Service Oriented Computing Company A Orchestration
27
Company B Choreography
Orchestration
Internal Service
Fig. 2.5. Orchestration and choreography
Orchestration perceives the collaboration by the point of view of a single participant. The party synthesizes an executable BP which can interact with internal and external services, delegating the realization of some activities to such services. Under this perspective, the execution is driven by the single party as well: it acts as an orchestrator, coordinating the other services and correlating the results obtained from them. The invoked external services are unaware that they are participating in a collaboration: the interaction state is handled by the orchestrator, while the orchestrated services perceive the interaction in a stateless manner. The orchestrator itself could be exposed as a single service, making it possible to realize even more complex “nested” orchestrations. BPEL is the current de-facto standard for developing service orchestrations; it provides an XML-based language for modeling the (procedural) BP describing the flow of orchestration, and binding the involved activities to external WSDL interfaces. A BPEL engine drives the execution of the BPEL process instances, taking care of invoking the external service when needed. Example 2.3.1 (Orchestration). A company is interested in entering the ecommerce market by realizing a Business-To-Consumer (B2C) web portal selling books. Through the e-bookshop portal, the user can perform the following operations: • browsing and searching a book catalogue, obtained by merging two distinct already available catalogues – when a book is contained in both catalogues, the minimum price is shown; • buying the selected books by credit card, activating a corresponding physical delivery service. Although the perception of the user is of a single e-bookshop service, it is internally implemented as a workflow coordinating four different external services: the two “real” catalogues for obtaining the informations about the books, a certified e-banking service for handling payment transactions in a secure manner, and a delivery courier service to manage the concrete dispatch of books.
28
2 Declarative Open Interaction Models 1st catalogue
seller
2nd catalogue e-bookshop Consumer
Provider (Orchestrator)
Choreography
e-banking
customer delivery service
Fig. 2.6a. Topology of a service orchestration
warehouse
Fig. 2.6b. Topology of a service choreography
When the user buys a book, the e-bookshop interacts with the e-banking service to check the validity of the received credit card, returning an error message to the customer or triggering a payment transaction. If the transaction is correctly completed by the e-banking service, the e-bookshop sends a message to the delivery service by providing the address of the customer, as well as the information about the book to be delivered. As shown in Fig. 2.6a, the e-bookshop is therefore responsible for the orchestration of these four services, guiding the interaction as a centralized controller. Differently from orchestration, choreography models the collaboration from a global, objective point of view, independently from the perception of the single interacting services. Its focus is not on executability, but rather on capturing the public multi-party contract which provides the necessary rules of engagement for making all the interacting entities correctly collaborate. The choreography vs orchestration perspective in a service composition is shown in Fig. 2.5. They are complementary; while orchestration focuses on the viewpoint of a single party, choreography is super partes: it abstracts away from the internals of participants and takes into account their mutual requirements and business constraints without assuming a unique center of control. The internal implementation of participants (i.e., the local BPs/orchestrations) can be seamlessly changed as long as their external observable behavior complies with the choreography constraints. This makes choreography especially suited for Business-To-Business (B2B) environments. In a B2B setting, several organizations share their own services to mutually benefit from each other, trying to jointly accomplish a complex goal, impossible to be pursued alone. In this context, it is often impossible to make the assumption that one of the involved organizations will take the lead during the interaction, acting as a global orchestrator for the whole system. As pointed out in the WS-CDL specification [141]: In real-world scenarios, corporate entities are often unwilling to delegate control of their BPs to their integration partners. Choreography offers a means by which the rules of participation within a
2.3 Service Oriented Computing
29
collaboration can be clearly defined and agreed to, jointly. Each entity may then implement its portion of the choreography as determined by the common or global view. Example 2.3.2 (Choreography). Three organizations wish to integrate their services in order to facilitate the purchase and delivery of mechanical parts. The first company needs the mechanical parts, i.e., it plays the role of customer. The second company builds and sells the mechanical items, and exploits the facilities offered by the third company, a warehouse, for storing them. In order to coordinate their services, the three companies jointly define a contract containing the business constraints that must be satisfied during the interaction, i.e., they model a purchase choreography. Fig. 2.6b sketches its topology, showing that, differently from orchestration, all the interacting services are equally responsible for carrying out the collaboration, and there is no global coordinator. Let us focus on a fragment of the choreography, regulating the decision taken by the seller after having received an order from the customer; the seller could freely decide whether to confirm or refuse the order, but it must obey to the following constraints: • if the warehouse cannot ship the order, then the seller must refuse it; • the seller can accept the order only if the warehouse has previously accepted its shipment; • both the seller and the warehouse cannot accept and reject the same order, i.e., answers are mutually exclusive. 2.3.3 Limits of Procedural Choreography Modeling Modeling a service choreography is a hard task. On the one hand, its purpose is to constrain interacting services so as to ensure that their actual behavior complies with the agreed business constraints. On the other hand, it is of key importance to guarantee the autonomy of each party, turning it as much as possible loose to choose the internal BPs used to realize its part of the choreography, for the sake of service interoperability and replaceability. Autonomy, in turn, is preserved only if the choreography modeling language is flexible. As pointed out in [30, 246], while the technologies for implementing and interconnecting basic services are reaching a good level of maturity, modeling service interaction from a global viewpoint, i.e., representing service choreographies, is still an open challenge: the leading current proposals, such as BPEL [183] and WS-CDL [141], fail to tackle the right balance between compliance and flexibility. The main problem is that, despite the complementarity of choreography and orchestration, current mainstream approaches propose very similar languages and methodologies to model them both. They impose to completely specify the control and message flow of the interacting services, forcing the user to adopt a procedural and closed style of modeling. We claim instead that choreography contracts constitute a form of declarative and open
30
2 Declarative Open Interaction Models
knowledge, which states what is forbidden and mandatory in services without giving details about how to carry out the interaction, nor making the unreasonable assumption that all the allowed behaviors can be explicitly captured. To illustrate the difficulty of handling even simple choreographies with classical procedural approaches, let us consider the business constraints introduced in Example 2.3.2. They leave many open possibilities to the concrete services which realize the collaboration. For example, when and how the warehouse is contacted is not specified in the contract, and there could be several choreography executions in which the warehouse is not contacted at all: an execution in which the seller autonomously decides to reject the order, without asking the opinion of the warehouse, is supported by the choreography. This example clearly shows that compliant executions are not explicitly enumerated in the choreography, but are instead implicitly supported, attesting that the choreography follows an open paradigm (see Sect. 2.1.5). When the modeler tries to encode this kind of knowledge using a classical procedural specification language such as BPEL or WS-CDL, she is forced to explicitly enumerate all the implicitly supported executions, and to introduce further unnecessary details. Consider for example the adoption of BPMN collaborative diagrams to graphically capture the fragment of the purchase choreography. For simplicity, we do not consider the customer role, but focus on the interaction between the seller and the warehouse after having received the customer’s order. All candidate diagrams will surely contain two separated pools, one for the seller and one for the warehouse, each one containing the set of activities pertaining to the corresponding role. The problems arise when the modeler interconnects these activities by means of control and message flows, trying to answer to the following questions: • Which activities must be executed in sequence? • How to deal with negative information such as “the seller cannot accept and reject the same order”? • How to model non-ordered constraints, like “if the warehouse refuses the order, then the seller must also refuse (or have refused) it”? • Who is in charge of contacting the warehouse? And when? The difficulty of providing an answer to these question by adopting procedural and closed approaches can be ascribed to three main causes [173]. First, they have a lack of proper abstractions. Activities can be interconnected only by means of positive temporally-ordered sequence relationships and gateways. Modeling other kind of constraints has the effect of deviating from the business constraints or complicating the choreography. For example, capturing temporally-unordered relationships leads either to choose one ordering and impose it in the model, compromising flexibility, or to explicitly capture all the possible orderings, introducing ambiguous decision points to combine them. An example of this issue is shown in Fig. 2.7, where a positive “coexistence” constraint is modeled in BPMN. Such a constraint does not impose any ordering between the involved activities, but simply states that if one of them
...
refuse shipment
...
Warehouse
Warehouse
2.3 Service Oriented Computing
31
refuse shipment ...
... refuse shipment
...
refuse order
...
Seller
Seller
refuse order ...
?
decision driven by the seller
... refuse order
Fig. 2.7. Two possible compliant ways for modeling the business constraint “if the warehouse refuses the order, then the seller must also refuse (or have refused) it” in BPMN
is executed, then the other must be executed as well. The diagram on the left imposes one fixed ordering: there is no support for the inverse ordering of activities (first an order refusal and then a shipment refusal) nor their parallel execution, although they are both in accordance with the coexistence constraint. The diagram is therefore an example of over-constrained model. Conversely, the diagram on the right is less constrained, but it introduces unnecessary further elements, such as decision gateways and intermediate messages. In particular, it assumes that the seller takes care of deciding which order must be chosen, but it is not clear how the seller could undertake this decision. It is therefore an over-specified diagram. The second issue is the closed nature of contemporary choreography modeling languages, which forces to enumerate all the allowed executions. This is especially difficult when the business constraint is negative, as the third rule of Example 2.3.2. The rule states that the order/shipment acceptance and rejection are mutually exclusive. The difficulty of modeling this kind of rule comes from the fact that negative information cannot be directly represented by the language, and it is under the responsibility of the user to check that it is implicitly entailed by the designed model. By considering again Example 2.3.2, this would imply that the modeler must analyze each possible course of interaction supported by the designed choreography model, verifying whether it is guaranteed that two opposite answers are never sent. This task must be repeated for each negative constraint contained in the global contract, and becomes unreasonable as the complexity of the model increases. The third disadvantage, brought by the lack of proper abstractions and the closed nature of flow-oriented languages, is called premature commitment. Premature commitment refers to the fact that the modeler is forced to prematurely take decisions and make assumptions about the interaction. For example, even if the choreography fragment listed in Example 2.3.2 does not specify when, by whom and how the warehouse must be contacted, a choice must indeed be taken during the modeling phase.
7 CartaoCidadaoException (complete) 64
SICCSException (complete) 32
SIPSCFatalRemoteCallException (complete) 3
AssinaturaNaoIncluidaException (complete) 1
ConcurrentModificationException (complete) 5
The ConDec notation will be extensively described in Chap. 3. SVIBusinessUserException (complete) 18
DESException (complete) 135
AFBusinessException (complete) 64
GREJBConcurrencyException (complete) 15
GRConcurrencyException (complete) 8
PessoaSingularNotFoundException (complete) 138
SVIBusinessException (complete) 1
PASException (complete) 2
ValidationException (complete) 31
NullPointerException (complete) 104
ITPTServerException (complete) 21
GREJBBusinessException (complete) 45
PesquisaAmbiguaException (complete) 6
TooManyRowsException (complete) 112
LimiteTemporalException (complete) 4
GILBusinessException (complete) 14
IOException (complete) 27
AFException (complete) 1
ServerException (complete) 132
SQLException (complete) 9
SICCLException (complete) 175
CSIBusinessException (complete) 14
RSIValidationException (complete) 25
CSIPersistencyException (complete) 3
MoradaPortuguesaNotFoundException (complete) 1
COOPException (complete) 4
PGWSException (complete) 168
SIPSCFatalException (complete) 20
PessoaColectivaNotFoundException (complete) 23
ServiceDelegateRemoteException (complete) 3
CPFBusinessException (complete) 3
GRServicesException (complete) 7
GREJBPersistencyException (complete) 179
PGException (complete) 6
RSISystemException (complete) 28
RSIException (complete) 1
BasicSystemException (complete) 16
SOAPException (complete) 22
BusinessLogicException (complete) 183
SIPSCRemoteBusinessException (complete) 51
GILConcurrencyException (complete) 1
InvalidNISSException (complete) 14
ConcorrenciaException (complete) 5
CDFBusinessException (complete) 6
ParametrizedBusinessException (complete) 2
SIPSCException (complete) 27
SIPSCDatabaseException (complete) 1
BusinessException (complete) 159
SAFBusinessException (complete) 115
SSNServiceException (complete) 1
RPCException (complete) 1
DESWSException (complete) 14
EstabelecimentoNotFoundException (complete) 187
GREJBRemoteServiceException (complete) 34
CSIRemoteException (complete) 3
GDServicesException (complete) 4
ADOPMessageException (complete) 3
FileNotFoundException (complete) 31
NaoExistemRegistosException (complete) 143
ContribuinteRegionalNotFoundException (complete) 63
SIPSCNoRecordsFoundException (complete) 160
ADOPUserChoiceException (complete) 1
JDOFatalUserException (complete) 124
RPCBusinessException (complete) 38
LayoffException (complete) 1
RSIPersistenceException (complete) 24
QgenMIParametrizedBusinessException (complete) 1
CMPException (complete) 1
ReportException (complete) 5
ADOPException (complete) 6
ITPTExternalServiceException (complete) 183
Exception (complete) 187
32 2 Declarative Open Interaction Models
Fig. 2.8. A spaghetti-like model illustrating the real behavior of a J2EE application server [256]
The combination of these drawbacks has the effect that choreographies become
• over-specified, because unnecessary activities, messages exchange and constraints are introduced, even if they do not appear in the business-level choreography contract; • over-constrained, because acceptable interactions, supported by the choreography contract, are dropped out.
As a consequence, while compliance is respected, flexibility becomes sacrificed: potential partners are discarded and fruitful interactions are rejected. This attests the huge gap between the choreography contract and the produced model. Furthermore, when the modeler tries to get back flexibility by relaxing the imposed constraints and reducing premature commitments, overspecification is even more stressed. The resulting choreography tends then to become a tangled, unintelligible spaghetti-like model [85] (such as the one depicted in Fig. 2.8), and, at the same time, the risk of supporting undesirable behaviors increases. Fig. 2.9 shows how the purchase choreography fragment described in Example 2.3.2 can be easily specified with a declarative constraint-based language such as ConDec7 . Fig. 2.10 depicts instead two possible BPMN collaborative diagrams which try to model the whole set of business constraints by mediating between compliance and flexibility. The over-constraining and
2.3 Service Oriented Computing
confirm order
33
refuse order answers are mutually exclusive
the seller can accept the order only if the warehouse has previously accepted its shipment
if the warehouse cannot ship the order, then the seller must refuse it
confirm shipment
refuse shipment
Fig. 2.9. Fragment of a purchase choreography modeled in ConDec seller
warehouse
...
seller
warehouse
...
...
request for shipment
...
request for shipment
cancel request refuse order
refuse shipment
refuse shipment
...
... accept order
...
confirm shipment
...
confirm shipment accept order
refuse order
...
...
cancel request
...
...
Fig. 2.10. Two possible BPMN diagrams modeling the same choreography fragment targeted in Fig. 2.9 [173]
over-specification issues become here apparent: to produce correct BPMN models, further elements must be introduced even if they are not mentioned in the contract (see e.g. the contact warehouse activity), while at the same time some acceptable execution traces are not supported. For example, both diagrams do not foresee a shipment refusal sent by the warehouse after the refusal of the seller; even if the refusal of the warehouse seems to be, in this case, insignificant, it could be involved in other constraints of the choreography, and should therefore be supported. As shown in Figure 2.7, adding this behavior would require to complicate the model, introducing an ambiguous decision point. Last but not least, handling this issue would be even more difficult when the modeled fragment has to be composed with other constraints to capture the whole choreography.
34
2 Declarative Open Interaction Models
2.4 Multi-Agent Systems The issue about what information should be captured or left out by the global view of interaction has been (and is still) matter of discussion also in the MultiAgent System (MAS) research community. According to Wooldridge [264]: An agent is a computer system that is capable of independent actions on behalf of its user or owner. In other words, an agent can figure out for itself what it needs to do in order to satisfy its design objectives, rather than having to be told explicitly what to do at any given moment. A MAS is one that consists of a number of agents, which interact with one another, typically by exchanging messages through some computer network infrastructure. The definition points out two main fundamental properties that characterize the notion of agency: autonomy and social ability. Beside these, there is a broad consensus about two further properties that must be enjoyed by agents: reactivity and pro-activeness. Reactivity refers to the ability of perceiving and timely responding to stimuli coming from the environment in which the agent operates. Pro-activeness refers instead to the ability of going beyond reactivity, exhibiting a goal-directed behavior, taking the initiative and autonomously taking decisions. Similarly to the case of services, agents interact in order to achieve complex goals. Due to their autonomy and pro-activeness, however, they can engage in different interaction modalities, ranging from cooperation and collaboration to negotiation and competition. Furthermore, in many application domains two important assumptions are made [221]. First, agents are heterogeneous, for example because they are realized by different vendors or because they also interact with services, software applications and human users. Second, they can dynamically take part to and leave the interaction. These two additional features characterize the so-called open MASs [20]. Constraining the agents behavior so as to define the acceptable, compliant interactions while guaranteeing at the same time flexibility, is in this situation even more important than in the case of SOC. Here, the concept of choreography is referred to as interaction protocol . Since open MASs consider agents as black boxes, focusing only on their external behavior, i.e., on the observable events generated in response of their actions and interactions, they can be considered as a particular kind of EBS. In particular, agents communicate via message exchange, and therefore it is not surprising that open MASs and Service-Oriented systems share many similarities [134, 23]; Table 2.1 briefly summarizes some of their correspondences8. 8
In SOC, the term behavioral interface refers to the external, observable behavior of a service; it is therefore an abstract version of the internal orchestration, focusing on the messages exchanged by the service and omitting the internal activities, data manipulation and choices.
2.4 Multi-Agent Systems
35
Table 2.1. Correspondences between Multi-Agent and Service-Oriented Systems
interacting entities communication local view of interaction global view of interaction
MAS
SOC
agents
services
message
message
agent external policy
behavioral interface
interaction protocol
choreography
Example 2.4.1 (Multi-Agent English Auction). An e-commerce english auction involves a set of software agents, one auctioneer and several bidders. Each bidder agent is owned by a human user, and is initially instructed by its owner concerning her desired items and the maximum amount of money that can be spent. Bidders can freely enter and leave the auction, and autonomously decide whether to place an offer or not, taking into account the preferences initially set by their owner. The auctioneer is instead in charge of collecting the offers and determining the final winner at the auction’s final time. In this open context, the agents behavior cannot be controlled, and therefore a global interaction protocol is needed to check whether offers are correctly placed by the bidder agents, and whether the final winner is correctly selected by the auctioneer. The protocol relies upon the possible messages that can be exchanged among the agents (such as “place offer”), and cannot make any assumption about the internals of participants. The problem of modeling interaction protocols in open MASs is two-faced: on the one hand, there is the need of a formal semantics for messages and protocols, in order to describe them in an unambiguous way and enable the investigation of their formal properties, on the other hand it is necessary to constrain the agents behavior in a flexible manner, to the aim of preserving their autonomy and heterogeneity. Again, the proposals advanced in the literature can be grouped into two complementary modeling styles: procedural and closed approaches vs declarative and open ones. In particular, approaches like AUML [33] aim at exactly specifying the allowed sequences of messages that can be exchanged by the interacting agents, limiting the autonomy of agents and sacrificing flexibility for the sake of control and compliance. Conversely, social approaches [56, 221, 82, 8] consider MASs as truly open societies, and interaction protocols as a form of declarative knowledge used to represent conventions and rules of engagement which characterize the agents community as a whole. Such conventions and rules do not prescribe a specific pre-defined way of executing interaction protocols: “the agents can act as they please provided they obey the restrictions of the societies they belong to and the protocols they follow” [221].
36
2 Declarative Open Interaction Models
The SCIFF framework [8], which will be extensively exploited in this book, is a notable example of social approach for modeling, formalizing and verifying the interaction dimension in open MASs.
2.5 Clinical Guidelines The Clinical Guideline (CG) setting constitutes a representative example of application domains in which a synergy and complementation between procedural, closed approaches and declarative, open ones is not only desirable, but necessary. As defined by the USA Institute of Medicine [102]: CGs are systematically developed statements to assist practitioner and patient decisions about appropriate health care for specific clinical circumstances. They enforce evidence-based medicine, collect consensus-derived recommendations, and can be used to promote high-quality treatments, diagnosis and cost optimization, as well as to evaluate the quality and organization of the health service over a territory. One of the main goals of CGs is to put evidence into practice. However, there is a gap between the prescriptions of a guideline and their actual application on a patient. Indeed, evidence is essentially a form of statistical knowledge, capturing the generalities of classes of similar patients, instead of facing with the peculiarities of each specific patient. Furthermore, it is unreasonable to assume that an expert committee will precisely characterize each possible execution of the CG under study on all possible patients in any possible clinical circumstance. Therefore, a number of implicit conditions, such as ideality of context and patients, are usually assumed when building a CG. Ideality of context means that the health-care structure executing the guideline will be able to provide all the necessary resources, and is needed because CGs are developed at an abstract level and for a general audience, without focusing on a concrete execution setting. Ideality of patients assumes that the CG will be applied on patients experiencing only the targeted disease, without taking into account the possible interplay with other CGs. It is needed because the variety of patients is potentially infinite. To effectively apply a given CG on a specific patient, healthcare professionals implicitly employ their Basic Medical Knowledge (BMK) in order to adapt the generic prescription to her particular situation [47]. The BMK is for example employed by a physician when an alternative medicine must be found because the patient is allergic to the one mentioned in the guideline specification, or when a critical situation, treating the life of the patient, suddenly arises. As we will see in the next Section, the proper combination of these two kinds of knowledge is a challenging task, which however we deem as necessary towards the realization of software systems able to truly support the sanitary staff during the specification and application of CGs.
2.5 Clinical Guidelines
37
Fig. 2.11. Fragment of a chronic cough treatment guideline modeled in GLARE (from [48])
2.5.1 Basic Medical Knowledge and Clinical Guidelines In the last decade, many different research projects have been carried out to create domain-independent computer-assisted languages and tools for managing, acquiring, representing and executing CGs [109, 189, 229, 48]. All the proposed languages rely on the same “sequence flows&gateways” abstractions employed in the BPM field (see Section 2.2.1). They explicitly capture the flows of administrative, clinical and therapeutic actions that must be executed for each patient, in accordance with the prescriptions contained in the CG’s description document. For example, Fig. 2.11 depicts a fragment of a CG specified using the Glare language [232]. As far as now, all these proposals presume that the modeled CG must be strictly followed, making the assumption that the involved actions are interpreted as “must do” actions, and that all the possible treatments are explicitly foreseen in the model. However, when the BMK comes into play, these two assumptions are relaxed by the healthcare professionals: the actions recommended by the CG could be prohibited by the BMK, or conversely the CG could enforce some actions event if they are discouraged by the BMK. Table 2.2 summarizes some real examples in which the complex interplay between the CG and the BMK gives raise to different hybrid situations, showing that the CG cannot be always interpreted as a strict, normative procedure.
38
2 Declarative Open Interaction Models
Table 2.2. Examples of clinical behaviors determined by the interplay between the prescriptions of a Clinical Guideline and the Basic Medical Knowledge (from [47]) Basic Medical Knowledge
CG+BMK
a. Patients suffering from bacterial pneumonia must be treated with penicillin or macrolid.
Do not administer drugs to which a patient is allergic.
Admister macrolid to a patient with bacterial pneumonia if she is allergic to penicillin.
b. Patients with posthemorragic shock require blood transfusion.
Do not apply therapies that are not accepted by patients.
If the patient refuses blood transfusion, in case of posthemorragic shock treat her with plasma expander.
c. In patients affected by unstable angina, coronary angiography is mandatory.
A patient affected by advanced predialytic renal failure should not be subject to coronary angioraphy, because the contrast media may cause a further deterioration of the renal functions.
Clinical Guideline
Plasma expander is a valid alternative to blood transfusion, provided that . . . (omitted)
Even in case of a predialytic renal failure, perform coronary angiography if the patient is affected by unstable angina.
In particular, the examples points out three different integration modalities between the two kinds of knowledge: (Table 2.2) a. The CG supports the possibility of choosing among two different treatments, and the BMK acts as a business rule which helps in determining which route must (not) be taken when certain circumstances hold. (Table 2.2) b. The BMK emends the CG, suggesting a suitable way for (temporarily) substituting the guideline when its prescriptions are not applicable. (Table 2.2) c. The CG defeats the BMK, imposing the prompt execution of an action even if, according to the BMK, it could be dangerous for the patient.
2.5.2 Semi-Openness of Clinical Guidelines We have seen that CGs are developed by hypothesizing their application on “ideal” patients, while the BMK is used by healthcare professionals to bridge the gap between ideal and actual cases. Unfortunately, the contemporary guideline management systems only focus on the first kind of knowledge, and completely omit the second. The result is that they are very useful for the
2.6 Lesson Learnt: Compliance vs. Flexibility
39
parts of the CGs dealing with strict procedures and protocols, such as administrative or laboratory procedures, while they lack in supporting healthcare professionals for all the phases in which their expertise and knowledge is effectively employed to drive the execution. However, as clearly attested by the examples shown in Table 2.2, the integration between these two kinds of knowledge is extremely difficult. From a foundational point of view, such difficulty can be ascribed to the complementarity of their nature: while CGs are procedural and closed, the BMK is declarative and open. In particular, the BMK is declarative because it does not aim at defining rigid procedures that must be followed by health-care professionals, but is rather focused on capturing their best practices and expertise, as well as (part of) the underlying common medical knowledge they rely upon. The BMK is open because it restricts the behavior of the involved parties by means of positive and negative constraints, and because it is essentially a form of incomplete knowledge: it is unreasonable to assume that the whole knowledge of health-care professionals can be completely captured, and consequently it must not preclude unforeseen actions and decisions. The integration between a CG and the BMK gives therefore raise to a hybrid semi-open knowledge, where the guideline must partially support the execution of unpredicted activities, as well as the deviation from its prescriptions, while the BMK must acknowledge the possibility of being defeated, and honor the motto: “domain experts always get the last word”. A deep understanding concerning the nature of this hybrid knowledge, and how its building components actually interact, is still far to be reached. Anyway, a first necessary step towards such an understanding is to find suitable specification languages and effective technologies for capturing the BMK, a topic which has been rarely studied so far. We hope that this book could actively contribute to the investigation of such a first step.
2.6 Lesson Learnt: Compliance vs. Flexibility Business process specifications, service choreographies, multi-agent interaction protocols and clinical guidelines can be all considered as interaction models, differing for what concerns the nature of participants and the relevant events occurring during the executions of the system (see Table 2.3). By abstracting away from the specific features of each discussed domain, we can identify two complementary aspects which need to be suitably captured and balanced by a modeling framework [116, 191]: Compliance (also called support ) aims at restricting the behavior of interacting entities so as to guarantee that all the targeted business constraints are met. Flexibility aims at leaving the behavior of interacting entities as unconstrained as possible, allowing them to take strategic decisions and evaluate the best ways for interacting with each other.
40
2 Declarative Open Interaction Models
Table 2.3. Examples of interaction models interacting entities
events
interaction model
Employees, stakeholders, Starting and completion of Business Process customers, devices, . . . business activities Services
Exchanged messages
Service Choreography
Agents, other interacting Exchanged messages, ac- (open) Multi-Agent Sysentities tions on the environment tem Healthcare professionals, Starting/completion of ad- Clinical Guideline + Basic patients, admin. staff, . . . min. and clinical actions Medical Knowledge
Universe of traces
Supported traces
Fig. 2.12. Compliance (red dashed arrows) and flexibility (green solid arrows) as contrasting forces in the space of execution traces
If we refer these two complementary concepts to the space of the possible execution traces which can be generated by the interacting entities, we will perceive them as two contrasting forces. On the one hand, compliance tends to restrict the number of allowed traces, forbidding all the (mis)behaviors that would lead to violate one of the imposed business constraint. On the other hand, flexibility tends to widen the number of allowed traces, trying to include many different possibilities among which participants can choose. As we have seen, finding the right balance between such contrasting forces is of key importance, and the right balance, in turn, depends on the ability of the modeler but also rely on the chosen interaction modeling language. In this respect, procedural and closed approaches provide good support for ensuring that compliance is guaranteed9, but they sacrifice flexibility, being prone to over-constraining and over-specification issues. Declarative and open approaches, instead, focus on the elicitation of the business constraints imposed by the domain under study, and avoid the insertion of further unnecessary constraints, preserving both compliance and flexibility. Fig. 2.13 gives an intuitive idea of this difference in the space of execution traces. Focusing on traces, the effect of the problem’s business constraints is to identify 9
Even though the management of negative constraints is difficult, as pointed out in Sect. 2.3.3.
2.7 Desiderata for a Supporting Framework
41
Universe of traces
Universe of traces
Universe of traces
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ______________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX __________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _ _SSSS ____________ _XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _ _ _ SSSSSSS _______________ _XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _ _ _SSSSSSSSS _______________ _XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _ SSSSSSSSSSSSS _________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _ SSSSSSSSSSSSSS _________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _SSSSSSSSSSSSSS _________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ SSSSSSSSSSSS ________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _SSSSSS ______________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ___________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _________________ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX _ _ _ _ _ _ _ _ _ _ _ _ _ _ __
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSSSSS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SSSSSSSSSSSSSSSSSSS
Problem's constraints
Procedural closed approach
Declarative open approach
Fig. 2.13. Business constraints as forbidden (red area - ‘X’ ) and mandatory (dark green - no symbol ) behaviors in the space of execution traces, and comparison of closed procedural approaches vs open declarative ones, showing the allowed supported traces (light green - ‘S’ ) and the allowed but unsupported ones (white - ‘–’ )
forbidden and mandatory behaviors, i.e., the sets of event occurrences that must be respectively avoided or generated. Procedural and closed models provide support for covering the mandatory behaviors and avoiding the forbidden ones, but drop out many courses of interaction which are not forbidden nor mandatory, and are therefore allowed. Declarative and open approaches are instead able of supporting also these cases, for the sake of flexibility.
2.7 Desiderata for a Supporting Framework We have pointed out the need of complementing closed procedural interaction models with open declarative ones. The adoption of declarative open interaction models call for suitable frameworks, able to provide support for their entire life cycle. Such frameworks must be able to formally verify the developed models and their executions, to ensure their trustworthiness and reliability. Thanks to formal verification, it is possible to guarantee the correctness and consistency of the designed models, as well as effectively establishing whether the actual behavior of interacting entities actually complies with their constraints. Fig. 2.14 (top) shows the types of verification and support needed along the phases of the life cycle. The life cycle is inspired from the BPM one (see p. 21), and is composed by the three main stages of design, execution and diagnosis. As pointed out in Fig. 2.14 (bottom), an open declarative interaction model could also take part to a third party life cycle, giving rise to another series of verification tasks. For example, the internal life cycle could be focused on the development of a choreography model, which is then not enacted, but it is rather used to verify if a set of local models of services, developed by thirdparty organizations, could be successfully employed to concretely realize the choreography. Let us briefly review these verification capabilities in the two settings.
42
2 Declarative Open Interaction Models
a-posteriori verification
properties verification
de sig n
internal life cycle
de sig n
third party life cycle
is os gn dia
a-priori compliance verification
interaction model
on-the-fly compliance verification
trace analysis a-posteriori compliance verification
a-posteriori verification
model discovery
composition
static verification
a-priori compliance verification
open declarative interaction model
static verification
enactment
trace analysis
diagnosis
on uti ec ex
runtime verification
model discovery
execution monitoring
runtime verification
Fig. 2.14. Life cycle of a declarative open interaction model, and its usage inside a third-party life cycle
2.7.1 Internal Life Cycle During the design phase, the framework must provide suitable novel specification languages, to the aim of modeling the Event-Based System (EBS) under study with a declarative and open flavor. Static verification comes here into play to guarantee that the designed model meets certain desired properties, and complies by construction with external regulations and internal policies. These two tasks are called properties verification and a-priori compliance verification. When the design of the interaction model is completed, and all the static verification tasks have been successfully passed, the model can be used to provide execution support. More specifically, the interaction model is enacted , guiding the interacting entities towards the correct execution of the model.
2.7 Desiderata for a Supporting Framework
43
While the enactment of closed procedural interaction models can take advantage from their flow-oriented structure, showing at each moment what are the next steps to be done (the so-called worklist), declarative open ones are enacted by presenting, instant by instant, what are the expected and forbidden behaviors. In the last diagnosis phase, relevant informations are extracted from the event log containing the traces associated to the already completed system’s instances, in order to understand the real behavior exhibited by the actual interacting entities (a-posteriori verification). In particular, traces are analyzed to study whether the business goals have been effectively achieved and to assess the real trends of the system with respect to the desired ones, or used to discover a new model, able to precisely describe reality. In the BPM community, the extraction of new informations from event logs is referred to as process mining [244]. 2.7.2 Participation to an External Life Cycle An open declarative interaction model (I) can be also exploited to assist the development of an external, third-party interaction model (E). In particular, during the design of E, E could be statically verified to check whether it complies with I, which plays the role of a choreography or a regulatory/prescriptive model. A different case is the one in which I and E represent local interaction models, which must be suitably combined in order to realize a more complex, joint model; model composition, as well as the properties verification of the composed model, must be suitably tackled by our supporting framework. Let us now suppose that E is unknown, unaccessible, or untrusted. This is for example the case of service interaction, where each local service may expose a behavioral interface which describes its external behavior, hiding at the same time its complete internal implementation. Since there is no guarantee that the exposed behavioral interface effectively matches with the internal implementation, the service may produce undesired courses of interaction, and must be therefore verified during the execution. In this situation, verification can be accomplished by looking at the actual, ongoing execution of the external system, checking if the involved interacting entities are behaving as prescribed by I and reporting possible violations as soon as possible. In other words, monitoring and run-time verification facilities must be provided by our framework. Finally, the same tasks carried out during the diagnosis phase of an open interaction model can be seamlessly applied to the diagnosis of an external, unknown systems, provided that the event log resulting from its different executions is collected and made available. In particular, I could be used to analyze and classify third-party execution traces, addressing conformance checking issues. Model discovery, instead, could be applied to extract an open declarative interaction model from the real behavior of an external system.
44
2 Declarative Open Interaction Models
system
GRAPHICAL MODELING
a
b
(extended) ConDec
c
Translation
formal specification
REASONING CAPABILITIES
CLIMB
1
event log
SCIFF Framework
STATIC reasoning capabilities 2
RUN-TIME and A-POSTERIORI reasoning capabilities 3
Fig. 2.15. The CLIMB framework (numbers identify the parts of the book covering the corresponding portion of the schema)
This latter task is especially interesting when the traces of such an external system are produced by following a procedural, closed model: the declarativeness and openness of the discovered model could be exploited to explain the behavior exhibited by system in a more concise and readable way.
2.8 The CLIMB Framework In this book, the general framework described in Sect. 8.1 will be concretely addressed by integrating languages and technologies coming from two research areas, namely Business Process Management and Multi-Agent Systems. In particular, the management of open declarative interaction models will be faced by combining the constraint -based ConDec language [192, 191] with the Computational Logic-based SCIFF formal framework [8]. The resulting framework is therefore called CLIMB (Computational Logic for the verIfication and Modeling of Business constraints). ConDec is a graphical, constraint-based language which has been proposed by Pesic and van der Aalst for modeling Business Processes (BPs) in a declarative and open way, addressing flexibility issues. SCIFF is a framework based on Computational Logic, and in particular on Abuctive Logic Programming (ALP), originally thought for the specification and verification
2.8 The CLIMB Framework
45
of open Multi-Agent Systems. It features a rule-based language, with a clear underlying declarative semantics, for specifying interaction models; its operational counterpart, constituted by two proof procedures, supports static as well as dynamic reasoning capabilities. The logical architecture of the CLIMB framework is depicted in Fig. 2.15. The numbers show the correspondences between the portions of the schema and the parts of the book. In particular, in the remainder of Part 1 we will describe the ConDec notation and introduce the CLIMB language, a sub-set of the SCIFF one; then, we will show how all the ConDec constructs can be formalized by means of CLIMB rules, and discuss how the expressiveness of CLIMB can be exploited to extend ConDec with new interesting features, such as quantitative temporal constraints and data-aware conditions. Part 2 and Part 3 will instead focus on the different static and run-time/a-posteriori verification tasks, showing how the SCIFF proof procedures can be jointly adopted to accomplish all the desiderata introduced in Sect. 8.1.
3 The ConDec Language
ConDec is a graphical language proposed by Pesic and van der Aalst for the declarative and open modeling of Business Processes (BPs)[192, 191]. It fits with complex, unpredictable processes, where a good balance between support and flexibility must be found. Two variants of ConDec have been proposed for specifying service flows [242], as well as for dealing with Clinical Guidelines (CGs) [181]. In this Chapter, we present a critical overview of the language and recall its constructs. We show its application on a representative case study, and discuss its style of modeling in the light of the cognitive dimensions framework [122]. We then introduce the framework of propositional Linear Temporal Logic (LTL) [99], summarizing how it has been exploited in [192, 191, 173] to provide the first formalization of the ConDec constructs.
3.1 ConDec in a Nutshell The term “ConDec” stands at the intersection of the words constraint and declarative. ConDec is a constraint-based and declarative language because, instead of rigidly defining the flow of interaction, it directly focuses on the (minimal) set of rules which must be satisfied in order to correctly carry out the collaboration. Since rules constrain the way activities can be executed, they are referred to as (business) constraints. Business constraints reflect different kind of business knowledge: external regulations and norms, business objectives, internal policies and best practices, to cite some (see Sect. 2.1.3). Differently from procedural specifications, in which activities can be interconnected only by means of sequence patterns, mixed with constructs supporting the splitting and merging of control flows, the ConDec language provides a number of control-independent abstractions to constrain activities, alongside the more traditional ones. It is possible to insert past-oriented constraints, as well as constraints that do not impose any ordering among activities.
M. Montali: Declarative Open Interaction Models, LNBIP 56, pp. 47–75, 2010. c Springer-Verlag Berlin Heidelberg 2010
48
3 The ConDec Language
Furthermore, ConDec models are open: activities can be freely executed, unless they are subject to constraints. This choice has a twofold impact. First, a ConDec model typically accommodates many possible executions, improving flexibility. Second, the language provides abstractions to explicitly capture not only what is indispensable, but also what is forbidden, i.e., negative business constraints. In this way, the set of possible executions does not need to be expressed extensionally and models remain compact: models specify the desired and undesired events, leaving unconstrained all the courses of interaction that are neither desired nor undesired.
3.2 ConDec Models A ConDec model is composed by a set of activities, interconnected by means of business constraints. Activities represent atomic units of work (i.e., units of work associated to single time points1 ), and are therefore traced by means of single events occurring during the execution of a system’s instance. Business constraints restricts the possible ways of executing activities. Optional constraints are also supported, to express preferable courses of interaction, but allowing the possibility to deviate from them. Definition 3.2.1 (ConDec model). A ConDec model is a triple A, Cm , Co , where: • A is a set of activities; • Cm is a set of mandatory constraints; • Co is a set of optional constraints. Given a ConDec model CM, notations A(CM), Cm (CM) and Co (CM) respectively denote the set of activities, mandatory and optional constraints of CM. Activities are graphically represented as boxes containing their name. E.g., the activity commit order is represented as commit order A ConDec model is mainly designed in two steps: 1. The relevant activities of the system are identified and placed in the model. At this stage, the model is completely unconstrained, and therefore the activities can be performed an arbitrary number of times, in whatever order. 1
In [191], a non atomic model of activities is presented. However, it cannot be fully formalized by means of LTL [191]. We therefore make the assumption that the basic version of the language deals only with atomic activities, delegating the discussion about non atomic ones in Sects. 6.3.1 and 6.4.3.
3.3 Constraints
49
2. ConDec constraints are added to reflect the business constraints of the system, restricting the set of supported execution traces. The scope of constraints is thus delimited to each instance of the system, i.e., constraints do not span across multiple executions. Constraints must be effectively enforced by the event occurrences contained in the traces, where each event occurrence represents the execution of an activity. A trace is supported by an entire ConDec model if and only if each mandatory constraint of the model is respected. Definition 3.2.2 (Supported execution trace). Given an execution trace T and a ConDec model CM, T is supported by CM iff T complies with each constraint belonging to Cm (CM).
3.3 Constraints ConDec constraints are grouped into four families: Existence constraints are unary cardinality constraints expressing how many times an activity can or must be executed; Choice constraints are n-ary constraints expressing the need of executing some activities belonging to a set of possible choices, independently of the other constraints; Relation constraints are binary constraints which impose the presence of a certain activity when some other activity is performed, possibly imposing also qualitative temporal constraints between them; Negation constraints are the negative version of relation constraints, and are employed to explicitly forbid the execution of a certain activity when some other activity is performed. Note that ConDec relies on a qualitative notion of time (see Sect. 2.1.2): temporal constraints could express the required relative positions among two event occurrences, but they are not equipped with metric distances. 3.3.1 Existence Constraints Existence constraints are unary cardinality constraints predicating on the number of possible executions of an activity. They graphically resemble the well known multiplicity constraints of the Unified Modeling Language (UML) [185], and represent either the minimal, the exact or the maximum required executions of activities. The init constraint has a slightly different meaning: it is used to identify the first, starting activity of the model. Table 3.1 summarizes the types of existence constraints, showing their graphical representation and informal meaning. An existenceN constraint could be employed to state that at least one item must be ordered by the customer during the interaction:
50
3 The ConDec Language
Table 3.1. ConDec existence constraints name
graphical
meaning
0
absence(a)
a 0..n
absence(n+1,a)
a
Activity a cannot be executed Activity a can be executed at most n times, i.e., the execution trace cannot contain n + 1 occurrences of a
n..∗
existence(n,a)
a
Activity a must be executed at least n times
n
exactly(n,a)
a
Activity a must be executed exactly n times
init
init(a)
a
Activity a must be the first executed activity
1..∗
order item On the contrary, an absenceN constraint could be used to state that at most three payment attempts can be made by the customer: 0..3
pay 3.3.2 Choice Constraints Choice constraints are shown in Table 3.2. They are n-ary constraints asserting that the interacting entities must necessarily perform some activities, selecting them inside a set of possible choices. They can be therefore seen as an extension of the existence n and exactly n constraints, replacing a single activity with a set of activities. Choice constraints are especially useful when the model contains several activities having the same effect or accomplishing the same business goal, because they leave interacting entities free to choose the most suitable on their own. Indeed, a ConDec choice corresponds to a deferred choice [239]: the decision is not driven by an explicit choice, but is instead delegated to the interacting entities, which take it by executing one of the interconnected tasks. A 1 of 2 -choice could be used to state that a contributing author must submit her paper either by uploading it through the web site of the conference or by sending it via e-mail2 : ♦
upload paper − − − − e-mail paper 2
We suppose that the “n of m” notation is optional when n = 1.
3.3 Constraints
51
Table 3.2. ConDec choice constraints name
graphical
choice(n of m,[a1 ,...,am ])
a1 am
ex choice(n of m,[a1 ,...,am ])
a1 am
n of m
a2
At least n distinct activities among a1 ,. . . ,am must be executed
a2
Exactly n distinct activities among a1 ,. . . ,am must be executed
... n of m
...
meaning
Note that the constraint supports an execution trace containing three submissions of the paper (via e-mail and/or by using the web site), while it evaluates a trace without submissions as noncompliant. A 1 of 2 -exclusive choice can be instead adopted to model the existence between two alternatives that exclude each other. For example, it could be used to state that, within an instance of the system, the customer commits herself to cancel or successfully close the order, but not both:
cancel order − − − − close order It is worth noting that choice constraints, together with the existenceN and exactlyN ones, constitute a family of goal-oriented constructs. Indeed, they impose the mandatory presence of (some of) the involved activities in any possible execution trace supported by the model, independently of the other constraints and of the specific courses of interaction. 3.3.3 Relation Constraints Differently from goal-oriented constraints, relation constraints express positive dependencies among activities; in their simplest form, they interconnect two activities (the generalized case will be discussed in Sect. 3.3.5). As shown in Table 3.3, the graphical representation of each relationship coherently communicates the meaning of the relationship: • the number of lines used to interconnect the two activities indicates how much tight is the dependency; • the position of the “•” element determines which activity has the ability of triggering the dependency; • the presence of an arrow and its relative position with respect to the “•” element denote the qualitative temporal constraint associated to the relation. In particular, when a relation constraint is connected to an activity through a “•” element, such an activity is called source of the constraint, and has
52
3 The ConDec Language
Table 3.3. ConDec relation constraints name
graphical
meaning
resp existence([a], [b])
a •−−−− b
If a is executed, then b must be executed before or after a
coexistence([a],[b])
a •−−−• b
Neither a nor b is executed, or they are both executed
response([a],[b])
a •−−− b
If a is executed, then b must be executed thereafter
precedence([a],[b])
a −−−• b
b can be executed only if a has been previously executed
succession([a],[b])
a •−−• b
a and b must be executed in succession, i.e. b must follow a and a must precede b
alt response([a],[b])
a •=== b
b is response of a and between every two executions of a, b must be executed at least once
alt precedence([a],[b])
a ===• b
a is precedence of b and between every two executions of b, a must be executed at least once
alt succession([a],[b])
a •==• b
b is alternate response of a, and a is alternate precedence of b
chain response([a],[b])
a •= −= −= − b
If a is executed, then b must be executed next (immediately after a)
chain precedence([a],[b])
a = −= −= −• b
If b is executed, then a must have been executed immediately before b
chain succession([a],[b])
a •= −= −• b
a and b must be executed in sequence (next to each other)
the ability to trigger it. When the constraint triggers, then also the target activity, connected to the other side of the relation, must be executed. Relation constraints are therefore reactive. Starting from this basic schema, each relation constraint differs from the others for what concerns when the occurrence of the target is expected to happen as the constraint triggers. The responded existence and coexistence relation constraints do not impose any temporal ordering, but rather leave the interacting entities completely free to decide when the execution of the target is placed. Example 3.3.1 (Unordered business constraint). Let us consider an interaction model regulating the messages exchange between a seller and a warehouse, which stores the goods of the seller. When the warehouse ships a good, then
3.3 Constraints
53
it must also notify the seller that the amount of stored goods has changed; the notification could be sent either before or after the shipment. In ConDec, such a flexible business constraint can be directly modeled by means of a responded existence relation, interconnecting the shipment and the notification activities: ship good •−−−− notify seller When the good is shipped, if the seller has been already notified, then the constraint is automatically fulfilled, otherwise it “waits” for the notification. Thus, the empty execution trace, as well as an execution trace containing three notifications, are both supported by the constraint, because they do not make it trigger. An execution trace in which two shipments are delivered, and a unique notification is sent to the seller, is seamlessly supported as well: both shipments need a notification, which eventually arrives. Conversely, all the execution traces which contain at least one shipment, but no notification, are all considered as noncompliant. The response and precedence constraint types extend the responded existence one by introducing the the two fundamental qualitative temporal orderings of after and before. To determine the effective time window inside which the target activity is expected to occur when the source happens, such temporal orderings combine themselves with the constraint’s tightness. For example, the basic response connects the two involved activities in a weak, loosely coupled way: when the source occurs, then the target must occur in the future, but other activities can be seamlessly executed in between. The alternate response places a further constraint, namely that when the source is executed, it cannot be executed again unless the target activity is executed. The chain response is even more tight, and states that the target must be the first activity that is executed after the source, resembling the sequence connection of classical procedural languages. This plethora of relation constraints can be then used to model different positive relationships between activities, ranging from a completely open to a completely closed perspective. Example 3.3.2 (Compliance with relation constraints). Let us separately consider the following ConDec constraints: C1 = a •−−− b C2 = a •=== b C3 = a •= −= −= − b and the following execution traces
54
3 The ConDec Language
T1 = a → b → a → c T2 = a → c → a → b T3 = a → c → b → a → b T4 = a → b → c → a → b T1 is not compliant with C1 , and therefore, nor with C2 and C3 , because the second execution of activity a is not followed by an execution of b. Note that a •−−−− b . T2 is supported by C1 , it would instead be compliant with because the two executions of a are eventually followed by b, but it is not compliant with C2 , because the alternation a–b–a is not respected (only c is executed in between); all the more so, it is neither compliant with C3 . T3 is compliant with C2 (and therefore also with C1 ), because each a is followed by a b, and that b always occur before a further execution of a. It is however not compliant with C3 , because the first a has c as immediate successor, instead of b. Finally, T4 is an example of execution trace supported byC3 , and hence supported also by the other two constraints. Let us finally briefly focus on the succession constraints. Each succession constraint is a shortcut in place of the combination between the corresponding response and precedence relations, as clearly shown by the graphical notation. Both the interconnected activities have the power of triggering the constraint, i.e., acting as source or target depending on the circumstance. For example, a basic succession constraint could be employed to state that when the customer pays for a good, then the warehouse must eventually deliver that good and, conversely, the warehouse will ship the good only if a payment has been previously carried out: receive payment •−−• ship good Since the succession constraint imposes a loosely coupled temporal relation between the payment and the shipment, other intermediate activities can be performed by the warehouse and the customer. 3.3.4 Negation Constraints As shown in Table 3.4, negation constraints are specular to relation constraints: when a negation constraint is triggered by its source activity, then it forbids the execution of the target activity inside certain time bounds, determined by the the specific constraint. Therefore, also the “degree of openness” characterizing each relation constraint is mirrored: while responded existence and chain succession constraints are respectively the most open and closed relation constraints, responded absence and negation chain succession are the most closed and open negation ones.
3.3 Constraints
55
Table 3.4. ConDec negation constraints name
graphical
meaning
resp absence([a],[b])
a •−− −− b
If a is executed, then b can never be executed
not coexistence([a],[b])
a •−− −• b
a and b exclude each other
neg response([a],[b])
a •−− − b
b cannot be executed after a
neg precedence([a],[b])
a −−− • b
a cannot be executed before b
neg succession([a],[b])
a •−− • b
a and b cannot be executed in succession
neg alt response([a],[b])
a •== = b
b cannot be executed between any two occurrences of a
neg alt precedence([a],[b])
a === • b
a cannot be executed between any two bs
neg alt succession([a],[b])
a •== • b
b cannot be executed between any two as and viceversa
neg chain response([a],[b])
a •= −= −= − b
b cannot be executed next to a
neg chain precedence([a],[b])
a = −= −= − • b
a cannot be executed immediately before b
neg chain succession([a],[b])
a •= −= − • b
a and b cannot be executed in sequence
Indeed, a •= −= −= − b states that when activity a is executed, b can be executed if at least one intermediate occurrence of another activity exists; on the contrary, a •−− −− b forbids the presence of b along the whole instance, if a is performed inside that instance. Negation constraints are peculiar of open approaches, where by default all activities can be executed in any order. In this respect, it would be unfeasible to assume that “positive” constraints are sufficient for expressing significant interaction models. Furthermore it is sometime much more effective and compact to model the undesired behaviors rather than the allowed ones. For example, the not coexistence constraint could be directly employed in a ConDec model to express that two activities are incompatible, e.g., that the seller cannot accept and reject an incoming order when interacting with a customer: accept order •−− −• reject order
56
3 The ConDec Language
Example 3.3.3 (Compliance with negation constraints). Let us separately consider the following ConDec constraints: C1 = a •−− − b C2 = a •== = b C3 = a •= −= −= − b and the following execution traces T1 = c → b → a T2 = a → c → a → b T3 = a → c → b → a T4 = a → b → c T1 is supported by all the three constraints, being a followed by no occurrence of b. Due to the presence of a previous b, it would instead violate a •−− −− b . T2 violates C1 , because there exists a b executed after (two occurrences of) a. It also violates C3 , because the second occurrence of a has b as immediate successor. T2 instead complies with C2 , thanks to the absence of b between the two occurrences of a. T3 is not compliant with C2 , because between the two executions of a there is one b; all the more so, it violates also C1 , due to the presence of b after the first execution of a. It is instead supported by C3 , because a is never immediately followed by b (the first execution is followed by c, while the second has no successor). Finally, T4 is only supported by C2 , because it only contains one occurrence of a. It instead violates C3 (and consequently C1 ), being such an occurrence immediately followed by b. 3.3.5 Branching Constraints As far as now, we have considered only relation and negation constraints involving two activities. However, in the general case they can branch, involving a multiplicity of activities. When a constraint branches on multiple activities, the intended interpretation is disjunctive: • In case of multiple sources, the constraint is triggered by each occurrence of one of the source activities; it therefore represents a shortcut for applying the same constraint on each source activity. • In case of multiple targets, when the relation (negation) constraint is triggered, it becomes satisfied by executing (by avoiding the execution of) one of the target activities.
3.4 ConDec at Work
57
Succession constraints maintain their decomposition into a response and precedence part; for example, in the following branching succession constraint a
c d
b
e
a plays the role of a disjunctive source regarding the response part of the succession, and it plays the role of a disjunctive target concerning its precedence part. The only exception is constituted by the coexistence constraint, because sources and targets cannot be distinguished by looking at its graphical representation: a1 a2
an
...
The interpretation of this constraint in the branching case is then: whenever one among the n interconnected activities occur, then at least one of the other n − 1 interconnected activities must be executed as well. In conclusion, branching constraints combine the reactive nature of relation and negation constraints with the flexibility of choice constraints.
3.4 ConDec at Work We illustrate the potentialities of ConDec by considering a simple yet significant case study: a three-party service choreography. The choreography deals with the creation, confirmation and payment of an order, composed by a set of items. The choreography includes three different roles: • a customer, interested in purchasing items; • a seller, which offers a list of items and takes care of maintaining the order’s status, as well as of delivering a final receipt when the customer pays; • a warehouse, which physically stores the items and therefore knows their availability. An instance of the choreography centers around a single order. Since the seller and the warehouse could be involved at the same time in several instances of the choreographies, interacting with different customers for selling different orders, we make the assumption that each order is associated to a unique identifier, which can be also used as an instance identifier. Such an instance identifier is attached to each exchanged message, and can therefore be exploited to correlate all the event occurrences related to the same order, separating them from the other execution traces.
58
3 The ConDec Language
3.4.1 The Order Management Choreography in Natural Language Let us now informally describe the choreography constraints, using natural language statements, as they would be collected after a series of meetings with the domain experts. An instance of the choreography centers around a single order. Each order is implicitly created as soon as an instance of the choreography begins. The order must be eventually managed by the customer, either by closing or canceling it (but not both). Before taking this decision, the customer is in charge of filling the order, by choosing a series of items from the seller’s list. If the order is closed or canceled the order, no further items can be added to the order. After having closed the order, the customer expects a positive or negative answer from the seller, which decides whether to confirm or refuse it. The seller can send an answer to the customer only if the order has already been closed. The decision of the seller is sometime influenced by the warehouse, which knows if the order can be concretely delivered. In particular, the seller is bound to refuse the order if the seller communicates the impossibility of shipping it, and can send a positive response to the customer only if the warehouse has previously given its acknowledgment. The warehouse must behave in a consistent way, i.e., it cannot emit both an acceptance and a refusal concerning the shipment of an order. The seller has instead the possibility of refusing an already accepted order, but not the other way around. If the seller sends a confirmation, the customer gets the last word: it can simply give up, or finalize the order by paying it. The payment can be done only if the seller has previously sent the confirmation message, and it is incompatible with the seller’s refusal. When the payment is carried out, the seller is in charge of delivering a single final receipt. The seller will emit a receipt only after the payment has taken place.
3.4.2 The Order Management Choreography as a Contract The first step in modeling the choreography with ConDec consists in the separation of the natural language sentences, towards the identification of all the explicit and implicit business constraints. We therefore restructure the description made in Sect. 3.4.1, obtaining a “contractual” version of the choreography. 1. Order creation phase a) The order is implicitly created as soon as an instance of the choreography begins. b) The customer must either close or cancel the order (but not both). c) Before closing or canceling the order, the customer must choose a series of items from the seller’s list. d) If the order is closed or canceled, then no further items can be added to the order. e) After having closed the order, the customer expects a positive or negative answer from the seller. f) The seller can send an answer to the customer only if the order has already been closed.
3.4 ConDec at Work
59
2. Order confirmation or refusal a) The seller is bound to refuse the order if the seller communicates the impossibility of shipping it. b) The seller can send a confirmation to the customer only if the warehouse has previously given its acknowledgment. c) The warehouse cannot emit both an acceptance and a refusal concerning the shipment of an order. d) The seller has the possibility of refusing an already accepted order. e) The seller cannot accept an order if it has already refused that order. 3. Order finalization a) If the seller sends a confirmation, the customer can (but is not forced to) pay the order. b) The payment can be done only if the seller has previously sent the confirmation message. c) The payment is incompatible with seller’s refusal. d) When the payment is carried out, the seller is in charge of delivering a single final receipt. e) The seller will emit a receipt only after the payment has taken place.
3.4.3 Identification of Activities As a second step, we analyze the choreography contract described in Sect. 3.4.2 trying to identify all the involved activities. The same contract is rewritten in the following, by highlighting all the activities in bold face. 1. Order creation phase a) The order is implicitly created as soon as an instance of the choreography begins. b) The customer must either close or cancel the order (but not both). c) Before closing or canceling the order, the customer must choose a series of items from the seller’s list. d) If the order is closed or canceled, then no further items can be added to the order. e) After having closed the order, the customer expects a positive or negative answer from the seller. f) The seller can send an answer to the customer only if the order has already been closed. 2. Order confirmation or refusal a) The seller is bound to refuse the order if the seller communicates the impossibility of shipping it. b) The seller can send a confirmation to the customer only if the warehouse has previously given its acknowledgment. c) The warehouse cannot emit both an acceptance and a refusal concerning the shipment of an order. d) The seller has the possibility of refusing an already accepted order. e) The seller cannot accept an order if it has already refused that order. 3. Order finalization
60
3 The ConDec Language
Table 3.5. Activities identification in the order management choreography activity choose item cancel order close order refuse order accept order refuse shipment accept shipment pay deliver receipt
synonyms add item
negative answer positive answer, send confirmation impossible shipment give acknowledgement do payment
clause
responsible
1c, 1d 1b, 1c, 1d 1b, 1c, 1d, 1e, 1f 1e, 1f, 2a, 2d, 2e, 3c 1e, 1f, 2b, 2d, 2e, 3a, 3b
customer customer customer seller seller
2a, 2c 2b, 2c 3a, 3b, 3c, 3d, 3e 3d, 3e
warehouse warehouse customer seller
a) If the seller sends a confirmation, the customer can (but is not forced to) pay the order. b) The payment can be done only if the seller has previously sent the confirmation message. c) The payment is incompatible with seller’s refusal. d) When the payment is carried out, the seller is in charge of delivering a single final receipt. e) The seller will emit a receipt only after the payment has taken place.
Table 3.5 summarizes the results of the activities identification task, also disambiguating distinct terms which indeed refer to the same activity. 3.4.4 Elicitation of Business Constraints Similarly to what we have done in Sect. 3.4.3 for identifying the activities, we now present the choreography contract again, but by highlighting all the prescriptive parts and keywords, as well as the temporal aspects, inside its clauses. 1. Order creation phase a) The order is implicitly created as soon as an instance of the choreography begins. b) The customer must either close or cancel the order (but not both). c) Before closing or canceling the order, the customer must choose a series of items from the seller’s list. d) If the order is closed or canceled, then no more items can be added to the order. e) After having closed the order, the customer expects a positive or negative answer from the seller. f) The seller can send an answer to the customer only if the order has already been closed.
3.4 ConDec at Work
61
2. Order confirmation or refusal a) The seller is bound to refuse the order if the seller communicates the impossibility of shipping it. b) The seller can send a confirmation to the customer only if the warehouse has previously given its acknowledgment. c) The warehouse cannot emit both an acceptance and a refusal concerning the shipment of an order. d) The seller has the possibility of refusing an already accepted order. e) The seller cannot accept an order if it has already refused that order. 3. Order finalization a) If the seller sends a confirmation, the customer can (but is not forced to) pay the order. b) The payment can be done only if the seller has previously sent the confirmation message. c) The payment is incompatible with seller’s refusal. d) When the payment is carried out, the seller is in charge of delivering a single final receipt. e) The seller will emit a receipt only after the payment has taken place.
Starting from the highlighted keywords, the business constraints mentioned in the contract can be made explicit. Table 3.6 illustrates a possible methodology to isolate them. For all the contract clauses, we enumerate the highlighted keywords. Then, each keyword is bound to the set of involved activities, trying to make also explicit when such activities act as sources or targets inside the clause, i.e., trying to identify whether they trigger the prescriptions contained in the clause or rather are involved in the effects of such prescriptions. Finally, each prescription is compared with the tables illustrating the ConDec constraints (Tables 3.1, 3.2, 3.3 and 3.4), to the aim of recognizing which kind of constraint (or combination of constraints) can be applied to the involved activities, so as to properly represent the prescription. It is worth noting that some of the contract clauses are not translated into ConDec constraints, either because they are not prescriptive (this is the case of clause 1a), or because they focus on the possibility of doing something (see clauses 2d and 3a), which is by default guaranteed when adopting an open language such as ConDec. The latter kind of clause comes into help for determining the exact type of constraint that must be used to model another prescriptive clause, focused on the same activities. For example, in the order management choreography we have an asymmetry between the treatment of the order rejection vs acceptance by the warehouse and by the seller: in the first case, a not coexistence constraint is used to bind the two answers, whereas in the second case a weaker negation response is employed. Clause 2d can be considered, in this setting, as a further evidence attesting that choosing a not coexistence constraint also for the seller’s answers would be too restrictive. A similar discussion can be made for clause 3a. Indeed, it helps in the identification of the right constraint used to relate the order acceptance
62
3 The ConDec Language
Table 3.6. Elicitation of ConDec constraints in the order management choreography clause keywords
affected activities
constraint
1a – 1b must 1c before must (at least one)
close ex-or cancel order (sources) close or cancel order (target) choose item
ex choice precedence
1d if then no more
(sources) close or cancel order (target) choose item
neg response
1e after expects
(source) close order (targets) confirm or refuse order
response
1f can if already
(sources) confirm or refuse order (target) close order
precedence
2a if (seller) is bound to
(source) refuse shipment (target) refuse order
resp existence
2b can only if previously
(source) accept order (target) accept shipment
precedence
2c cannot emit both
confirm and refuse ship- not coexistence ment
2d (if) already has the possibility of
accept order refuse order
2e if already cannot 3a if can 3b can only if previously 3c incompatible 3d when in charge of 3d single 3e will emit only after
(source) refuse order (target) accept order accept order pay (source) pay (target) accept order
– (openness) neg response – (openness) precedence
pay and accept shipment not coexistence (source) pay (target) deliver receipt deliver receipt (source) deliver receipt (target) pay
response absence 2 precedence
with the payment, reinforcing the content of clause 3b, i.e., attesting that a precedence suffices. After having completed the table, a draft of the ConDec model can be drawn. It is shown in Fig. 3.1. It is worth noting that the branching negation response constraint due to clause 1d has been represented as two distinct
3.4 ConDec at Work choose C item
(1d)
refuse order
(1d)
S
cancel order
C
(1b)
(3c) close order
C
(3d) 0..1 C
pay (1e)
refuse W shipment
(2a)
(1c)
(2e)
63
(3d)+(3e)
deliver receipt
S
(2c)
(3b)
accept order
S
(2b)
accept W shipment
Fig. 3.1. Draft of a ConDec model capturing the order management choreography; for the sake of readability, constraints are decorated with the corresponding clause in the choreography contract, and activities are associated to the corresponding responsible role (customer: C – pink; seller: S – blue; warehouse: W – yellow )
relations (which is equivalent, because the constraint branches on the source side – see Sect. 3.3.5); furthermore, the response and precedence constraints derived from clauses 3d and 3e have been combined into a single succession constraint. 3.4.5 Completing the ConDec Model In the real world, the steps followed in Sects. 3.4.1, 3.4.2, 3.4.3 and 3.4.4 would obviously be subject to many iterations, and would be interleaved by several meetings and interviews with domain experts. Here we consider only one iteration, aimed at analyzing the draft model produced so far (see Fig. 3.1), revising and extending it if needed. As we will see in Part 2 and 3 of the book, static verification of properties and enactment help the modeler in the assessment of ConDec diagrams. In our case study, such an assessment would surely point out a potential weakness. In particular, the model supports the possibility of closing the order multiple times. Each time the order is closed, an answer must be eventually sent by the seller, even if it has already been produced. This potential misbehavior can be eliminated by imposing that the order can be closed at most one time, i.e., by associating a absence 2 constraint to the close order activity. This perfectly fits with the other choreography clauses, and probably it has been forgotten when the choreography description was wrote down. Indeed, each choreography instance centers around a single order, and, as attested by clause 1d, after having closed the order, no further items can be added to it; hence, introducing the absence 2 constraint seems to be completely justified, without sacrificing flexibility. Fig. 3.2 depicts the final ConDec model, obtained by extending the draft of Fig. 3.1 with the cardinality constraint associated to the close order activity.
64
3 The ConDec Language choose C item
refuse order
S
refuse W shipment
0..1 cancel order
C
close order
0..1 C
C
pay
accept order
deliver receipt
S
S
accept W shipment
Fig. 3.2. Complete ConDec model capturing the order management choreography Table 3.7. Some cognitive dimensions closeness of mapping Closeness of representation to domain abstraction Types and availability of abstraction mechanisms consistency Similar semantics are expressed in similar syntactic forms hidden dependencies Important links between entities are not visible premature commitment Constraints on the order of doing things progressive evaluation Work-to-date can be checked at any time
3.5 Usability of ConDec Although a deep and extensive analysis of the ConDec notation from the endusers viewpoint has not yet been carried out [191], we try to briefly assess its usability by commenting on its cognitively-relevant aspects. The discussion relies on the cognitive dimensions framework , initially developed by Green in the late 80’s [122]. Cognitive dimensions are a useful tool for subjectively evaluating the usability of languages and notations in an easy-to-comprehend way. They have been applied to a broad range of programming languages, environments and editors, and also to visual notations [123]. Table 3.7 introduces the subset of the cognitive dimensions that will be matter of our discussion. The main strength of ConDec is the closeness of mapping between the notation and the business constraints contained into a requirements specification document, expressed in natural language. This advantage comes from the declarative and open nature of ConDec: it provides a wide range of abstractions to constrain activities in many different ways, covering multiplicity aspects, choices, time-ordered and unordered interconnections, as well as negative relationships. ConDec diagrams can range from closed procedural models, in which only chain succession constraints are used, to loosely coupled
3.5 Usability of ConDec
65
Table 3.8. Basic visual constitutive elements of ConDec’s constraints notation
existence constraints
0..N, M..*, K (a l´ a UML)
choice
♦
concept
/
(a l´ a decision gateway in BP modeling notations)
binary constraints
− (normal) = (alternate) ≡ (chain)
source of binary constraints • negation
temporal ordering
−−
succession representation
response + precedence part (e.g. •−−• = •−−− + −−−•)
ones. As attested by the case study presented in Sect. 3.4, a variety of natural language statements can be directly represented in ConDec, facilitating the design task and making it simpler to maintain a link between the model and the requirements specification document, keeping track of which requirements have been covered so far. The declarative and open nature of ConDec has also a positive impact on the premature commitment dimension, a topic which has been already discussed in Sect. 2.3.3 – p. 31. Indeed, by focusing on the “what” without stating the “how”, a ConDec model is close to the business constraints introduced by the domain under study, avoiding over-specification and over-constraining issues and delaying as much as possible the choice about the “order of doing things”, postponing it until the execution takes place. While the presence of several abstractions is desired to properly capture the complexity of the outer world, it raises a potential usability issue, because a long learning curve is needed to become familiar with the whole notation. ConDec mitigates this problem by paying great attention to the consistency of the graphical notation. In particular, constraints are represented by coherently combining the small set of basic visual elements shown in Table 3.8. For example, the semantics of each succession relation, as well as its graphical representation, is determined by combining the semantics/representation of its response and precedence part. Furthermore, existence and choice constraints employ familiar symbols, taken from UML and from the mainstream BP modeling languages. Even though ConDec combines simple concepts, rendered in a consistent way, as the complexity of the designed models grows the models tend to loose their readability. Indeed, ConDec is not a flow-oriented language, but it is instead a constraint-based language, and thus drives the modeler towards the adoption of an unstructured approach to design. A ConDec diagram is a “flat”
66
3 The ConDec Language 0..1 a
b
c
Fig. 3.3. Presence of non trivial hidden dependencies inside a ConDec model (hidden dependencies are shown as dashed gray connections)
container of all the business constraints reflecting the domain under study, and their combination tends to reduce the clarity of the entire model. This drawback does not only refer to the graphical representation of the model, but also on its overall meaning: the interplay of constraints leads to implicitly introduce a plethora of hidden dependencies among the activities. In ConDec, hidden dependencies take the form of further, implied constraints. Certain hidden dependencies are trivial, others are not. The following example points out this issue by considering a simple concrete case. Example 3.5.1 (Hidden dependencies in ConDec). Let us consider the ConDec diagram shown in Fig. 3.3. The diagram implicitly contains two kinds of hidden dependencies. The first one is trivial. Since activity b is response of a, and in turn c is response of b, then also the following redundant response is contained in the model: a •−−− c Such a hidden dependency is caused by the transitivity of the response constraint. A second non-trivial hidden dependency is instead caused by the interplay between the 0..1 cardinality constraint and the response ones. Let us illustrate a possible execution of the model to point out such a hidden dependency. 0..1
Suppose that activity c is executed; constraint c forbids further executions of c within the same instance. This prohibition has an indirect effect also on the possibility of executing activities a and b. In fact, the response constraints contained in the model state that the execution of a or b imposes a consequent execution of c, which however would lead to violate the cardinality constraint. Therefore, upon the execution of activity c also a and b become forbidden. In other words, the interplay between the absence 2 and response constraints introduces two hidden negation responses relating activity c with a and b. In complex cases, the presence of many non-trivial hidden dependencies could lead to produce inconsistent or incorrect models. In this respect, ConDec models demand a constant computer aided support, for statically verifying and simulating (the enactment of) models during the design phase. Static
3.6 Linear Temporal Logic
67
verification supports the discovery of errors inside a model, whereas simulation can be used to see how the effects of business constraints evolve in response to (simulated) event occurrences, and thus helps in making hidden dependencies explicit. In other words, the issues raised by hidden dependencies can be handled only if the progressive evaluation of ConDec models is supported. Part 2 and 3 of the book will be specifically devoted to discuss a Computational Logic-based framework which constitutes the enabling technology for carrying out a progressive evaluation. Progressive evaluation facilities and support along the whole life cycle of ConDec specifications, in turn, require an underlying formal framework and its reasoning capabilities. As we have sketched in Fig. 2.15 – p. 44, a given formal framework can be effectively exploited only if a complete translation of all the ConDec constructs into its representation language. The remainder of the first part of the book is focused on this issue: in the next sections, we discuss the use of propositional Linear Temporal Logic, the first logic-based language onto which ConDec has been completely mapped; in Chaps. 5 and 6, instead, we will focus on the adoption of CLIMB to accomplish this task. CLIMB shows unique capabilities, both in terms of the language expressiveness and on the power of its corresponding reasoning techniques.
3.6 Linear Temporal Logic In this section, we provide a broad introduction to the framework of propositional Linear Temporal Logic (LTL), which has been exploited by Pesic and van der Aalst for developing the first formalization of ConDec [191, 192]. Temporal logics are a special class of modal logics where modalities are interpreted as temporal operators, used to describe and reason about how the truth values of assertions vary with time [99]. According to [99], temporal logics can be classified along a number of axes, as we have done in Sect. 2.1.2 for characterizing the notion of time in interaction models. In particular, temporal logics can be: • • • • • •
propositional vs first-order linear vs branching point vs interval-based discrete vs continuous past vs tense qualitative vs metric
Where not explicitly stated, in this book we will focus on the propositional Linear Temporal Logic (LTL) with future-tense operators only. More specifically, we consider LTL as being: propositional. Constraints are built up from atomic propositions, whose truth values change over time.
68
3 The ConDec Language
linear. Each situation has a single next future moment, and temporal modalities therefore predicate on the truth of propositions along a single timeline; alternatives are modeled as “branches in time” instead of “branches of time” [201]. qualitative. Temporal operators are used to express qualitative time relations between propositions. Metric distances are not part of the logic. point-based. Temporal operators and propositions are evaluated over points in time. discrete. Time is discrete; the present moment correspond to the current state of the system and the next moment to the immediate successor state (typically corresponding to the first following moment at which some further event occur, causing the system to evolve). future-tense. Temporal operators are predicate on the occurrence of events in the future. This is reasonable for systems which have a definite starting time, and all the systems considered in this book exhibit this feature (see Sect. 2.1.2). 3.6.1 LTL Models In accordance with the outlined properties, the LTL time structure F , also called frame, models a single, linear timeline; formally, F is a totally ordered set (S, ≺). Let P be the set of all atomic propositions in the system. An LTL model M is a triple (S, ≺, v) where v : P → 2S is a valuation function which maps each proposition in P to the set of time instances at which the proposition holds. In the ConDec setting, each proposition represents a possible event that may occur during an instance of the system. More specifically, a proposition e ∈ P is true in a certain state if at that state the event denoted by e occurs. Under this interpretation, LTL models correspond to execution traces. Definition 3.6.1 (LTL execution trace). Given a set E representing all the events that can potentially occur during the executions of the system under study, an LTL execution trace TL is an LTL model having N as time structure and E as the set of atomic propositions. In particular, TL = (N, <, vocc ), where vocc : E → 2N is a valuation function mapping each event e ∈ E to the set of all timestamps at which e occurred. For convenience, we will sometime use the following abbreviations: TL (i) will denote the i − th state of TL , and e ∈ TL (i) will be adopted as a shortcut for i ∈ vocc (e). 3.6.2 Syntax of Linear Temporal Logic LTL formulae are defined by using:
3.6 Linear Temporal Logic
69
Table 3.9. LTL temporal operators op.
name
meaning
intuition current state
φ (Next time) φ will hold in the next state
♦φ (Eventually) φ will hold sometimes in the future φ ψUφ
(Globally) φ will always hold in the future (Until) φ will hold in a future moment, ψ will always hold until that moment
• atomic propositions, i.e., events, together with the two special constants true and f alse; • classical propositional connectives, i.e., ¬, ∧, ∧ and ⇒; • temporal operators, i.e., (next time), U (until), ♦ (eventually), (globally) and W (weak until). Starting from these constitutive elements, an LTL formula is recursively defined as follows: • • • • •
each event e ∈ E is a formula; if φ is a formula, then ¬φ is a formula; if φ and ψ are formulae, then φ ∧ ψ is a formula; if ψ is a formula, then ψ is a formula; if φ and ψ are formulae, then φUψ is a formula.
Other LTL formulae can be defined as abbreviations: • φ ∨ ψ ¬(¬φ ∧ ¬ψ) and φ ⇒ ψ ¬φ ∨ ψ; • true ¬φ ∨ φ and f alse ¬true; • ♦φ trueUφ, φ ¬♦¬φ and ψWφ ψUφ ∨ ψ. When parentheses are omitted, the following priority of operators holds: first all the temporal operators, then ¬, ∧, ∨ and finally ⇒. 3.6.3 Semantics of Linear Temporal Logic The semantics of LTL is given w.r.t. an LTL model, in a specific state. In other words, the truth of formulae is evaluated inside a given state. We will use |=L to denote the logical entailment in the LTL setting. M, i |=L φ means that φ is true at time i in M. The intuitive semantics of each temporal operator is sketched in Table 3.9. The W operator relaxes U by removing the requirement that φ must eventually hold in a future moment, and by stating that in this case ψ must hold in all the future states.
70
3 The ConDec Language
|=L is defined by induction on the structure of the formulae3 : • • • • • • • • • • •
(TL |=L φ) iff (TL , 0 |=L φ); (TL , i |=L e) iff e ∈ TL (i) (i.e., i ∈ vocc (e)); (TL , i |=L e) iff e ∈ TL (i); (TL , i |=L φ ∧ ψ) iff (TL , i |=L φ) and (TL , i |=L ψ); (TL , i |=L φ ∨ ψ) iff (TL , i |=L φ) or (TL , i |=L ψ); (TL , i |=L φ ⇒ ψ) iff (TL , i |=L φ) or (TL , i |=L ψ); (TL , i |=L φ) iff (TL , i + 1 |=L φ); (TL , i |=L ψUφ) iff ∃k ≥ i s.t. (TL , k |=L φ) and ∀i ≤ j < k (TL , j |=L ψ); (TL , i |=L ♦φ) iff ∃j ≥ i s.t. (TL , j |=L φ); (TL , i |=L φ) iff ∀j ≥ i (TL , j |=L φ); (TL , i |=L ψWφ) iff either ∃k ≥ i s.t. (TL , k |=L φ) and ∀i ≤ j < k (TL , j |=L ψ), or ∀j ≥ i (TL , j |=L φ).
3.7 Translating ConDec into Linear Temporal Logic LTL can be successfully employed to formalize all the ConDec constraints, providing a temporal logic-based semantics to the graphical notation. The ConDec language itself has been developed starting from the work of Dwyer et al. [98], in which the authors present a pattern-based analysis of the most diffused LTL formulae in the specification of concurrent reactive systems. In this light, ConDec can be considered as a graphical front-end, supporting non-IT savvy in the rigorous formal specification of interaction models, while avoiding the direct manipulation of temporal logical formulae. 3.7.1 The Translation Function We suppose that the translation of an arbitrary ConDec model into the underlying LTL formalization is embedded in a translation function called tLTL . Definition 3.7.1 (ConDec to LTL translation). tLTL is a function which translates a ConDec model CM = A, Cm , Co into an LTL conjunction formula as follows: tLTL (Ci ) tLTL : CM −→ tLTL (CM) = Ci | Ci ∈Cm
where tLTL (Ci ), i.e., the application of tLTL to a ConDec mandatory constraint, follows the guidelines provided in [191, 173].
3
For the sake of readability, we explicitly denote the semantics of ♦, and W, even if their meaning can be obtained from the semantics of U.
3.7 Translating ConDec into Linear Temporal Logic
71
Example 3.7.1 (LTL representation of a ConDec model). Let us consider a portion of the ConDec model shown in Fig. 3.2, namely: 0..1
refuse order •−− −• pay •−−• deliver receipt Its LTL representation is: ⎛
0..1
⎞
−• pay •−−• deliver receipt ⎠ = tLTL ⎝ refuse order •−− tLTL tLTL
refuse order •−− −• pay
(Def. 3.7.1)
∧
pay •−−• deliver receipt ∧ ⎛ ⎞ 0..1
tLTL ⎝ deliver receipt ⎠
=
([191, 173])
[♦ref use order ⇒ ¬♦pay ∧ ♦pay ⇒ ¬♦ref use order] ∧ [(pay ⇒ ♦deliver receipt) ∧ (¬deliver receipt)Wpay] ∧ [¬(♦(deliver receipt ∧ ♦deliver receipt))] Indeed, the translation of the whole model corresponds to the conjunction of the formulae translating each one of the three constraints. The not coexistence constraint is represented in LTL by stating that if refuse order is eventually executed, then the execution of the pay activity is always forbidden4 , and vice versa. The succession constraint is translated as the conjunction of the translations of its response and precedence parts. Response expresses that every time a payment is done, then a receipt will be eventually delivered. Conversely, the precedence part is formalized by means of the weak until operator: deliver receipt cannot be executed until the payment is done, or it cannot be executed at all if the payment is never done. Finally, the absence 2 constraint is formalized by forbidding a double execution of deliver receipt. To model the double occurrence of deliver receipt, in turn, we combine the ♦ and operators: the receipt must be eventually delivered, and from the state immediately following such a delivery a second receipt must be eventually delivered again. 3.7.2 LTL Entailment as a Compliance Evaluator Thanks to Defs. 3.6.1 and 3.7.1, we have established a link between execution traces and LTL models, and between ConDec models and LTL formulae. Under this perspective, LTL entailment provides a formal account to the notion 4
Remember that ¬♦pay ¬pay.
72
3 The ConDec Language
of compliance, and it therefore denotes the set of execution traces supported by a ConDec model (see Def. 3.2.2). Definition 3.7.2 (Execution trace support in the LTL setting). Given an LTL execution trace TL and a ConDec model CM, TL is supported by CM (i.e., TL is compliant with CM) if and only if TL |=L tLTL (CM). Example 3.7.2 (Compliance as LTL entailment). Let us consider a ConDec model CM containing only a single response constraint between the query and inform activities. As we have seen in Example 3.7.1, the LTL translation of CM is: (query ⇒ ♦inf orm) tLTL (CM) tLTL query •−−− inform By applying Def. 3.7.2 together with the LTL declarative semantics reported in Sect. 3.6.3, we have that an LTL execution trace TL is then supported by CM if and only if: TL |=L (query ⇒ ♦inf orm) ⇔∀ i ≥ 0, (TL , i |=L query ⇒ ♦inf orm) ⇔∀ i ≥ 0, query ∈ TL (i) ∨ (TL , i |=L ♦inf orm) ⇔∀ i ≥ 0, query ∈ TL (i) ∨ (∃ j ≥ i, inf orm ∈ TL (j)) Therefore, it holds that: • The empty trace is supported by CM, because all its states do not contain the execution of the query activity. • Because of the same reason, also a trace containing only occurrences of “external” activities (i.e., activities different than query and inform) is supported, for the sake of the openness (note that, anyway, such external activities must appear as part of A(CM)). • The trace described by vocc (query) = {0} is not supported, because the response constraint requires the presence of an inform in at least one state ≥ 0. • The trace described by vocc (query) = {0, 1}, vocc (inf orm) = {2} is supported, because both i = 0 and i = 1 have a following j (j = 2 in particular) belonging to the valuation set of the inform activity. 3.7.3 Linear Temporal Logic and Finite ConDec Traces In Sect. 2.1.2, we have discussed that the temporal dimension in interaction models is bounded, and therefore their execution traces are always finite. We formulate this feature in the LTL setting, introducing the notion of finite LTL trace.
3.7 Translating ConDec into Linear Temporal Logic
73
Definition 3.7.3 (finite LTL trace). An LTL execution trace TL is finite if and only if there exists a state n such that all the states belonging to its infinite suffix do not appear in the valuation function of any event, i.e.: ∃ n ∈ N s.t. TL (n) = ∅ ∧ ∀ i > n, TL (i) = ∅ n represents the length of the trace, namely length(TL ) n. The problem is that the LTL semantics is given for general LTL traces, and has N as the underlying (infinite) time structure. To reconcile the logic with the intended “finite” semantics, two possible solutions can be investigated: • a further LTL formula, formalizing the “finitness requirement”, is added to the conjunction formula produced by the application of the translation function tLTL on a ConDec model; • LTL models are redefined as sequences of finite length, and the semantics of the logic is revised accordingly. Let us briefly discuss both solutions. The first solution is conservative: it tries to introduce the finitness requirement inside the logic, without modifying its semantics. This approach has the great advantage that the huge amount of computer aided verification tools, developed in the literature for reasoning upon LTL specifications, can be seamlessly applied to ConDec as well (see Chapt. 11). To formalize the finitness requirement in LTL, the following termination property can be employed. Definition 3.7.4 (ConDec termination property). Given a ConDec model CM, the LTL termination property of CM, denoted by term(CM), states that there must eventually be a state starting from which no event will occur: ⎞ ⎛ ¬a⎠ term(CM) ♦ ⎝ ∀a∈A(CM)
The notion of compliance (support) relating a finite execution trace with a specific model must then be properly revised, taking into account also the termination property. In particular, compliance must be assessed by considering the LTL formalization of the model, augmented with the termination property. We denote this kind of support as finite support. Definition 3.7.5 (Finite support in the LTL setting). Given a finite LTL execution trace TLf and a ConDec model CM, TLf is finitely supported by CM (i.e., is finitely compliant with CM), if and only if: TLf |=L tLTL (CM) ∧ term(CM) Sometime, it is assumed that the execution traces of the system are not only finite, but also totally ordered: at a given time, at most one event may
74
3 The ConDec Language
happen. This is for example the approach followed by the original formalization of van der Aalst and Pesic [192, 191, 195]. Under this assumption, the termination property can be rewritten introducing a special “end” event, which must eventually be executed, then infinitely repeating its execution in each following state: ♦end5 . In other words, a state must be eventually reached, starting from which the “end” event will saturate the trace, excluding the possibility of executing other activities6 . In this book we do not make the assumption that traces are totally ordered, and thus we rely on the general termination property introduced in Def. 3.7.4. Indeed, after having introduced the CLIMB framework, we will discuss the impact of switching to a quantitative notion of time, and of introducing quantitative time constraints. When it comes to a quantitative notion of time, the granularity plays a central role: event occurrences are bound to time units, whose order of magnitude depends on the domain under study. While the total ordering assumption is reasonable when a granularity of milliseconds is chosen, it becomes questionable when shifting to a magnitude of hours or days. The second possibility for dealing with the gap between LTL and finite traces, is to directly consider finite LTL traces as the only possible models for the logic, revising the semantics of temporal operators accordingly. A plethora of finite trace semantics for LTL have been proposed in the literature; the reader may refer to [32] for a comprehensive survey on the topic. For example, the original semantics of ConDec has been defined in terms of the finite trace semantics introduced in [131, 115]. The semantics relies on finite execution traces, which either represent the observed portion of a system’s execution or a complete, finite run. In this setting, the semantics of LTL temporal operators is revised by limiting their scope to the (finite) set of states contained in the trace, i.e., taking into account only the states between 0 and the length of the trace. Hence, the semantics of formulae inolving U, ♦ and is redefined as follows: • (TLf , i |=L ψUφ) iff ∃k, i ≤ k ≤ length(TLf ) s.t. (TLf , k |=L φ) and ∀i ≤ j < k (TL , j |=L ψ); • (TLf , i |=L ♦φ) iff ∃j, i ≤ j ≤ length(TLf ) s.t. (TLf , j |=L φ); 5 6
This property is usually represented in the literature as ♦end ∧ (end ⇒ end). This approach requires a completion of each considered finite LTL trace, extending it with an infinite suffix constituted by “end” events. Formally, given a finite LTL trace TLf with valuation function vocc : E → 2N , its completion extends TLf by introducing the special end event, and stating that its valuation function corresponds to the infinite suffix following the length of TLf : completion(TLf ) = (N, <, vocc ), where vocc (e) vocc (e) ∀ e ∈ E N vocc : E ∪ {end} → 2 and vocc (end) {i | i > length(TLf )}
3.7 Translating ConDec into Linear Temporal Logic
75
• (TLf , i |=L φ) iff ∀j, i ≤ j ≤ length(TLf ) (TLf , j |=L φ). The main advantage of opting for a finite trace semantics, is that it is directly able to capture the finite nature of the domain under study. Furthermore, while the verification techniques developed for the general LTL cannot be employed anymore, it is possible to devise new efficient tools specifically thought for reasoning upon finite traces.
4 The CLIMB Rule-Based Language
The CLIMB (Computational Logic for the verIfication and Modeling of Business constraints) language is a declarative rule-based language for the specification of interaction models. This chapter describes syntax and features of the language, showing how it can suitably deal with static as well as dynamic aspects of EBSs; the declarative semantics of the language is presented, providing a formal characterization of compliance; finally, some interesting properties, such as compositionality of CLIMB specifications, are investigated. The CLIMB language is a first-order logic-based language; quantification is left implicit in the language, in order to facilitate readability and usability. We will briefly discuss in an informal way and by means of examples how variables are quantified. For an exhaustive description concerning the quantification of variables and the restrictions imposed on the language the interested reader may refer to [8, 58]. In the remainder of the book, we will assume that the reader is familiar with First Order Logic (FOL), Logic Programming (LP) and Prolog. A good introduction to LP is the book by Lloyd [154]; good introductions to Prolog are the books by Sterling and Shapiro [227] and by Bratko [49].
4.1 The CLIMB Language in a Nutshell As shown in Fig. 4.1, the CLIMB language is a subset of the SCIFF language [8], which has been developed in the context of the SOCS European Project1 . The purpose of the SOCS EU Project, carried out inside the Global Computing initiative, was to devise a logic-based framework for the specification and verification of open and heterogeneous Multi-Agent System (MAS) 1
Societies Of ComputeeS (SOCS): a Computational Logic model for the description, analysis and verification of global and open societies of heterogeneous computees. IST-2001-32530, 2002-2005. Web-page: http://lia.deis.unibo.it/research/socs/
M. Montali: Declarative Open Interaction Models, LNBIP 56, pp. 77–114, 2010. c Springer-Verlag Berlin Heidelberg 2010
78
4 The CLIMB Rule-Based Language SCIFF SCIFF-lite CLIMB
Fig. 4.1. Variants of the SCIFF language and their expressiveness
ABSTRACTION (events)
SYSTEM EXECUTION
ABSTRACTION (events)
SYSTEM EXECUTION
Fig. 4.2. Abstraction of a system execution in terms of event occurrences
(see Sect. 7.1.4), ranging from the implementation of autonomous intelligent agents (called computees) to the engineering of their interaction. A large part of the project was indeed focused on the inter-agent perspective, i.e., on the interaction protocols regulating the messages exchange between computees and also external, unknown entities. Being these systems open and heterogeneous, it is impossible to make any assumption about the number and the internal implementation of interacting agents. Hence, the problem of specifying and verifying interaction requires an abstraction step, to identify what pieces of information could be effectively observed and, consequently, targeted by the specification language. In line with the general discussion made in Sect. 2.1.1, the idea developed within SOCS was to characterize each instance of an open MAS in terms of the events that are generated by the involved entities when acting on the environment or interacting with each other (see Fig. 4.2). Thus, SCIFF can be applied to any dynamic context whose executions can be described in terms of events. In particular, we think of CLIMB as a rule-based language for the declarative and open specification of interaction models. CLIMB specifications are mainly composed by two parts: 1. a set of rules which relate event occurrences with expectations about other event occurrences, which are used to characterize the ideal dynamics of the system; 2. a knowledge base formalizing the static aspects of the system, i.e. the background knowledge independent of the specific executions of the system.
4.2 The CLIMB Language
79
4.2 The CLIMB Language We present the CLIMB syntax in a bottom-up manner, starting from the basic building components of the language, i.e., event occurrences, traces and expectations, and then discussing how they are jointly combined in rules and clauses of the knowledge base. 4.2.1 Event Occurrences and Execution Traces Deciding what has to be considered an event strictly depends on the application domain. In a service-oriented setting, events may represent messages exchange, whereas in BPM an event may represent the fact that a certain activity has been started, completed, or reassigned. Furthermore, even if the application domain is fixed, there could be several different notions of events, because of the assumed perspective, the granularity, and so on. For example, one could adopt a coarse-grained approach by considering that each activity in a Business Process is atomic, thus linking the concept of event to the generic one of “activity execution”. This is the approach taken by the ConDec language, as we have introduced it in Chap. 3. Events are represented in CLIMB as LP terms. In this way, the language completely abstracts away from the problem of deciding “what an event is”, and rather lets the developers decide which are the important events for modeling the domain, at the desired abstraction level. For example, the delivery of a message sent by a web service ws1 to another web service ws2 , with a certain content can be simply denoted by send(ws1 , ws2 , content(. . .)). It is worth noting that, differently from propositional LTL, CLIMB is a firstorder language, and therefore variables can be seamlessly used inside events in place of constant values. For example, send(Sender, Receiver, content(C)) could represent a message exchange between two unknown web services, and referring to an unknown content. The instances of the system under study are characterized by the set of events occurring when entities act and interact with each other. Hence, a symbol denoting the occurrence of an event at a certain time must be provided by the language. Differently from temporal logics, which implicitly embed time inside modal, qualitative operators, CLIMB adopts an explicit and quantitative notion of time: happened events are associated to a time variable or numerical timestamp. More specifically, the occurrence (Happening) of an event Ev at a (discrete) time point T is denoted by the atom H(Ev, T ) where Ev is a term and T is a numerical variable, which ranges over different domains, depending on the chosen underlying time structure. In fact, CLIMB can likewise adopt either a discrete (i.e., (N, <) or (Z, <)) or dense (i.e., (R, <)) time structure. In order to maintain the discussion general, we
80
4 The CLIMB Rule-Based Language
will therefore abstract away from the specific time structure, using T as a generic placeholder. Happened events may have a variable time and/or contain variables in their event part, or they can be completely ground. In the first case, they refer to classes of concrete event occurrences, whereas in the latter case they represent a specific occurrence of the involved event, at the specified time. Therefore, in CLIMB an execution trace is simply defined as a (finite) set of ground happened events. Definition 4.2.1 (Herbrand base of traces). The Herbrand base of traces BH is the Herbrand base built upon CLIMB happened events: BH = {H(e, t)|e ∈ U, t ∈ T} where U is the Herbrand universe of events. Definition 4.2.2 (CLIMB execution trace). A CLIMB execution trace T is a finite set of ground happened events: T ⊆ BH . As we have sketched above, partially specified happened events, namely happened events containing non-ground variables, are used to identify and match with “classes” of concrete ground events. If the variables contained in a happened event are completely free (e.g., H(E, T )), then such a happened event will denote any occurrence of any event in the execution trace (i.e. it will match with all events in the trace); variables can then be subject to constraints in order to restrict the corresponding matching class. In particular, variables can be constrained by means of CLP constraints (see Sect. 4.2.2) or Prolog predicates. The following example introduces some ground and non-ground happened events, discussing their meaning. Example 4.2.1 (Happened events). Let us consider some examples of happened events in the context of a loan process. It is assumed that the handling of a loan is a non atomic activity, and is therefore is associated to a set of events, representing the evolution of its executions. For the sake of simplicity, we consider only the start and complete events, used to respectively denote the initiation and termination of the management of loans. Each loan is associated to a unique identifier. Thus, the fact that the employee Emp starts (completes) the management of a loan identified by Loanid can be represented by the term event(T ype, handle loan, Emp, Loanid ), where T ype/start (T ype/complete). For example, H(event(start, handle loan, alice, l 09 2008), 14164)
(†)
represents a ground event occurrence, stating that Alice started to handle the loan identified by l 09 2008 on October 13th 2008, making the assumption that times are represented by the number of days from January 1st, 1970. Let us now introduce some examples of non ground event occurrences, discussing whether they match with † or not.
4.2 The CLIMB Language
81
H(Ev, T ) represents the occurrence of some event at an unspecified time, and therefore it matches with any event occurrence. For example, it matches with (†), under the substitutions • Ev/event(start, handle loan, alice, l 09 2008) • T /14164 H(event(T ype, handle loan,O,Id),T )∧member(T ype,[start, complete]) 2 represents the initiation or termination of a loan handling activity. It matches with any specific loan management initiation or termination, hence also with (†), with bindings T ype/start, O/alice, Id/l 09 2008 and T /14164. H(event(start, handle loan, O, Id), T ) ∧ T ≤ 13966 states that the handling of a loan has been started by someone before the end of February 2008 (again, supposing that times are represented by the number of days from January 1st, 1970). T ≤ 13966 is an example of CLP constraint. This happened event does not match with (†), because 14164 is greater than 13966. H(event(start, handle loan, O, Id), T ) ∧ level(O, 1) denotes that a first-level employee has started the handling a loan, supposing that level(O, L) is a Prolog predicate denoting that employee O belongs to level L. This partially specified happened event matches with (†) only if Alice is a firstlevel employee. As we will see in Sect. 4.2.5, this kind of information can be modeled inside the CLIMB knowledge base. H(event(complete, handle loan, alice, Id),T )∧price(Id, P ) ∧ P > 106 models that Alice has completed the management a loan involving an amount of at least 1K e(expressed by the CLP constraint P > 106 ), where that price(Id, P ) is a Prolog predicate used to denote that the loan identified by Id involves a price P . This happened event matches with (†) only if loan l 09 2008 is of at least 1K e. 4.2.2 Constraint Logic Programming In LP, symbols are not interpreted. As a consequence, a numerical expression such as “two plus three”, represented in LP as term 2 + 3, does not mean 5, but simply a structure whose functor is + and whose terms are 2 and 3 (2 + 3 +(2, 3)). Moreover, unification is a syntactic operation. Thus, term 5 does not unify with 3 + 2. Similarly goal 5 = 3 + 2 fails, and so does 5 = X + 2. However, differently from domain-dependent terms and clauses, inside the head of the modeler these kinds of expressions carry on a clear, domainindependent meaning, bound to mathematics and algebraic structures. In the light of this, 5 = X + 2 would be interpreted as “five is equal to X plus two”, leading to infer that “X is equal to three”. Constraint Logic Programming (CLP) [135] aims at overcoming this issue. It is a class of programming languages that combines the advantages of LP 2
Member is a Prolog predicate, built-in inside all the major Prolog implementations, for testing whether an element belongs to a list or not. In particular, member(E, L) is true if and only if E is an element of list L.
82
4 The CLIMB Rule-Based Language
with the efficiency of constraint solving. In particular, CLP interprets some of the symbols contained in a logic program, treating them separately from the other ones. In this way, the declarativeness of LP is combined with domainspecific, efficient computational mechanisms. It is defined as a general scheme which can be specialized over particular domains. Each language of the CLP class is identified by: • a domain, representing the set of values that can be assumed by an interpreted variable; • the set of interpreted atoms, called constraints; • the set of interpreted symbols. For example, CLP(R) [136] is the instance of CLP which focuses on the R algebraic structure; this means that CLP(R) variables range over the real domain, and they are subject to constraints on the reals. Current implementations typically employ the simplex algorithm as constraint solver and feature a complete propagation of linear constraints. CLP(F D) is instead is the specialization of CLP on the Finite Domains [95]. These two CLP languages give an interpretation to numbers (real and integer respectively), their relation symbols (<, ≤, =, . . . ) and operations (+, −, ×, : ). For example, in CLP(R) the 5 symbol stands for the real number “five”, while + denotes the “addition” operation. For all the interpreted symbols, CLP replaces unification with a more powerful constraint solving mechanism. For example, when the constraint 5 = X + 2 is encountered, it succeeds, producing the answer X = 2. This behavior is obtained by performing a syntactic identification of the interpreted atoms (called constraints), inserting them in a constraint store and delegating their evaluation to a constraint solver instead of applying classical resolution. A store is needed because, in the general case, it is not always possible to immediately evaluate a constraint. For example, constraint T ≤ 13966 (cited in Example 4.2.1) is not satisfied nor violated when it is encountered, but has only the effect of restricting the domain of the involved variable: by adopting a dense time-structure, its effect would be to restrict the domain of T from R to (−∞, 13966]. The constraint solver takes care of processing constraints, pruning the domain of the interpreted variables when they are encountered, and propagating this information to the other constraints contained in the constraint store. The possible effect of this propagation is to restrict the domain of other variables, which in turn recursively trigger new propagations. In this way, the constraint solver efficiently infers which are the possible consistent values that can be assumed by interpreted variables, or detects a violation as soon as possible. A plethora of languages and efficient solvers have been developed to describe and manage constraints, such as for example ECLi PSe3 and SICStus4 . 3 4
http://www.eclipse-clp.org/ http://www.sics.se/isl/sicstuswww/site/
4.2 The CLIMB Language
83
Such frameworks have been successfully exploited for hard combinatorial problems in many different application domains, like scheduling, planning, temporal reasoning and bioinformatics. In the context of CLIMB, CLP constraints are extensively applied to the time variables, in order to model qualitative and quantitative temporal constraints. For example: • T2 > T1 is a qualitative time constraint, modeling that T2 is after T1 ; • T ≤ 13966 is an absolute time constraint, specifying that T is before the absolute timestamp of 13966; • T2 < T1 + 5 is a relative time constraint, stating that T2 is before T1 plus 5 time units. 4.2.3 Expectations The most important aspect of CLIMB is that it focuses on the dynamics of the EBS under study, which we deemed to be an essential feature of interaction models. In particular, beside the representation of “what” happened and “when” (through the use of H atoms), the language explicitly supports the representation of “what” is expected (not) to happen, and “when”. As argued in [235], expectations are abstract entities that captures the possible events that would make a system conform to its requirements. A set of expectations represents a possible evolution of the system towards a correct situation, pointing out, at every time point, the desired and undesired courses of interaction. The fact that both desired and undesired courses of interaction are tackled is due to the openness requirement. In this respect, not only positive expectations, but also negative expectations, are supported by the language. A positive expectation is used to express that a certain event Ev is Expected to happen at a given time T , and is represented by E(Ev, T ) Conversely, if event Ev is Expected Not to happen (i.e., is forbidden) at time T , then a negative expectation is employed: EN(Ev, T ) As for happened events, expectations can be completely specified or not. The possibility of leaving some of their parts variable is of great importance. Indeed, they could refer to events which have not yet occurred, and it is therefore unreasonable to assume that all their parts can be fixed a-priori. For example, in the context of a service choreography, an expectation stating that service s1 is waiting for a query message from some other service, demands to leave the sender of the event, as well as the actual occurrence time, unspecified: E(msg(Sender, s1 , query), Tq ). However, it is as much important to provide the ability of placing requirements on expectations, in order to restrict the
84
4 The CLIMB Rule-Based Language
range of variables. For example, the aforementioned expectation could be restricted to express that the query message is expected to be received from a service playing the role of customer, or it is expected to happen before a certain deadline. Technically, this is again done by means of CLP constraints and Prolog predicates. Positive and negative expectations differ in the quantification applied to the involved variables. Quantification strictly resembles the intuitive characterization of expectations: • a positive expectation predicates on the existence of at least one corresponding event occurrence, and it is therefore existentially quantified; • a negative expectation forbids the presence of any possible corresponding event occurrence, and it is therefore universally quantified. The following example clarifies this difference, grounding the discussion on some concrete cases. Example 4.2.2 (Requirements on expectations). A business manager working for a loan company wants to specify that: • someone must start to handle the loan l 01 2008 by the end of February 2008; • first-level employees cannot handle loans involving an amount greater than 1K e. Being workers autonomous, these requirements cannot be enforced, but they can be instead formulated as expectations placed on employees. In particular, the first requirement is a positive expectation, whereas the second one is a negative expectation: they respectively represent a desired and undesired situation. Following the approach of Example 4.2.1, we assume that an event concerning the handling of a loan is represented by event(T ype, handle loan, O, Id), where T ype is the event type (start or complete), O is the worker who handles the loan and Id is the loan identifier. Furthermore, we use the Prolog predicate price(Id, P ) to specify that the loan identified by Id is of an amount P , and predicate level(O, L) to state that employee O belongs to level L. Under these assumptions, we the first statement can be formalized by means of the following positive expectation: E(event(start, handle loan, O,l 01 2008), T ) ∧ T ≤ 13966 The expectation states that there must exist a worker O and a time T ≤ 13966 at which O starts to handle the loan l 01 2008. Indeed, O and T are existentially quantified. We can express the second statement with the following negative expectation:
4.2 The CLIMB Language
85
EN(event(T ype, handle loan, O, Id), T ) ∧ level(O, 1) ∧ price(Id, P ) ∧ P > 106 The expectation states that it should never happen that a first-level employee O is responsible of an event related to loans of more than 1K e. In other words, all loans involving an amount of at least 1K e cannot never be managed by first-level employees. In this respect, T ype and T are universally quantified over their whole domains, O is universally quantified over the domain of firstlevel employees, and Id is universally quantified on the domain of identifiers representing loans of at least 1K e). 4.2.4 Integrity Constraints The combination of happened events and expectations is the core of the CLIMB language, which supports the modeler in the intuitive characterization of interaction models in terms of rules following the form: “if e1 happened, then e2 is expected (not) to happen”. They relate the achievement of a given state of affairs, represented by means of happened events, with the expected or forbidden behavior towards a correct evolution of interaction. In the SCIFF setting, these rules are called (social) integrity constraints, because they constrain the courses of interaction so as to ensure their integrity and compliance with interaction protocols, and because such interaction protocols are specified adopting a global viewpoint, i.e., at the social level of the MAS. Similarly, in CLIMB they are used to express the overall “interaction contract”, composed by all the business constraints that must be respected by the interacting entities. Integrity constraints are represented as rules of the form Body → Head. Their syntax has a fragment common to all the three variants of SCIFF (CLIMB, SCIFF-lite and full SCIFF – see Fig. 4.1, p. 78). The EBNF grammar of such a common part is reported in Table 4.1, where the non-terminal symbols of Atom, T erm, V ariable and N umber have the same structure as in LP and CLP, while “not” denotes Negation As Failure (NAF) [77]. Roughly speaking, the grammar states that the body of each integrity constraint is a conjunction of BConjunct symbols, whereas the head is a disjunction of conjunctions of HConjunct symbols. Thus, an integrity constraint follows the structure
BConjuncti → HConjunctj,k i
j
k
The BConjunct and HConjunct non-terminal symbols, which constitute the two basic elements of integrity constraints, are instead defined in different ways by the three SCIFF variants. In particular, the CLIMB language defines integrity constraints as Body → Head rules where:
86
4 The CLIMB Rule-Based Language
Table 4.1. Common syntax of SCIFF integrity constraints; the definition of the BConjunct and HConjunct non-terminal symbols is deferred to each variant of the language (CLIMB, SCIFF-lite, full SCIFF) IC ::= {IC} IC ::= Body “ → ” Head “.” ::= ::= ::= ::= ::=
“true” | BConjunction BConjunct { “ ∧ ” BConjunct } “⊥” | HDisjunction HDisjunct { “ ∨ ” HDisjunct } HConjunct { “ ∧ ” HConjunct }
HEvent ::= Expectation ::= ExpT ype ::= Event ::= T ime ::= Literal ::=
“H(” Event “, ” T ime “)” ExpT ype “(” Event “, ” T ime “)” “E” | “EN” T erm N umber | V ariable [“ not ”]Atom
Body BConjunction Head HDisjunction HDisjunct
Table 4.2. CLIMB specialization of the integrity constraints syntax reported in Table 4.1 BConjunct ::= HEvent | Literal HConjunct ::= Expectation | Literal
• Body contains (a conjunction of) happened events, together with constraints on their variables, as well as Prolog predicates; • Head contains (a disjunction of conjunctions of) positive and negative expectations, together with constraints and Prolog predicates, applied on their variables and/or on variables contained in the Body. The completion of the general grammar, following these guidelines, is reported in Table 4.2. Each CLIMB rule formalizes a business constraint affecting a specific behavioral aspect of the system. The set of all integrity constraints (which will be usually denoted by IC) represents the complete regulatory interaction model of the system. The following example illustrates three different kinds of business constraints, that can be seamlessly described in CLIMB. Example 4.2.3 (Integrity constraints). Let us consider the following business constraints: (Br1) The person who takes the final decision about the acceptance or rejection of a paper cannot review that paper. (Br2) If a customer has closed an order and the shop has consequently accepted it, then the customer is bound to execute the corresponding payment.
4.2 The CLIMB Language
87
(Br3) If a premium customer pays for an order by credit card, then the seller should answer within 10 time units by delivering a corresponding receipt, or by communicating a payment failure. We adopt an atomic model for activities, i.e., map their execution to single events. Sentence (Br1) is an example of four eyes principle, which states that two different activities cannot be executed by the same person. It can be represented by means of the following CLIMB integrity constraint: H(emit decision(P erson, P aper, Decision), Te) →EN(review(P erson, P aper), Tr ).
(Br1-CLIMB)
It is worth noting that the P erson and P aper variables are shared between the negative expectation and the happened event, while execution times are not; therefore, the rule expresses that every time a person takes a decision concerning a paper, then that person cannot never review the same paper. Sentence (Br2) describes a rules which is triggered only when two different events (order closing and order acceptance) occur in the specified order; only if such a state of affairs is reached, the payment is expected: H(close order(Customer, Shop, Order), Tc ) ∧ H(accept order(Shop, Customer, Order), Ta ) ∧ Ta > Tc
(Br2-CLIMB)
→E(pay(Customer, Shop, Order, M ethod), Tp ) ∧ Tp > Ta . The CLP constraint Ta > Tc is used to identify a “legal” ordering among the happened events: the payment expectation is placed only if the shop has accepted an order after that the customer has closed it. If the ordering is not respected, then something was probably wrong, and the expectation about the payment is not enforced. The second constraint (Tp > Ta ) is instead used to identify the time range inside which the customer is bound to pay when the order has been closed and then accepted. In particular, the customer must pay after both the events in the body have already occurred. Sentence (Br3) is an example of disjunctive rule: it specifies that when a certain event happen, so that a corresponding requirement is satisfied (the customer is a premium one), one among two possible behaviors is expected. This can be captured in CLIMB by employing a disjunction in the head of the rule:
88
4 The CLIMB Rule-Based Language
H(pay(Customer, Shop, Order, credit card), Tp ) ∧ premium customer(Customer, Shop) →E(deliver(Shop, Customer, receipt(Order, Inf o)), Td ) ∧ Td > Tp ∧ Td < Tp + 10 ∨E(tell(Seller, Customer, f ailure, Reason), Tf )
(Br3-CLIMB)
∧ Tf > Tp ∧ Tf < Tp + 10. The concept of “being a premium customer” is formalized by means of the premium customer/2 Prolog predicate, assuming that premium customer(C, S) is true if and only if shop S considers customer C as a premium one. To express mutual exclusion between the receipt delivery and the failure communication, we could also add a second rule like H(deliver(Seller, Customer, receipt(Item, Inf o)), Td) →EN(tell(Seller, Customer, f ailure, Reason), Tf ). and viceversa. An interesting aspect of sentence (Br3) is the presence of a deadline, i.e., of a maximum time delay by which an event (the delivery of a receipt or the communication of a failure) is expected to occur. Deadlines and other quantitative time constraints are dealt with by imposing CLP constraints on time variables. For example, the fact that a receipt must be delivered no later than 10 time units after the payment is rephrased by stating that the delivery time must be lower than the payment time plus 10 time units. Integrity constraints are operationally interpreted in a forward, reactive manner. The event occurrences characterizing the evolution of an instance match with the happened events contained in the body of integrity constraints, binding their variables to actual values. When the entire body of an integrity constraint becomes true, then the integrity constraint triggers, and the head must also be true. As we will see, this leads to the generation of the expectations contained in the head; if the head is a disjunction, a choice point is opened. Variables contained in the body of integrity constraints are universally quantified with scope the entire integrity constraint: in this way, each integrity constraint is instantiated every time an event matching with a part of its body happens, and it triggers for any possible actual configuration making its body true. Example 4.2.4 (Triggering of integrity constraints). Let us consider the integrity constraint (Br2-CLIMB) of Example 4.2.3 and the following integrity constraint, which formalizes that a customer has the possibility to close at
4.2 The CLIMB Language
89
most one order by the same shop5 : H(close order(Customer, Shop, OrderA ), Tc ) →EN(close order(Customer, Shop, OrderB ), Tc2 )
(Br4-CLIMB)
∧ Tc2 = Tc . Let us now consider the following execution trace, and discuss how it triggers rules (Br2-CLIMB) and (Br4-CLIMB). (h1 ) H(close order(alice, bookShop, order 1), 2). (h2 ) H(accept order(bookShop, alice, order 1), 3). (h3 ) H(accept order(bookShop, lewis, order 2), 5). (h4 ) H(close order(lewis, bookShp, order 2), 8). (h5 ) H(close order(lewis, bookShop, order 2), 13). (h6 ) H(accept order(bookShop, lewis, order 2), 21). Being the body of integrity constraints universally quantified with scope the entire rule, every time a group of event occurrences makes its body true, then the rule triggers, generating the expectations contained in the head. In this case: • (h1 ) and (h2 ) unify with the two happened events contained in the body of (Br2-CLIMB), under the substitutions Customer/ alice, Shop/bookShop, Order/order 1, Tc /2 and Ta /3. Since 3 > 2, the temporal constraint contained in the body is evaluated to true by the CLP solver, and thus the following actual expectation is generated: E(pay(alice, bookShop, order 1, M ethod), T1 ) ∧ T1 > 3 The variables contained in the expectation, namely M ethod and T1 , are existentially quantified, and therefore the expectation means that alice is expected to eventually pay bookShop for order 1, at a time greater than 3 and by freely choosing a payment method. • (h4 ) unifies with the first happened event contained in the body of (Br2-CLIMB), with substitution Shop/bookShp; the substitution also propagates itself to the second happened event (the two events share the same variable), but the execution trace does not contain any order acceptance executed by a shop called bookShp. Therefore, this rule’s instance will not trigger. • (h3 ) and (h5 ) unify with the two happened events contained in the body of (Br2-CLIMB), but no triggering occurs, because the two substitutions Tc /5 and Ta /3 violate constraint Ta > Tc (the ordering of the actual happened events is the inverse of the ordering contained in the rule). 5
The Tc2 = Tc temporal constraint is needed to state that the two close order activities are not the same. Otherwise, the negative expectation would prohibit also the event that matched with the body of the integrity constraint, leading to an unintened violation.
90
4 The CLIMB Rule-Based Language
• (h5 ) and (h6 ) unify with the two happened events contained in the body of (Br2-CLIMB), satisfying the ordering constraint as well. The following expectation is then generated: E(pay(lewis, bookShop, order 2, M ethod), T2 ) ∧ T2 > 21 • each one of (h1 ), (h4 ) and (h5 ) matches with the body of (Br4-CLIMB), leading respectively to the generation of the following negative expectations: EN(close order(alice, bookShop, ), T3 ) ∧ T3 = 2 EN(close order(alice, bookShp, ), T4 ) ∧ T4 = 8 EN(close order(alice, bookShop, ), T5 ) ∧ T5 = 13 4.2.5 The Static Knowledge Base As far as now, we have focused on the dynamics of an EBS, which is captured in CLIMB by means of integrity constraints relating event occurrences with expectations. However, there is a strong intertwining between such dynamic aspects and the static domain knowledge, i.e., the pieces of information that will not change during the course of interaction. This latter background knowledge covers both extensional and intensional informations. Extensional (or assertional) knowledge is specific to the individuals of the domain of discourse, and explicitly captures all the known elementary facts characterizing the system. Examples of extensional knowledge are the fact that Alice is a first-level employee, or that item i 112 358 costs 13 e. Intensional knowledge is instead related to the elicitation of definitional rules [204], which provide terminological declarations of the implicit properties characterizing business concerns and domain concepts, and enabling the derivation of new knowledge starting from the actual assertional informations. E.g., a computation rule, used to determine the total price of an order starting from its composing items and taking into account taxes, is a special kind of definitional rule. Definitional rules and explicit facts are relevant during the evaluation of behavioral business constraints. In the specific case of CLIMB, they are used to provide a definition to each Prolog predicate recalled in the integrity constraints. Some concrete cases have been discussed in Examples 4.2.3 and 4.2.2, where evaluating if a customer is a premium one, and obtaining the price of an order or the status level of an employee, have been delegated to Prolog predicates. In order to characterize the static domain knowledge, i.e., to define Prolog predicates, CLIMB introduces a Prolog knowledge base (that will be usually identified by KB hereafter). Inside KB, the modeler can formalize all the background knowledge about the system, complementing integrity constraints with roles descriptions, relationships between business objects, complex conditions and criterions involving data, databases, and so on.
4.2 The CLIMB Language
91
Table 4.3. Common syntax of a SCIFF knowledge base; CBAtom is a non-terminal symbol whose definition depends on the chosen variant (CLIMB, SCIFF-lite, full SCIFF) KB Clause CBody CHead
::= ::= ::= ::=
{Clause} CHead [“ ← ” CBody] “.” CBAtom {“ ∧ ”CBAtom} Atom
Table 4.4. CLIMB specialization of the knowledge base syntax reported in Table 4.3 CBAtom ::= Literal Literal ::= [“ not ”]Atom
As for integrity constraints, the syntax of a CLIMB knowledge base is a subset of the SCIFF one. According to the common syntax, in all the three variants of SCIFF, KB is a logic program, i.e., a set of clauses. Table 4.3 reports such a common syntax, where Atom has the same form as in LP. The three variants of SCIFF provide different possibilities in the body of clauses, hence the CBAtom non-terminal symbol is left unspecified in the common syntax. In the specific CLIMB setting, the elements constituting the body of clauses are simply literals. This means that happened events and expectations cannot be employed in the knowledge base. The syntax is specified in Table 4.4. We illustrate the potentialities provided by a knowledge base concerning the specification of the static background knowledge, by means of the following example. Example 4.2.5 (A knowledge base modeling the roles in a company). Let us consider the characterization of the concept of level associated to each employee inside a company. This concept has been recalled in Examples 4.2.1 and 4.2.2; now we focus on its definition. The company states that: • each employee can play different roles, but has a unique “primary” role, used to determine her level; • roles are organized in a hierarchy; • the level of a role is the maximum depth of the role inside the hierarchy, starting from the leaves. This kind of knowledge is static: it does not depend on the dynamics of the system, but only on its structural organization. Therefore, it can be suitably modeled by means of a knowledge base. This knowledge base is typically constituted by two parts: • the formalization of the criterion used to evaluate the level of an employee (intensional part);
92
4 The CLIMB Rule-Based Language
supervisor
level 3
technical leader
analyst
level 2
secretary
level 1
programmer
Fig. 4.3. Hierarchy of roles
• the database of all employees together with their corresponding roles and primary roles (extensional part). We assume that role(E, R) and primary role(E, P R) respectively identify the role(s) R and the primary role P R played by employee E. Furthermore, we model the hierarchy of roles with predicate sub(R, SubRoles), which identifies the list SubRoles of roles that are children of role R. Leaf roles do not have children. Under this assumptions, the intensional knowledge defining the concept of level, where level(E, L) states that L is the level of E, can be expressed in a simple and compact way: level(E, L) ← r level(R, L) ←
primary role(E, P R) ∧ r level(P R, L). get subroles(R, C) ∧ r levels(C, Levels)
get subroles(R, C) ←
∧ max(Lmax , Levels) ∧ L is Lmax + 1. sub(R, C).
get subroles(R, []) ←
not(sub(R, C)).
r levels([R|Rs], [L|Ls]) ← r levels([], [0]).
r level(R, L) ∧ r levels(Rs, Ls).
where max(M, L) is true if and only if M is the maximum element of list L.A possible extensional knowledge base could be sub(supervisor, [technical leader, secretary]). sub(technical leader, [programmer, analyst]). primary role(alice, programmer). primary role(hatter, technical leader). primary role(lewis, supervisor). role(lewis, analyst).
4.2 The CLIMB Language
93
Table 4.5. SCIFF-lite specialization of the syntax reported in Tables 4.1 and 4.3 HConjunct ::= HEvent | Expectation | Literal BConjunct ::= HEvent | Expectation | Literal CBAtom ::= HEvent | Expectation | Literal
A graphical representation of the extensional knowledge base is provided in Fig. 4.3. According to the whole knowledge base (composed by the union of the intensional and extensional ones), the level of Lewis is 3, the level of Hatter is 2, and the level of Alice is 1. The clauses of a knowledge base are operationally treated in a backward, goal-oriented manner, recursively reducing goals to sub-goals until no further reduction is possible. This treatment comes from the procedural interpretation of Horn clauses by Kowalski [143]. In particular, Kowalski was the first author who proposed to interpret a clause H ← B1 ∧ . . . ∧ Bn as a procedure of the kind “to show (solve) H, show (solve) B1 and . . . and Bn ”. More specifically, Prolog adopts the SLD(NF) resolution [143, 78, 18] as the basic backward inference rule to reason upon logic programs. Thanks to the integration between integrity constraints and logic programs provided by SCIFF, CLIMB exploits a reasoning paradigm that combines backward, goal-oriented reasoning with forward, reactive reasoning [8]: two aspects that are usually treated separately from each other. In particular, forward reasoning is used to react to occurring events, matching them against integrity constraints and handling the generation of expectations, while each time a Prolog clause is encountered, it is resolved following a backward, goaloriented strategy. 4.2.6 SCIFF-lite and Composite Events As depicted in Fig. 4.1 – p. 78), CLIMB is a subset of more expressive languages, namely SCIFF-lite and SCIFF in order of expressiveness. Here we introduce how the syntax of CLIMB is extended by SCIFF-lite. The syntax of full SCIFF is outside of the scope of this book; the interested reader may refer to [8, 58]. From the syntactic point of view, SCIFF-lite provides three extensions to the CLIMB language: • the head of integrity constraints can contain happened events; • the body of integrity constraints can contain expectations; • the definition of clauses in the knowledge base can contain happened events and expectations. The extended syntax is reported in Table 4.5.
94
4 The CLIMB Rule-Based Language
Happened events contained in the head of integrity constraints represent fictitious, internal events that are generated by rules themselves; in this way, the achievement of complex state of affairs, composed by a plethora of happened events, can be aggregated into a single composite event, as it is called in the Complex Event Processing (CEP) field [156]. Indeed, composite events are complex events that do not concretely take place during the execution, but that are instead determined as a combination of concrete events, when certain circumstances are met. In this respect, they can ease the definition of rules, managing and combining rules belonging to different levels of abstraction inside a unique specification, as attested by the following example. Example 4.2.6 (Composite Events). Let us consider the following business constraints, involving a composite event: • if the device encounters a connection problem, then an alert must be communicated to the user immediately (i.e., at the following moment); • if the user enters wrong credentials or the cable status is “off” for two consecutive detections, then a connection problem is encountered. The only concrete events handled by the device are the acceptance/rejection of the credentials provided by the user, and the detection of the cable status. Under this assumption, the “connection problem encountered” event is not directly provided by the device, but rather must be inferred from the occurrence of the aforementioned base-level events. Therefore, it is not possible to directly model the first business constraint as a CLIMB rule. The only possibility is to replicate the rule, considering all the possible concrete situations leading to encountering a connection problem. Contrariwise, SCIFF-lite is able to bridge the gap between the actual event occurrences and the abstract occurrence of a connection problem. The first requirement can now be directly mapped onto an integrity constraint which includes the detection of a connection problem as a basic, concrete event: H(connection problem, Tp ) → E(generate alert, Ta ) ∧ Ta = Tp + 1. The temporal constraint Ta = Tp +1 is adopted to state that Tp corresponds to the first moment next to Ta . Then, further integrity constraints are modeled to express the second requirement, which is focused on the characterization of the “abstract” (composite) occurrence of a connection problem detection, in terms of a proper combination relating the base-level events. These integrity constraints will contain the occurrence of a problem detection in their head. The first rule links the detection of wrong credentials with the detection of a connection problem: H(wrong credentials, T ) → H(connection problem, T ). A second rule is instead employed to state that a problem is encountered if two consecutive “off” cable status are detected:
4.3 CLIMB Declarative Semantics
95
H(status(cable, of f ), T1) ∧ ∧
H(status(cable, of f ), T2) T2 > T1
→E(status(cable, S), T3) ∧ T3 > T1 ∧ T3 < T2 ∨EN(status(cable, S), T3) ∧ T3 > T1 ∧ T3 < T2 ∧ H(connection problem, T2 ).
The body of the integrity constraint contains the occurrence of two different “off” status detections. The head is instead modeled by considering the two possible alternatives that may arise: • The two “off” detections are not consecutive; this situation arises if another detection interposes between them, and does not imply any effect on the execution. • The two “off” detections are consecutive, and thus a problem is encountered; this situation happens if no further detection occurs between T1 and T2 , and leads to generate the composite connection problem event.
4.3 CLIMB Declarative Semantics The formal semantics of CLIMB is inherited from SCIFF [8]. It is based on abduction, one of the fundamental forms of inference identified by Peirce [130], and embedded in LP as Abuctive Logic Programming (ALP) [140]. An abductive logic program contains predicates without definition, i.e., whose truth cannot be proven, but only hypothesized. Hence, it is a reasoning paradigm especially suited to deal with incomplete knowledge; this feature perfectly fits with open and heterogeneous EBSs, in which unpredictable events and courses of interaction dynamically occur over time. As stated in [235]: The main idea of expectation-based semantics is that in open and dynamic MAS6 , a large share of information is unknown: either because it is not specified or it is private knowledge, or – especially in the case of events – because it has not (yet) been observed by anyone or is still to occur. To capture the unknown, the reasoning conducted to manipulate expectations is intrinsically hypothetical, and the social semantics of expectations is based on abductive reasoning. In this respect, expectations are interpreted as hypotheses (i.e., abducibles) on the possible correct evolutions of the system. Such hypotheses are dynamically generated during the execution of the system’s instances. Obviously, the 6
In their work [235], Torroni et al. focus on Multi-Agent interaction protocols, but their discussion seamlessly apply to the general case of interaction models and EBSs.
96
4 The CLIMB Rule-Based Language
generation of hypotheses should be driven by the actual event occurrences, and also take into account that, depending on the domain under study, some combinations of hypotheses should be forbidden, e.g., because they contradict each other. CLIMB rules come into play to accomplish this task: the are mapped onto ALP integrity constraints, whose purpose is to restrict the acceptable combinations of abduced predicates. The SCIFF declarative semantics does not only provide an abductive interpretation to expectations. It goes further, by establishing a formal relationship between expectations and happened events, through the notion of fulfillment. Indeed, alongside the generation of hypotheses about the correct courses of interaction as integrity constraints trigger, an hypotheses-confirmation step is performed, to check if the actual execution trace of the system effectively adheres to the generated expectations. This constitutes the basis for giving a formal account to the notion of compliance of an execution trace with a CLIMB interaction model, which in turn enables the characterization of the traces supported by it. In this section, we discuss all the issues, starting from the general setting of ALP, then showing how a CLIMB model can be interpreted as an abductive logic program, and how the notion of compliance can be formally accommodated inside the resulting framework. Finally, some interesting formal properties of CLIMB are investigated in the light of its abductive-based semantics. 4.3.1 Abduction The notion of abduction has been first introduced by Peirce [130], who differentiated the genus of reasoning into three species of inference: Deduction, an analytic process where a general rule is applied to a particular case, inferring a specific result; Induction, a synthetic process which infers the general rule from a particular case and result; Abduction, a synthetic process which infers a case (a possible explanation/cause) from a particular result and the rule. Abductive reasoning focuses on the probational adoption of a hypothesis as a possible explanation for observed facts (results), according to known laws [140]. It is a form of incorrect reasoning: as stated by Peirce, “we cannot say that we believe in the truth of the explanation, by only that it may be true” [130]. To show how abductive reasoning is exploited in our everyday life, a well-known introductory example [188, 140] is illustrated. Example 4.3.1 (Abductive reasoning). Let us consider the following set of sentences (constituting a theory), known by an agent: • If the grass is wet, then my shoes are wet as well. • If the last night it rained, then the grass is wet.
4.3 CLIMB Declarative Semantics
97
• If the sprinkler was on, then the grass is wet. The agent observes that her shoes are wet and she wants to know why. To find a (possible) answer, she performs abductive reasoning, trying to find a possible explanation for the observation, namely a set of hypotheses which, together with the known sentences, implies (i.e., justifies) the observation. To do so, she employs the first sentence, hypothesizing that the grass is wet; this hypothesis, in turn, can be explained in several ways, by exploiting the second and the third sentences: it could be the case that the sprinkler was on, that it rained, or both. Example 4.3.1 illustrates that abductive reasoning is suitable to deal with situations in which the agent’s knowledge is incomplete: the agent observes the world (i.e., the effects of unknown causes) and exploits her own knowledge to hypothesize possible explanations for what that observations. Obviously, not all explanations are satisfactory for the agent; for example, it would be desirable to explain an effect in terms of a cause and not in terms of another effect, i.e., to take into account only basic explanations [140]. In Example 4.3.1, “sprinkler was on” is a basic explanation, whereas “the grass is wet” is not. More generally, it is important to distinguish between sentences that are known to the agent (sentences whose truth value can be established by the agent) and sentences whose validity is unknown by the agent; the latter are hypothesized when trying to find (basic) explanations for what is being observed. For this reason, explanations are built upon sentences that must belong to a special domain-dependent class called abducibles. When performing abductive reasoning, an agent does not only exploit the observations and the known laws, but it also relies on rules stating whether the formulated explanations are acceptable. Such rules are employed to characterize the legal states of knowledge, rejecting unintended abductive explanations. In other words, they ensure the integrity of abductive explanations, and are therefore called integrity constraints 7 . Example 4.3.2 (Abductive reasoning with integrity constraints). Let us extend Example 4.3.1 with the following integrity constraint: • It is impossible that it rained last night if the moon was shining. This integrity constraint is a typical example of denial , because it explicitly reject an illegal state of knowledge. In particular, it forces the rejection of “it rained” as a possible explanation for having wet shoes, if the agent knows that the moon was shining. If it is the case, the only basic abductive explanation for having wet shoes is that the sprinkler was on.
7
The term is taken from the Database research field, in which integrity constraints are used to ensure the accuracy and consistency of data.
98
4 The CLIMB Rule-Based Language
4.3.2 Abductive Logic Programming Abuctive Logic Programming (ALP) is the extension of LP to support abduction [140]. Definition 4.3.1 (Abductive logic program). An abductive logic program is a triple T , A, IC where: • T is a logic program (representing the theory of the agent); • A is the set of abducible predicates8 ; • IC is a set of Integrity Constraints. In this setting, abductive explanations can be formalized as follows. Definition 4.3.2 (Abductive Explanation). Given an abductive logic program T , A, IC and a goal formula γ, the purpose of abduction is to find a set of ground atoms Δ ⊆ A which, together with T , entails9 γ and satisfies IC: T ∪ Δ |= γ T ∪ Δ |= IC In this case, Δ is an abductive explanation for γ. Example 4.3.3 (An abductive logic program). Let us formalize the situation introduced in Examples 4.3.1 and 4.3.2 as an abductive logic program T , A, IC. We consider the facts that sprinkler was on and that it rained as possible (partial) explanations, hence A = {sprinkler was on, rained last night}. The agent’s theory T is shoes are wet ← grass is wet. grass is wet ← rained last night. grass is wet ← sprinkler was on. whereas IC contains rained last night ∧ moon was shining → ⊥. If the agent observes that her shoes are wet (i.e., γ = shoes are wet), then three possible abductive explanations for T and γ can be placed: Δ1 = {rained last night} Δ2 = {sprinkler was on} Δ3 = {rained last night, sprinkler was on} 8
9
We will use the same symbol to indicate the set of abducible predicates and the set of all their ground instances. To distinguish abducible predicates from the non abducible ones, we will depict them in bold face. The notion of entailment depends on the declarative semantics associated with the theory.
4.3 CLIMB Declarative Semantics
99
Let us now suppose that someone informs the agent that the moon was shining last night. T is extended with moon was shining, and Δ1 becomes the only acceptable abductive explanation, because Δ2 and Δ3 do not entail the integrity anymore. Remark 4.3.1 (Goal reformulation). In the following, we will not consider an explicit goal but only the set of integrity constraints. If we are not interested in the computed answer substitution, this choice do not lead to loose generality: the goal formula γ can be represented as the integrity constraint true → γ, reformulating Def. 4.3.2 as T ∪ Δ |= IC ∪ {true → γ} 4.3.3 Formalizing Interaction Models and Their Executions As discussed in Sects. 4.2.4 and 4.2.5, CLIMB specifications are composed by two main parts: • a static part representing the background knowledge of the domain under study, modeled by means of a knowledge base; • a dynamic part, composed by a set of declarative rules (integrity constraints) used to constrain the behavior of the interacting entities when executing an instance of the system. A CLIMB specification can be then straightforwardly formalized in terms of an abductive logic programs, by considering expectations as abducibles, manipulated by hypothetical reasoning driven by the specified rules. A set of hypothesized expectations models the ideal behavior (or one of the possible ideal behaviors) that the system must exhibit in order to conform to its requirement, when a certain situation shows up. Definition 4.3.3 (CLIMB specification). A CLIMB specification is an abductive logic program KB, A, IC where: • KB is a (static) knowledge base obeying to the syntax shown in Table 4.4; • A = {E/2, EN/2} (expectations are abducibles); • IC is a set of CLIMB integrity constraints obeying to the syntax reported in Table 4.2. Since all CLIMB specifications have a fixed set of abducibles, A will be omitted. The following definition and remark explicitly stress that, due to their syntax, CLIMB integrity constraints do not contain expectations in their body. Definition 4.3.4 (Body and head of an integrity constraint). Given an integrity constraint IC, body(IC) and head(IC) respectively identify its body and head. Given an atom A, A ∈ body(IC) iff A is a conjunct of the body of IC and A ∈ head(IC) iff A is a conjunct of the head of IC.
100
4 The CLIMB Rule-Based Language
sd FIPA query-ref Protocol :Initiator
:Participant
query-ref alternative refuse
inform
Fig. 4.4. AUML diagram depicting a simplified version of the query-ref FIPA interaction protocol
For example, by considering the integrity constraint x1 ∧ x2 → y ∨ z1 ∧ z2 , x1 and x2 belong to its body, while y, z1 and z2 belong to its head. Remark 4.3.2 (Structure of CLIMB integrity constraints). Given a CLIMB specification KB, A, IC, no integrity constraint belonging to IC contains expectations in its body: ∀IC ∈ IC, ∀e ∈ U, ∀t ∈ T, E(e, t) ∈ / body(IC) ∧ EN(e, t) ∈ / body(IC) Example 4.3.4 (A CLIMB specification modeling the FIPA query-ref interaction protocol). Let us consider the CLIMB specification of a simplified version of the FIPA10 query-ref interaction protocol11 . As described in the FIPA specification [104], query-ref is the act of asking another agent to inform the requestor about the object identified by a given descriptor. In particular, the initiator agent requests the receiver to perform an inform act containing the object that corresponds to the descriptor; the receiver can return the requested information or refuse the request. The AUML [33] diagram of the protocol is shown in Fig. 4.4. The query-ref protocol can be suitably represented with the CLIMB specification Q = {(QRKB )}, {(QR1 ), (QR2 ), (QR3 )} where: • (QR1 ) specifies that when an initiator agent I sends a query-ref message to another agent P , then P is expected to answer by uttering an inform or refuse message. Exploiting the potentialities of CLIMB, we extend the specification by introducing a (parametric) deadline on the maximum time by which the answer is expected, and by allowing executions in which the answer is received before the request – the goal of the protocol is to obtain 10 11
Foundation for Intelligent Physical Agents, http://www.fipa.org The full version supports two different speech acts to start the protocol, and it foresees the possibility that the receiving agent does not understand the message or experiences an exception.
4.3 CLIMB Declarative Semantics
101
the information, not to over-constrain agents by accepting only interaction instances in which the information is provided after the request12 . H(tell(I, P, query-ref (Inf o)), Tq ) ∧ qr deadline(D) →E(tell(P, I, inf orm(Inf o, Answer)), Ti ) ∧ Ti < Tq + D ∨E(tell(P, I, ref use(Inf o)), Tr ) ∧ Tr < Tq + D.
(QR1 )
• (QR2 ) imposes mutual exclusion between the two answers, stating that if an agent P has accepted a query-ref from an agent I about the information Inf o, then P cannot send a refuse message for the same information to the same agent I 13 . H(tell(P, I, inf orm(Inf o, Answer)), Ti ) →EN(tell(P, I, ref use(Inf o)), Tr ).
(QR2 )
• (QR3 ) expects that the interaction protocol is started by some agent I. true → E(tell(P, I, query-ref (Inf o)), T ).
(QR3 )
• KB specifies the value of the deadline, i.e., contains a fact like qr deadline(10).
(QRKB )
Conforming to the terminology introduced in Sect. 2.1.1, in CLIMB a specific execution of the system under study is called instance, and it is formally identified by the CLIMB specification modeling the system and by the execution trace produced during the instance execution. Definition 4.3.5 (CLIMB Instance). Given a CLIMB specification S and a trace T , ST = S, T is the T -instance of S. 4.3.4 SCIFF-lite Specifications Beside syntactic differences, SCIFF-lite semantically extends CLIMB by supporting arbitrary sets of abducible predicates. The formal definition of SCIFFlite specifications is therefore similar to the one of CLIMB, but the abducible set is not restricted to contain only expectations. Definition 4.3.6 (SCIFF-lite specification). A SCIFF-lite specification is an abductive logic program KB, A, IC where: 12
13
To introduce that only consequent answers are acceptable, the rule must be simply modified by introducing a further temporal constraint on the involved expectations. Even if it is not apparent from the rule itself, it suffices for expressing “full” mutual exclusions between the two speech acts; see Example 4.4.1 on p. 110 for a proof.
102
4 The CLIMB Rule-Based Language
• A ⊇ {E/2, EN/2}; • KB and IC obey to the syntax shown in Table 4.5, with the additional condition that abducible predicates cannot be negated. The specification of arbitrary abducible predicates opens many possibilities to the modeler. For example, some happened events may be declared as abducibles: when they are inserted in the head of an integrity constraint, they are hypothesized (i.e., generated) as the constraint triggers. In this way, their occurrence is simulated, thus supporting the treatment of internal composite events as discussed in Sect. 4.2.614 . Since the abducible predicates can be freely fixed by the modeler, SCIFFlite’s integrity constraints can be also exploited to perform abductive reasoning in general. For example, a prescriptive rule may contain a predicate expressing a data-related condition, whose definition is however unknown. Think for example at service interaction: each service could expose its behavioral interface, representing an abstract, public version of its internal behavior. Behavioral interfaces do not expose the private knowledge of services, such as for example an internal definitional rule used to perform a choice. In SCIFFlite, such an incomplete knowledge can be seamlessly managed by declaring the predicate representing the internal choice as abducible, and carrying out hypothetical reasoning on it. 4.3.5 CLIMB Abductive Explanations The declarative semantics of CLIMB is given in two steps, 15 . First, being CLIMB specifications formalized by means of abductive logic programs, the abductive explanations of such programs must be characterized. Then, a second step, specifically related to the CLIMB language, consists in the formal characterization of the meaning of expectations, which in turn provides the basis upon which the notion of compliance is defined. Let us now focus on the first step. Definition 4.3.7 (Abductive explanation). Given a CLIMB specification S = KB, IC and a trace T , the abducible set Δ ⊆ {E/2, EN/2} is an abductive explanation for ST if and only if 14
Indeed, to properly make the formalization given in Example 4.2.6 working, truly supporting the generation of the connection problem event, H(connection problem, T ) must be declared as abducible. It is worth noting that when we say that H(connection problem, T ) is abducible, we are actually expressing that all its possible ground occurrences are abducible, i.e., A ⊇ {H(connection problem, t) | t ∈ T}
15
In the following, we will focus on CLIMB specifications, but the same notion of declarative semantics holds for SCIFF-lite specifications as well.
4.3 CLIMB Declarative Semantics
103
Comp (KB ∪ T ∪ Δ) ∪ CET ∪TX |= IC where Comp is the three-valued completion of a theory [147], CET stands for Clark Equational Theory [77] and TX is the constraint theory [135], parametrized by X . Fixing a CLP theory corresponds to instantiating the parameter X . Therefore, different structures (such as R or finite domains) can be chosen without affecting the notion of CLIMB abductive explanation. The symbol |= is interpreted in three valued logics, thus embedding the CLIMB abductive semantics into a three-valued model-theoretic semantics, as done, in a different context, by Fung and Kowalski [111] and by Denecker and De Schreye [89]. Three-valued logics are multi-valued logic systems in which there are three truth values: true, false and unknown. They are therefore particularly appropriate to deal with systems characterized by incomplete knowledge. This is the case of open and heterogeneous EBSs, in which unpredictable events dynamically occur over time, a large share of information is unknown and knowledge evolves over time. For example, let us consider a business constraint stating that “if a private medical examination is completed, the patient is obliged to pay for it within two days”. When such a constraint is applied to an instance of the system, there are many situations in which neither its truth nor its falsity can be determined. One of these situations comes about when the medical examination is completed: it is not possible to know whether the patient will satisfy the payment obligation until the payment is actually done or two days have passed. It is worth noting that if a set of integrity constraints is entailed, then each single constraint is entailed as well. The following remark starts from this trivial observation and establishes a link between an abductive explanation for a certain instance ST , and the T -instances obtained by considering only a sub-set of integrity constraints in S. Remark 4.3.3 (Abductive explanations and sub-specifications). If Δ is an abductive explanation for KB, ICT , then Δ is an abductive explanation also for KB, IC T , where IC ⊆ IC. The following example introduces some abducible sets, discussing whether they are suitable abductive explanations of a given CLIMB instance or not. Example 4.3.5 (Abductive explanations). Let us consider the CLIMB specification Q, described in Example 4.3.4, together with the execution trace T = { H(tell(alice, hatter, query-ref (loc(rabbit))), 5), H(tell(hatter, alice, ref use(loc(rabbit)), 10) } The abducible sets Δ0 = ∅ Δ1 = { E(tell(alice, hatter, query − ref (loc(rabbit))), 5) }
104
4 The CLIMB Rule-Based Language
are not abductive explanations for QT . In fact, they respectively contradict the integrity constraints (QR3 ) and (QR1 ): (QR3 ) states that a query-ref expectation must be included in each abductive explanation, while (QR1 ) states that whenever the trace contains a query-ref event (which is actually the case for T ), then a corresponding inform or refuse expectation must be hypothesized. Conversely, the abducible sets Δ3 = Δ1 ∪ { E(tell(hatter, alice, inf orm(loc(rabbit), garden)), 10), EN(tell(hatter, alice, ref use(loc(rabbit)), T ) } Δ4 = Δ1 ∪ { E(tell(lewis, alice, ref use(loc(rabbit)), 10) } Δ5 = Δ3 ∪ Δ4 are all abductive explanations for QT . It is worth noting that declarative semantics takes into account only ground specifications. Therefore, abducibles are always considered to be ground; when an abducible contains variables, it must be intrepreted as an abstract scheme for intensionally representing the set of all its ground versions. Such an extensional set is determined by grounding the variables, taking into account both their quantification and domain. For example, by relying on the dense-time structure (R, <), the negative expectation contained in Δ3 (Example 4.3.5) EN(tell(hatter, alice, ref use(loc(rabbit)), T ) is used to intensionally represent the set {EN(tell(hatter, alice, ref use(loc(rabbit)), t) | t ∈ R} (being T universally quantified), whereas E(tell(hatter, alice, inf orm(loc(rabbit), X), T ) ∧ T > 10 is a shortcut for representing a ground expectation e such that e ∈ {E(tell(hatter, alice, inf orm(loc(rabbit), r), t) | r ∈ U, t ∈ (10, ∞)} (being X and T existentially quantified). Let us consider a more complex example, in which variables are shared by a positive and a negative expectation E(a, T ) ∧ T ≥ 4 ∧ T < 7 ∧ EN(b, T ) By supposing that the chosen time structure is (N, <), such a conjunction of expectation is a shortcut for representing one of the following three sets: { E(a, 4), EN(b, 4) }
{ E(a, 5), EN(b, 5) }
{ E(a, 6), EN(b, 6) }
4.3 CLIMB Declarative Semantics
105
4.3.6 On the Formal Definition of Compliance In Sect. 4.3.5, we have provided a formal account to CLIMB abductive explanations. However, in the context CLIMB expectations are not simply abducible predicates, but they carry a specific, prescriptive meaning: a positive expectation states that some event is expected to happen, while a negative expectation states that some event occurrence is prohibited. Hence, expectations are strongly connected to the happened events composing the execution traces of the system: depending on the actual event occurrences contained in a trace, they become fulfilled or violated, leading to consequently certifying the trace as correct or not. The CLIMB declarative semantics must take care of formally capturing such an intended meaning, making clear and explicit the relationships between positive and negative expectations, and between expectations and happened events. The connection between positive and negative expectations is tackled by E-consistency, which basically states that they are conflicting concepts: the same event cannot be expected to happen and not to happen at the same time. Definition 4.3.8 (E-consistency). An abducible set Δ is E-consistent iff ∀e ∈ U and ∀t ∈ T: {E(e, t), EN(e, t)} Δ Example 4.3.6 ( E-consistency and intensional representations). Let us consider the abductive explanations of Example 4.3.5. Sets Δ3 and Δ4 are Econsistent, while Δ5 is not E-consistent, because the same refusal event is expected to happen and not to happen at time 10. Indeed, remember that EN(tell(hatter, alice, ref use(loc(rabbit)), T ) is used to intensionally represent the (infinite) set of negative expectations on all the possible ground times, including also T = 10. The intensional representation of expectations may sometimes cause confusion w.r.t. E-consistency. For example, the set { E(ev, T1 ) ∧ T1 ≥ 4 ∧ T1 ≤ 9, EN(ev, T2 ) ∧ T2 > 5 ∧ T2 < 8 } is E-consistent: being T1 existentially quantified, event if the two contrasting expectations overlap in time, it is sufficient that there exists at least one possible assignment of T1 , consistent with the CLP constraints, that is outside the scope of T2 . In particular, by adopting a discrete, integer time structure, the set intensionally represents one of the sets { E(ev, 4), EN(ev, 6), EN(ev, 7) }
(E-consistent)
{ E(ev, 5), EN(ev, 6), EN(ev, 7) }
(E-consistent)
{ E(ev, 6), EN(ev, 6), EN(ev, 7) }
(E-inconsistent)
{ E(ev, 7), EN(ev, 6), EN(ev, 7) }
(E-inconsistent)
{ E(ev, 8), EN(ev, 6), EN(ev, 7) }
(E-consistent)
{ E(ev, 9), EN(ev, 6), EN(ev, 7) }
(E-consistent)
106
4 The CLIMB Rule-Based Language E-inconsistency
E ev
[
(
EN ev 4
5
]
[
] (
9
4
5
) 6
7
8
6
7
[ )
]
8
9
Fig. 4.5. Interplay between CLP temporal constraints and E-consistency
Two of such sets are not E-consistent. The possible choices hence restrict to { E(ev, 4), EN(ev, 6), EN(ev, 7) } { E(ev, 5), EN(ev, 6), EN(ev, 7) } { E(ev, 8), EN(ev, 6), EN(ev, 7) } { E(ev, 9), EN(ev, 6), EN(ev, 7) }
Therefore, by taking into account E-consistency, the original set is equivalent to: { E(ev, T1 ) ∧ [(T1 ≥ 4 ∧ T1 ≤ 5) ∨ (T1 ≥ 8 ∧ T1 ≤ 9)], EN(ev, T2 ) ∧ T2 > 5 ∧ T2 < 8 } The graphical intuition is reported in Fig. 4.5. This kind of manipulation is operationally handled, in SCIFF, by the CLP solver itself. The relationship between expectations and happened events is captured by the notion of fulfillment, which formalizes the conditions determining whether an expectation is satisfied by a given CLIMB instance or not. In particular, it formalizes the following intended meaning: • positive expectations must have a corresponding matching event in the execution trace of the instance; • negative expectations must have no corresponding matching event in the execution trace of the instance. Definition 4.3.9 (Fulfillment). Given a CLIMB trace T and an abducible set Δ, Δ is T -fulfilled if and only if, ∀e ∈ U, ∀t ∈ T: E(e, t) ∈ Δ =⇒ H(e, t) ∈ T EN(e, t) ∈ Δ =⇒ H(e, t) ∈ /T By taking into account the abductive nature of expectations, fulfillment can be interpreted as a particular form of hypotheses confirmation: • Expectations are hypothesized according to the running instance of the system and the CLIMB specification; this leads to the formulation of expectations as abductive explanations, according to Def. 4.3.7.
4.3 CLIMB Declarative Semantics
107
• According to Def. 4.3.9, The execution trace may fulfill the generated expectations or not, confirming or disconfirming the formulated hypotheses. Fig. 4.6 provides a graphical intuition about how this two ways relationship is established by the declarative semantics of CLIMB. Expectations
Abductive explanations
CLIMB specification
Fulfillment
(partial) execution trace
Fig. 4.6. The two ways relationship between expectations and happened events, as established by the CLIMB declarative semantics
Given an abductive explanation Δ, fulfillment can be interpreted as a means for separating the legal/correct execution traces with respect to Δ from the wrong ones. A trace is correct if it satisfies all the expectations contained in Δ, while it is wrong if an expected event is omitted, or a forbidden event is present. In this light, the declarative semantics of CLIMB is able to formally capture the notion of compliance of an execution trace with a given CLIMB specification. Thanks to to fulfillment, it becomes possible to isolate, in the space of all execution traces, those that are supported by a specification. Definition 4.3.10 (Compliance). A trace T is compliant with a CLIMB specification S if and only if there exists an abducible set Δ such that: 1. Δ is an abductive explanation for ST ; 2. Δ is E-consistent; 3. Δ is T -fulfilled. If this is the case, we write compliantΔ (ST ) or simply compliant (ST ). Contrariwise, T is said to violate (or be noncompliant with) S, written ¬compliant (ST ).
108
4 The CLIMB Rule-Based Language
Example 4.3.7 (Compliance in CLIMB). Let us consider the CLIMB specification Q of Example 4.3.4. The execution trace T introduced in Example 4.3.5 is compliant with Q, because the expectations set Δ4 (also mentioned in that example) is an E-consistent and T -fulfilled abductive explanation for Q. The execution traces T2 = ∅ T3 = { H(tell(alice, hatter, query-ref (loc(rabbit))), 5), H(tell(hatter, alice, ref use(loc(rabbit)), 10), H(tell(hatter, alice, inf orm(loc(rabbit), garden)), 12) } T4 = { H(tell(alice, hatter, query-ref (loc(rabbit))), 5), H(tell(hatter, alice, inf orm(loc(rabbit), garden)), 20) } are instead noncompliant with Q. T2 is not compliant with Q due to rule (QR3 ), which states that each abductive explanation must contain a positive expectation about a queryref event. To be fulfilled, such an expectation should have a corresponding happened event in T2 , which however is empty. The expectation is therefore violated. T3 is not compliant with Q because hatter sends both a refuse and inform events concerning the same information loc(rabbit). Indeed, from the combination of rule (QR2 ) with the second happened event of T3 , it follows that each abductive explanation Δi for Q must contain the forbidding of a corresponding inform event: ∀Δi , Δi ⊇ { EN(tell(hatter, alice, inf orm(loc(rabbit), garden)), T ) } Since this negative expectation has a corresponding matching occurrence in T3 (with T /12), there does not exist a Δi which is T2 -fulfilled, and therefore Q is violated by T3 (in particular, T3 violates rule (QR2 )). T4 is not compliant with Q because hatter sends an inform response too late. In particular, T4 satisfies rule (QR3 ) and triggers rule (QR1 ), leading to hypothesize a positive expectation concerning one among the two foreseen answers. Abductive explanations must therefore contain an expectation e such that e ∈ {E(tell(hatter, alice, ref use(loc(rabbit))), T ) | T < 15} or e ∈ {E(tell(hatter, alice, inf orm(loc(rabbit)), L), T ) | T < 15 ∧ L ∈ U}. From the definition of fulfillment, e must have a corresponding matching event in T4 , but this is not the case: no refusal is contained in T4 , and the inform message by hatter after the expiration of the (actual) deadline of 15 time units. A graphical representation summarizing the compliance of the four traces with Q is shown in Fig. 4.7.
4.4 Formal Properties
109
Traces Herbrand base compliant with QR1
compliant with QR2
2
4 3
compliant with QR3
compliant with the query-ref protocol
Fig. 4.7. Compliance evaluation of the traces reported in Examples 4.3.5 and 4.3.7 with the FIPA query-ref protocol
4.4 Formal Properties Three interesting formal properties of SCIFF specifications are now introduced, namely equivalence, compositionality and replaceability of constraints modulo compliance. The main result following from these formal properties is that a certain class of SCIFF specifications, which is a superset of CLIMB, is compositional modulo compliance, which in turn implies the replaceability property. 4.4.1 Equivalence Modulo Compliance There are many different ways to characterize the same interaction model, i.e., to support the same set of execution traces. In other words, two specifications could differ concerning their syntactic forms and the corresponding abductive explanations, but, at the same time, they are equivalent from an “external” point of view: given an execution trace, they will always agree when assessing its compliance. Such specifications are said to be equivalent modulo compliance. Definition 4.4.1 (Equivalence modulo compliance in SCIFF). Given two SCIFF specifications S 1 and S 2 , S 1 is equivalent modulo compliance to c S 2 (S 1 ∼ S 2 ) if and only if:
∀T compliant(ST1 ) ⇐⇒ compliant(ST2 ) This notion of equivalence is important because it provides a means for individuating whether two SCIFF specifications isolate exactly the same set of legal executions, ensuring that one specification can be seamlessly replaced by the other without affecting compliance and support. When two specifications are equivalent modulo compliance, the “best” among the two can be seamlessly chosen by taking into account other aspects, such as readability
110
4 The CLIMB Rule-Based Language
or compactness of the integrity constraints, or impact on the underlying reasoning techniques (we will deeply discuss this issue in the second part of the book). Example 4.4.1 (Equivalence modulo compliance in the “not coexistence” case). Let us suppose that, in a given EBS, two events e1 and e2 cannot both occur within the same instance. To express that the two events cannot coexist, the modeler could rephrase the sentence as follows: if e1 occurs, then e2 must not occur, and if e2 occurs, then e1 must not occur. Starting from this form, a straightforward translation into CLIMB integrity constraints can be devised: H(e1 , Ta ) → EN(e2 , Tb ). H(e2 , Tc ) → EN(e1 , Td ).
(⊗12 ) (⊗21 )
However, it is interesting to note that these two rules are redundant for what regards compliance: it is sufficient to use only one of them to express the not coexistence between e1 and e2 . In particular, it can be easily proven that c S 1 = ∅, {(⊗12 )} ∼ S 2 = ∅, {(⊗21 )}
Let us suppose, by reductio ad absurdum, that there exists an execution trace T such that compliant(ST1 ) and ¬compliant(ST2 ). To violate S 2 , T must match with the body of (⊗21 ) and violate the expectation contained in its head, i.e., it must contain the occurrence of both e2 and e1 . However, rule (⊗21 ) states that if T contains e1 , then it cannot contain also e2 , and therefore it is impossible that T is compliant with S 1 . The opposite case can be proven in the same way. 4.4.2 Compositionality Modulo Compliance An interesting point is to exploit the notion of equivalence modulo compliance to know if and to what extent it is possible to split up a SCIFF specification S into two separated (sub)specifications S1 and S2 , so that the combination of S1 and S2 is equivalent to S. This possibility is called compositionality modulo compliance. Definition 4.4.2 (Compositionality). A SCIFF specification KB, A, IC is compositional (modulo compliance) if and only if ∀T , ∀IC 1 and ∀IC 2 s.t. IC = IC 1 ∪ IC 2 : compliant (KB, A, IC 1 T ) ∧compliant (KB, A, IC 2 T ) ⇐⇒ compliant (KB, A, ICT ) A compositional specification S can be partitioned into a set of simpler subspecifications S1 , . . . , Sn , each one covering a sub-set of its integrity constraints. Compliance can be then assessed separately by each sub-specification,
4.4 Formal Properties
111
then combining all the obtained results: a trace is compliant with S if and only if it is compliant with each Si . An important question now is the following: given an arbitrary SCIFF specification, is it possible to know whether it is compositional or not? The answer is: if the syntax of the specification has a particular form (called unchained hereafter), then the specification is compositional. After having delimited the class of unchained specifications, we prove this claim, showing that all CLIMB specifications are unchained, hence compositional. Definition 4.4.3 (unchained specification). A SCIFF specification S = KB, A, IC is unchained iff no integrity constraint in IC contains an abducible in its body: ∀IC ∈ IC, ∀βi ∈ body(IC), θ s.t. [βi ]θ ∈ A The intuition behind unchained specification is that the abducibles contained in their abductive explanations do not contribute to (partially) match with the body of their integrity constraints. Example 4.4.2 (Unchained specifications). Let us consider the integrity constraints H(external(e1 ), T1 ) → H(internal(e2 ), T2 ). H(internal(e2 ), T2 ) → E(external(e3 ), T3 ).
(4.1) (4.2)
H(external(e3 ), T3 ) → EN(external(e4 ), T4 ).
(4.3)
and the SCIFF-lite specifications S1 = ∅, {E/2, EN/2, H(internal(Ev), T )}, {(4.1), (4.2)} S2 = ∅, {E/2, EN/2, H(internal(Ev), T )}, {(4.1), (4.3)} S3 = ∅, {E/2, EN/2, H/2}, {(4.1), (4.3)} S2 is the only unchained specification among the three, because the body of its integrity constraints contains only occurrences of external events, while only internal event occurrences can be abduced. Let us now demonstrate that “being unchained” is a sufficient condition for guaranteeing compositionality. Theorem 4.4.1 (Compositionality of unchained specifications). If a SCIFF specification is unchained, then it is also compositional. Proof. Let us consider the specification S = KB, A, IC. By taking into account also abductive explanations, we rephrase compositionality as follows: for each execution trace T compliantΔ1 (ST1 ) ∧ compliantΔ2 (ST2 ) ⇔ compliantΔ (ST )
112
4 The CLIMB Rule-Based Language
where S 1 = KB, A, IC 1 , S 2 = KB, A, IC 2 and IC = IC 1 ∪ IC 2 . The proof then reduces to show that suitable Δ1 and Δ2 exist if and only if a suitable Δ exist. ⇐= One has to prove that if an abducible set Δ exists such that ST is compliant, then also two abducible sets Δ1 and Δ2 exist such that ST1 and ST2 are compliant. This is trivial, by choosing Δ1 = Δ2 = Δ. Indeed, Remark 4.3.3 states that Δ is an abductive explanation for any specification KB, A, IC where IC ⊆ IC, hence also for S1 and S2 . =⇒ One has to prove that if two abducible sets Δ1 and Δ2 exist such that ST1 and ST2 are compliant, then also an abducible set Δ exist such that ST is compliant. Let us consider Δ = Δ1 ∪Δ2 . The proof reduces to check that such Δ obeys the three properties required by the definition of compliance (Def. 4.3.10). Let us focus on each property separately: 1. Δ is an abductive explanation for ST . Let us suppose that this is not the case, i.e., Δ is not consistent with an constraint IC. Let us also suppose that IC ∈ IC 1 . Being Δ1 and Δ2 abductive explanations for S1 and S2 respectively, IC is not entailed by considering Δ only if body(IC) is not made true by Δ1 , but it is made true by Δ1 ∪ Δ2 : this would require Δ to contain also a disjunct of head(IC), which is not necessarily guaranteed by Δ. If Δ1 does not make body(IC) true, but Δ1 ∪ Δ2 does, then (at least) some part of body(IC) must unify with an abducible contained in Δ2 : ∃ε ∈ Δ2 , ∃β ∈ body(IC) s.t. [β]θ = ε. However, since Δ2 ⊆ A, the existence of such ε would contradict the hypotheses that S is unchained. 2. Δ is E-consistent. Assume, by absurdum, that Δ is not E-consistent; since Δ1 and Δ2 are both E-consistent, the only way to make Δ E-inconsistent would be to have an e ∈ U and a t ∈ T such that E(e, t) ∈ Δ1 and EN(e, t) ∈ Δ2 . But this is impossible, because both Δ1 and Δ2 are T fulfilled, and the T -fulfillment of Δ1 would require H(e, t) ∈ T , while the T -fulfillment of Δ2 would impose H(e, t) ∈ /T. 3. Δ is T -fulfilled, because each element of Δ belongs either to Δ1 or Δ2 , which are both T -fulfilled. Corollary 4.4.1 (CLIMB compositionality). CLIMB specifications are compositional. Proof. By looking at Remark 4.3.2 and at Defs. 4.3.3 and 4.4.3, it becomes apparent that CLIMB specifications are unchained: the body of each CLIMB integrity constraint can contain happened events, (defined) Prolog predicates, and CLP constraints, while only expectations can be hypothesized. Being CLIMB specifications unchained, Theorem 4.4.1 guarantees that they are also compositional.
4.4 Formal Properties
compositional specifications
113
SCIFF SCIFF-lite CLIMB
Fig. 4.8. The set of compositional specifications related to the three variants of SCIFF
CLIMB specifications are compositional because their integrity constraints can be triggered only by the happened events contained in the execution trace under study, and the predicates defined inside the knowledge base. The hypothesized expectations do not directly feed other rules, but are only checked against the trace to evaluate its compliance. Hence, each rule can be managed separately from the other rules. Fig. 4.8 shows how the set of compositional SCIFF specification is related to the three variants of SCIFF. 4.4.3 Replaceability of Rules Let us now imagine the following situation. Assume that we have already proven that a SCIFF specification containing one integrity constraint, say, IC1 , is equivalent modulo compliance to a specification containing another single integrity constraint IC2 , and the same knowledge base of the first specification (this is e.g. the case of Example 4.4.1). Formally, we have proven c S = KB, A, {IC2 }. If S is equivalent to S , that S = KB, A, {IC1 } ∼ then S can be seamlessly replace S to perform compliance checking, and vice-versa. But what happens if the original specification does not contain only IC1 but also other integrity constraints, i.e., S = KB, A, {IC1 } ∪ IC? Can we still guarantee equivalence modulo compliance by replacing IC1 with IC2 and keeping the other integrity constraints untouched? This is a very important question. Indeed, guaranteeing this replaceability would have a positive impact on the development of CLIMB interaction models: when a new, better (e.g., in terms of efficiency) formulation of the same rule is found, it could be directly used to replace the old version, without imposing to study the impact of this change on the rest of the specification. The following theorem shows that the replaceability of integrity constraints is guaranteed for compositional specifications: if S is compositional, then it c S = KB, A, {IC2 } ∪ IC. holds that S = KB, A, {IC1 } ∪ IC ∼ Theorem 4.4.2 (Replaceability of integrity constraints). Given four compositional SCIFF specifications • S 1 = KB, A, IC 1
114
4 The CLIMB Rule-Based Language
• S ∪1 = KB, A, IC ∪ IC 1 • S 2 = KB, A, IC 2 • S ∪2 = KB, A, IC ∪ IC 2 the following holds: c c S1 ∼ S 2 ⇒ S ∪1 ∼ S ∪2 c In other words, if one shows that S 1 ∼ S 2 , then the integrity constraints of ∪1 S can be modified by replacing IC 1 with IC 2 , without affecting compliance. c c Proof. Let us consider α = S 1 ∼ S 2 and β = S ∪1 ∼ S ∪2 . One has to prove c that α ⇒ β. From the definition of ∼ (Def. 4.4.1), we have
α ∀T compliant ST1 ⇔ compliant ST2
Being the specifications compositional, it holds that:
β ∀T compliant ST∪1 ⇔ compliant ST∪2 =
= ∀T compliant (ST ) ∧ compliant ST1
⇔ compliant (ST ) ∧ compliant ST2
(Def. 4.4.1) (Def. 4.4.2)
where S = KB, A, IC. Let us now separately discuss the case in which ST is compliant, and the case in which ST is noncompliant, showing that in both cases α ⇒ β is true. If ST is noncompliant (i.e., compliant(ST ) is f alse), then
β = ∀T f alse ∧ compliant ST1 ⇔ f alse ∧ compliant ST2 = ∀T f alse ⇔ f alse = true Therefore, α ⇒ β = α ⇒ true = true. If ST is compliant (i.e., compliant(ST ) is true), then
β = ∀T true ∧ compliant ST1 ⇔ true ∧ compliant ST2
= ∀T compliant ST1 ⇔ compliant ST2 = α Therefore, α ⇒ β = α ⇒ α = true.
5 Translating ConDec into CLIMB
In Chaps. 3 and 4, we have discussed two different approaches for the specification of interaction models: CLIMB and ConDec, together with their abductive and LTL-based semantics. On the one hand, the two approaches have complementary scopes and objectives: while ConDec adopts an intuitive graphical notation and pays particular attention to the usability by non-IT savvy, CLIMB is based on a rigorous, rule-based language, which gives a formal account to compliance, and is therefore apt to verification. On the other hand, the two approaches share the same, underlying paradigm: they both rely on the notion of (business) constraint as the fundamental abstraction to specify interaction following an open and declarative style of modeling. This chapter exploits these similarities to provide a complete formalization of ConDec in terms of CLIMB. Thus, it lays the foundation for the verification of ConDec models along their entire lifecycle, which will be matter of the next parts of this book. After having shown how all the ConDec constraints can be automatically translated into CLIMB, the discussion will focus on the formal relationship between CLIMB and propositional Linear Temporal Logic (LTL), which was the first logic-based framework used to provide an underlying semantics to ConDec. In particular, we will prove that the proposed CLIMB formalization is sound with the original LTL mapping, briefly recalling some general expressiveness results concerning the two logics. Throughout the chapter, we will always assume that ConDec activities are atomic, and can be therefore represented by means of a single, punctual event. The next chapter will exploit the expressiveness of the CLIMB language towards extending ConDec in several directions, including the support of non atomic activities.
M. Montali: Declarative Open Interaction Models, LNBIP 56, pp. 115–138, 2010. c Springer-Verlag Berlin Heidelberg 2010
116
5 Translating ConDec into CLIMB
5.1 Translation of a ConDec Model A ConDec model is translated into a CLIMB specification by mapping its mandatory constraints onto CLIMB integrity constraints, to the aim of drawing a correspondence between the notion of ConDec support and the one of CLIMB compliance. In this light, optional constraints are not part of the formalization, because they are not meant to effectively place constraints on the courses of interaction, but only as a tool thought for expressing preferable executions, alerting the user if they are not met. Chap. 14 will show how SCIFF-lite can be employed to deal with optional constraints. Since the basic version of ConDec does not support data, the knowledge base of the obtained CLIMB specifications will be always empty. Chap. 6 will introduce an extended version of ConDec, which provides data support and can therefore making use of the knowledge base to formalize the static domain knowledge. The translation of ConDec to CLIMB is encapsulated into a translation function called tCLIMB . Definition 5.1.1 (ConDec to CLIMB translation). tCLIMB is a function which translates a ConDec model CM A, Cm , Co into a CLIMB specification as follows: CM −→ tCLIMB (CM) = ∅, tIC (Cm )
tCLIMB :
where tIC is a function able to map a set of ConDec mandatory constraints onto a set of CLIMB integrity constraints. By looking at Def. 5.1.1, we will notice that only activities connected to a mandatory constraint will be contained in the obtained CLIMB specification, and that unconstrained activities will not appear at all. The openness of CLIMB guarantees that these activities can be executed an arbitrary number of times, without compromising compliance; this is in accordance with the intended ConDec semantics (see Chap. 3). Since an execution trace is supported by a ConDec model if and only if all its constraints are satisfied, the application of tIC to a set Cm of mandatory constraints corresponds to the union of the integrity constraints obtained from the application of tIC to each single mandatory ConDec constraint. Definition 5.1.2 (Translation of a ConDec constraints set). The application of tIC to a set of mandatory ConDec constraints Cm is defined as: tIC (Cm ) = tIC (Ci ) Ci | Ci ∈Cm
The syntactic connection established by tCLIMB between a ConDec model and a CLIMB specification has a semantical implication: as in the case of the LTL formalization (discussed in Sect. 3.7), the notion of ConDec support (Def. 3.2.2) can be put in correspondence with the notion of compliance in CLIMB (Def. 4.3.10).
5.3 Embedding a Qualitative Characterization of Time
117
Definition 5.1.3 (ConDec support in CLIMB). Given a CLIMB execution trace T and a ConDec model CM, T is supported by CM if and only if: compliant (tCLIMB (CM)T ) In Sect. 5.3.2, we will partially revise this definition, to account for the divergence between the representation of time in the two settings.
5.2 Translation of Events Each atomic ConDec activity can be straightforwardly represented as a CLIMB term; being atomic, its occurred, expected or forbidden execution is associated to a single time point, and can be therefore modeled by means of a single happened event or expectation. Definition 5.2.1 (Translation of an atomic ConDec activity). Given a ConDec atomic activity a, • H(exec(a), T ) states that a has been executed at time T ; • E(exec(a), T ) states that a is expected to be executed at time T ; • EN(exec(a), T ) states that a cannot be executed at time T .
5.3 Embedding a Qualitative Characterization of Time into a Quantitative Setting Before getting to the heart of the translation, we have to sort out the issue of the difference between the characterization of time by ConDec and CLIMB. Indeed, while ConDec (as well as LTL) rely on a point-based time structure with qualitative temporal relations, CLIMB adopts a point-based structure and exploits CLP to express both qualitative and quantitative temporal constraints. This difference has also repercussions on the execution traces of each framework: while LTL traces are linear sequences of event occurrences, in CLIMB each event occurrence is associated to a numerical value. How should then a qualitative characterization of time embedded in a quantitative setting? The following discussion tries to provide an answer to this fundamental question. 5.3.1 Temporal Contiguity In ConDec, time does not flow independently from the interaction, but is instead totally described by the event occurrences constituting the execution traces of the system. Each state of affairs is associated to an event occurrence, and is left entering in a successor state only in response to the occurrence of
118
5 Translating ConDec into CLIMB contiguous
instance of the system
qualitative approach
event
contiguous
event event
event
...
S0
S1
S2
quantitative approach
Fig. 5.1. Quantitative vs qualitative representation of event occurrences, and its implications on the notion of temporal contiguity
a further, immediately consequent event: as far as the execution is quiescent, time remains idle. This qualitative notion of temporal contiguity is formally captured in LTL by the (next time) temporal operator: e is true in a state t if and only if e is executed in the immediate successor state t + 1 (see Sect. 3.6.3). However, when it comes to the real world, interaction models are executed inside a business setting, where the widespread, internationally accepted chronometry of the Gregorian calendar and the International System of Units comes into play: interacting entities employ the everyday life abstractions of “months”, “days”, “seconds”, etc. These abstractions advocate a shift towards a quantitative characterization of time objects. Indeed, depending on the domain of discourse, different time granularities [100] are chosen by humans to express unanchored, absolute temporal data (e.g., 1983, September 18th 1996) and anchored, relative ones (e.g., 1 minute, 2 hours and a half). For example, a patient monitoring care-flow protocol requires to promptly react to critical conditions, which are detected by a frequent sampling of vita signals, in the order of milliseconds. Conversely, in a loan management process a time granularity of hours would suffice. In this light, it is unreasonable to assume that two contiguous event occurrences are still captured by relying on the “next time” paradigm, i.e., by requiring that they are separated by a single time unit: contiguity is a qualitative notion, while time units express a measure related to the flow of time. Contiguity can be instead suitably rephrased as: two event occurrences are contiguous if and only if no further event has occurred between them. Depending on the specific domain, a maximum time span could also be introduced, to determine whether two consecutive events are actually contiguous or too distant. Fig. 5.1 gives an intuition of the difference between a qualitative vs quantitative representation of event occurrences.
5.3 Embedding a Qualitative Characterization of Time
119
5.3.2 Compact Execution Traces The temporal contiguity issue gives rise to two question: • How can ConDec and LTL deal with real execution traces? • How is it possible to accommodate a qualitative characterization of time inside the quantitative setting of CLIMB? The first question is related to the ontological incompatibility between ConDec or LTL and the real execution traces of the systems considered in this book. Such an incompatibility is obviously overcome by means of an abstraction step. An LTL execution trace is not a “real” trace: it is a linear sequence of event occurrences that abstracts away from their quantitative time values, but maintains their right ordering. Maintaining the ordering is a necessary and sufficient condition for guaranteeing that qualitative time relationships can be applied on the abstract trace in place of the real one. Under the assumption that only qualitative time relationships are used (which is true for ConDec), the qualitative notion of temporal contiguity can be also adopted in the quantitative CLIMB setting without loss of generality, provided that also the CLIMB traces are subject to a suitable abstraction step before assessing their compliance. In particular, the abstraction step must guarantee that: • the ordering among event occurrences is maintained in the abstract trace; • if two event occurrences are contiguous in the real trace (i.e., no further event has occurred between them), then they are separated by a single time unit in the abstract trace. Let us first focus on the second requirement. It implicitly assumes that, in the abstract trace, time is marked only by the execution of events, and therefore it is not possible to have a time value, inside the trace, at which nothing happens. A CLIMB trace that meets this requirement is called compact. Definition 5.3.1 (Compact CLIMB execution trace). A CLIMB execution trace T is compact if and only if ∀ t ∈ [0, tmax ], ∃ H(e, t) ∈ T where tmax = max ({t | ∃ H(e, t) ∈ T }) Example 5.3.1 (Compactness of traces). Let us consider the following execution traces:
120
5 Translating ConDec into CLIMB
instance event of the system
event event
event
event
event event
event
...
... COMPACTION
qualitative approach
S0
S1
S2
quantitative approach
S0
S1
S2
0
1
2
Fig. 5.2. Compaction of an execution trace, towards the accommodation of qualitative temporal contiguity in a quantitative setting
T1 = { H(exec(choose item), 0), H(exec(choose item), 7), H(exec(pay), 15), H(exec(send receipt ), 30) } T2 = { H(exec(choose item), 0), H(exec(choose item), 1), H(exec(pay), 2), H(exec(send receipt ), 3) } T2 is compact, while T1 is not. Given a general CLIMB trace, modeling a “real” execution trace of the system, the desired abstraction step can then be concretely carried out by transforming it into a corresponding compact trace, such that ordering is maintained. Let us for example consider the execution trace of a Business Process, in which an item is chosen at time 5, and then the order is paid at time 10. This trace could be represented in CLIMB as T = {H(choose item, 5), H(pay, 10)}. Since between time 5 and 10 nothing happens, the choose item and pay occurrences are contiguous. The corresponding compact trace that maintains the ordering, and in which contiguous occurrences are separated by a single time unit, is Tcomp = { H(choose item, 0), H(pay, 1) }. In the general case, a compaction function can be devised, which takes a general CLIMB trace and produces a corresponding compact trace, that obeys to the aforementioned requirements. A graphical intuition of such a compaction function is provided in Fig. 5.2. Definition 5.3.2 (Compaction function). compact is a compaction function which translates an execution trace into a corresponding compact execution trace. It is defined as follows: compact : BH −→ BH T −→ Tcomp s.t. ∀ H(e, t), H(e, t ) ∈ Tcomp having t = {tbef ore | H(e∗ , tbef ore ), tbef ore < t} where BH is the Herbrand base built upon CLIMB happened events.
5.4 Translation of ConDec Constraints
121
Roughly speaking, the compaction function has the effect of substituting the time value associated to each event occurrence with a timestamp, which simply reflects the temporal “position” of the event occurrence inside the trace. E.g., by considering the execution traces shown in Example 5.3.1, it holds that T2 = compact (T1 ). Concurrent occurrences, i.e., occurrences associated to the same time value, are mapped onto the same timestamp. Given a ConDec model CM and a CLIMB execution trace T , the compaction function must be applied on T before assessing its compliance with the CLIMB representation of CM. Formally, Def. 5.1.3 must be revised as follows. Definition 5.3.3 (ConDec support in CLIMB under compaction). Given a CLIMB execution trace T and a ConDec model CM, T is supported by CM if and only if: compliant tCLIMB (CM)compact(T ) Obviously, the application of the compaction function hinders the modeling of metric temporal constraints, which is one of the most interesting features of CLIMB. Chap. 6 will discuss how ConDec can be extended with quantitative time aspects, getting back such an interesting feature. In this light, it will be necessary to recover the quantitative nature of CLIMB, and to revise the formalization proposed in this chapter accordingly.
5.4 Translation of ConDec Constraints tIC maps each ConDec constraint onto one or more CLIMB rules. Obviously, many possible different mappings, equivalent modulo compliance (see Def. 4.4.1) can be devised; here we try to preserve as much as possible the compactness and readability of the translation, to stress the similarities between the two approaches, and to show that the natural language description of each ConDec constraint can be easily represented in CLIMB. 5.4.1 Translation of Existence Constraints The result of the application of tIC on existence constraints is shown in Table 5.1. The absence n constraint expresses a prohibition of executing the targeted activity if it has already been executed a certain number of times, and is therefore formalized by exploiting a negative expectation. More specifically, the prohibition of executing activity a n + 1 times is m