The ContractLog Approach Towards Test-driven Verification and Validation of Rule Bases-A Homogeneous Integration of Test Cases and Integrity Constraints into Evolving Logic Programs and Rule Markup Languages (RuleML)

Rules are often being used as a (declarative) programming language to describe real-world decision logic such as business rules or contract/policy logic and create production systems upon (see e.g. RBSLA/ContractLog project hosted at Sourceforge). For this reason, it is important to support testing mechanisms, that can help rule programmers to determine the reliability of the results produced by their rule systems. Different approaches and methodologies to verification and validation (V&V) of rule-based systems have been proposed in the literature. Simple operational debugging approaches which instrument the rule system and explore its execution trace using e.g., spy and trace commands, place a huge cognitive load on the user, who needs to analyze each step of the inference process. On the other hand, typical heavy-weight validation methodologies such as waterfall-based approaches are often not suitable for rule-based systems, because they induce high costs of change and do not facilitate evolutionary modelling of rules with collaborations of different roles such as domain experts, system developers and knowledge engineers. In this paper, we adapt a recent trend in software engineering (SE), namely test driven development, to define self validating rule bases in the domain of logic programming, one of the most prominent and successful approaches in declarative rule based programming. We argue that test cases, an agile development methodology of Extreme Programming (XP), have a huge potential to be a successful tool for declarative verification and validation of LP-based rule bases. Test cases in combination with other XP related techniques such as test coverage measurement or evolving rule base refinements (by applying refactorings which improve the existing rule code, e.g., via removing inconsistencies, redundancy or missing knowledge without breaking its functionality) are suitable for typically frequently changing requirements and models of rule-based projects. Due to their inherent simplicity test cases better facilitate rule interchange in distributed applications and support different roles which are involved during the rule engineering process. The presence of test cases safeguards the life cycle of rules, e.g. enabling V&V at design time 2 Verification and Validation of Rule Bases but also dynamic testing of (transactional) self-updates of the extensional facts and intensional rules at runtime. Here the test cases are used as highly expressive integrity constraints, e.g. as post conditional tests in ECA(P) rules. If the post condition test in an ECAP rule fails the update action which adds or removes rules or facts from the KB is completely ”rolled back”. Another very interesting application domain of test cases for logic programs (LPs) is rule interchange. Test cases can be used to ensure correct execution of an interchanged LP in a target execution environment by validating the LP in the target inference engine with the attached and interchanged test cases. Meta annotations of the inference engine and the interchanged LPs disclosing the supported/intended semantics (e.g. well-founded semantics, stable model semantics etc.) of both the engine and the program together with appropriate test case variants for different semantics can be used to decide wether the interchanged rule base can be executed correctly in the target rule system. In case such annotations are not given, test cases with meta test programs (meta test rules) as assertions allow analyzing typical properties of LP based semantics. An adequate combination of meta tests for semantic properties uniquely characterizes a particular semantics and hence allows automatic determination of the semantics supported by the target inference engine. We show that test cases can be represented in a homogeneous LP representation language. The major advantage of this homogenous integration is, that the test cases and the test suites can be managed, maintained and executed within the same rule based environment, based on a welldefined declarative LP-related semantical basis. We further investigate, how the concept of test coverage from XP can be adapted to logic programming, in order to quantify the quality of test cases for V&V of a particular LP and use the novel notion of test coverage to give feedback and hints on how to optimize and refine the test cases and the rule code in an iterative process. We discuss the implementation of these ideas in the ContracLog KR and present concrete syntax and semantics of test cases for general LPs. We further extend this approach to support welladopted SE test frameworks like JUnit [23] and to facilitate a very tight integration of tests into existing IDEs such as Eclipse and tools such as Ant. In addition to the representation of test cases in a Prolog-like scripting syntax, we introduce a markup serialization as an extension to the emerging Semantic Web Rule Markup Language RuleML.

[1]  Adrian Paschke RBSLA A declarative Rule-based Service Level Agreement Language based on RuleML , 2005, International Conference on Computational Intelligence for Modelling, Control and Automation and International Conference on Intelligent Agents, Web Technologies and Internet Commerce (CIMCA-IAWTIC'06).

[2]  John S. Schlipf,et al.  Complexity and undecidability results for logic programming , 1995, Annals of Mathematics and Artificial Intelligence.

[3]  John S. Schlipf Formalizing a logic for logic programming , 2005, Annals of Mathematics and Artificial Intelligence.

[4]  Jorge Lobo,et al.  Generalized disjunctive well-founded semantics for logic programs , 2005, Annals of Mathematics and Artificial Intelligence.

[5]  Lee Naish,et al.  Most specific logic programs , 1990, Annals of Mathematics and Artificial Intelligence.

[6]  Edward H. Shortliffe,et al.  EMYCIN: A Knowledge Engineer’s Tool for Constructing Rule-Based Expert Systems , 2005 .

[7]  Edward H. Shortliffe,et al.  Completeness and Consistency in a Rule-Based System , 2005 .

[8]  Jens Dietrich,et al.  On the Test-Driven Development and Validation of Business Rules , 2005, ISTA.

[9]  Adrian Paschke,et al.  Typed Hybrid Description Logic Programs with Order-Sorted Semantic Web Type Systems based on OWL and RDFS , 2005 .

[10]  Lucas Layman Empirical investigation of the impact of extreme programming practices on software projects , 2004, OOPSLA '04.

[11]  Gerd Wagner,et al.  The Abstract Syntax of RuleML - Towards a General Web Rule Language Framework , 2004, IEEE/WIC/ACM International Conference on Web Intelligence (WI'04).

[12]  Jürgen Dix,et al.  Characterizations of the Disjunctive Well-founded Semantics: Confluent Calculi and Iterated Gcwa , 1997 .

[13]  Jorge Lobo,et al.  Weak Generalized Closed World Assumption , 1989, Journal of Automated Reasoning.

[14]  H. Lan,et al.  SWRL : A semantic Web rule language combining OWL and ruleML , 2004 .

[15]  Georg Gottlob,et al.  Complexity and expressive power of logic programming , 2001, CSUR.

[16]  Sergio Greco,et al.  Declarative semantics for active rules , 2001, Theory Pract. Log. Program..

[17]  autoepistemic Zogic Logic programming and negation : a survey , 2001 .

[18]  Michael J. Maher,et al.  Efficient defeasible reasoning systems , 2000, Proceedings 12th IEEE Internationals Conference on Tools with Artificial Intelligence. ICTAI 2000.

[19]  William C. Chu,et al.  A new approach to verify rule-based systems using Petri nets , 1999, Proceedings. Twenty-Third Annual International Computer Software and Applications Conference (Cat. No.99CB37032).

[20]  Victor Maojo,et al.  Computer Algebra Based Verification and Knowledge Extraction in RBS - Application to Medical Fitness Criteria , 1999, EUROVAV.

[21]  Kent L. Beck Extreme Programming , 1999, TOOLS.

[22]  Wei-Tek Tsai,et al.  Verification and Validation of Knowledge-Based Systems , 1999, IEEE Trans. Knowl. Data Eng..

[23]  Chih-Hung Wu,et al.  Knowledge Verification with an Enhanced High-Level Petri-Net Model , 1997, IEEE Expert.

[24]  Evgeny Dantsin,et al.  Complexity of Query Answering in Logic Databases with Complex Values , 1998 .

[25]  Mysore Ramaswamy,et al.  Using Directed Hypergraphs to Verity Rule-Based Expert Systems , 1997, IEEE Trans. Knowl. Data Eng..

[26]  Shan-Hwei Nienhuys-Cheng,et al.  Foundations of Inductive Logic Programming , 1997, Lecture Notes in Computer Science.

[27]  H. Herre,et al.  Contributions to the Theory of Nonmonotonic Inference Systems , 1997 .

[28]  Daniel E. O'Leary Verification of Uncertain Knowledge-Based Systems: An Empirical Verification Approach , 1996 .

[29]  Salvatore Ruggieri Decidability of Logic Program Semantics and Applications to Testing , 1996, PLILP.

[30]  Alberto Pettorossi,et al.  Rules and strategies for transforming functional and logic programs , 1996, CSUR.

[31]  Antonia Bertolino,et al.  Reducing and estimating the cost of test coverage criteria , 1996, Proceedings of IEEE 18th International Conference on Software Engineering.

[32]  Jürgen Dix,et al.  Semantics of Logic Programs: Their Intuitions and Formal Properties. An Overview , 1996, Logic, Action, and Information.

[33]  Grigoris Antoniou,et al.  Verification and correctness issues for nonmonotonic knowledge bases , 1997, Int. J. Intell. Syst..

[34]  Francesco Bergadano,et al.  Inductive Logic Programming: From Machine Learning to Software Engineering , 1995 .

[35]  John S. Schlipf,et al.  The Expressive Powers of the Logic Programming Semantics , 1995, J. Comput. Syst. Sci..

[36]  Jürgen Dix,et al.  A Classification Theory of Semantics of Normal Logic Programs: I. Strong Properties , 1995, Fundam. Informaticae.

[37]  Jürgen Dix,et al.  A Classification Theory of Semantics of Normal Logic Programs: II. Weak Properties , 1995, Fundam. Informaticae.

[38]  Trevor J. M. Bench-Capon,et al.  Techniques for the verification and validation of knowledge‐based systems: A survey based on the symbol/knowledge level distinction , 1995, Softw. Test. Verification Reliab..

[39]  Giorgio Levi,et al.  Efficient Detection of Incompleteness Errors in the Abstract Debugging of Logic Programs , 1995, AADEBUG.

[40]  Jürgen Dix,et al.  Partial Evaluation and Relevance for Approximations of Stable Semantics , 1994, ISMIS.

[41]  Sharma Chakravarthy,et al.  Composite Events for Active Databases: Semantics, Contexts and Detection , 1994, VLDB.

[42]  Thomas J. Ostrand,et al.  Experiments on the effectiveness of dataflow- and control-flow-based test adequacy criteria , 1994, Proceedings of 16th International Conference on Software Engineering.

[43]  Mireille Ducassé,et al.  Logic Programming Environments: Dynamic Program Analysis and Debugging , 1994, J. Log. Program..

[44]  José Júlio Alferes,et al.  Adding Closed World Assumptions to Well-Founded Semantics , 1994, Theor. Comput. Sci..

[45]  Saso Dzeroski,et al.  Inductive Logic Programming: Techniques and Applications , 1993 .

[46]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[47]  Alun D. Preece,et al.  Foundation and application of knowledge base verification , 1994, Int. J. Intell. Syst..

[48]  Jack Minker,et al.  An Overview of Nonmonotonic Reasoning and Logic Programming , 1993, J. Log. Program..

[49]  Pedro Meseguer,et al.  Expert system validation through knowledge base refinement , 1993, IJCAI.

[50]  Phyllis G. Frankl,et al.  An Experimental Comparison of the Effectiveness of Branch Testing and Data Flow Testing , 1993, IEEE Trans. Software Eng..

[51]  Alun D. Preece A New Approach to Detecting Missing Knowledge in Expert System Rule Bases , 1993, Int. J. Man Mach. Stud..

[52]  Trevor J. M. Bench-Capon,et al.  Maintenance of knowledge-based systems : theory, techniques and tools , 1993 .

[53]  Gregor von Bochmann,et al.  Control-flow based testing of Prolog programs , 1992, [1992] Proceedings Third International Symposium on Software Reliability Engineering.

[54]  Jennifer Widom,et al.  Behavior of database production rules: termination, confluence, and observable determinism , 1992, SIGMOD '92.

[55]  Jürgen Dix,et al.  A Framework for Representing and Characterizing Semantics of Logic Programs , 1992, KR.

[56]  Jürgen Dix,et al.  Classifying Semantics of Disjunctive Logic Programs , 1992, JICSLP.

[57]  Marc Ayel,et al.  Validation, verification and test of knowledge-based systems , 1991 .

[58]  Sukhamay Kundu,et al.  The Strong Semantics for Logic Programs , 1991, ISMIS.

[59]  Frank Pfenning,et al.  Unification and anti-unification in the calculus of constructions , 1991, [1991] Proceedings Sixth Annual IEEE Symposium on Logic in Computer Science.

[60]  Kenneth A. Ross,et al.  The well-founded semantics for general logic programs , 1991, JACM.

[61]  Victor W. Marek,et al.  Autoepistemic logic , 1991, JACM.

[62]  John C. Shepherdson Unsolvable Problems for SLDNF Resolution , 1991, J. Log. Program..

[63]  Phan Minh Dung,et al.  Negations as Hypotheses: An Abductive Foundation for Logic Programming , 1991, ICLP.

[64]  Carlo Zaniolo,et al.  Partial Models and Three-Valued Models in Logic Programs with Negation , 1991, LPNMR.

[65]  Yong Hu,et al.  Extended Well-Founded Model Semantics for General Logic Programs , 1991, ICLP.

[66]  Jorge Lobo,et al.  Generalized Well-founded Semantics for Logic Programs (Extended Abstract) , 1990, CADE.

[67]  Sarit Kraus,et al.  Nonmonotonic Reasoning, Preferential Models and Cumulative Logics , 1990, Artif. Intell..

[68]  Li-Yan Yuan,et al.  Three-valued formalization of logic programming: is it needed? , 1990, PODS '90.

[69]  Michael M. Gorlick,et al.  Mockingbird: A Logical Methodology for Testing , 1990, J. Log. Program..

[70]  R. A. Stachowitz,et al.  A report on the Expert Systems Validation Associate (EVA) , 1990 .

[71]  Kent L. Beck,et al.  Extreme programming explained - embrace change , 1990 .

[72]  Standard Glossary of Software Engineering Terminology , 1990 .

[73]  Robert S. Boyer,et al.  Computational Logic , 1990, ESPRIT Basic Research Series.

[74]  Allen Van Gelder,et al.  The Alternating Fixpoint of Logic Programs with Negation , 1993, J. Comput. Syst. Sci..

[75]  Derek L. Nazareth,et al.  Issues in the Verification of Knowledge in Rule-Based Systems , 1989, Int. J. Man Mach. Stud..

[76]  Virginia E. Barker,et al.  Expert systems for configuration at Digital: XCON and beyond , 1989, Commun. ACM.

[77]  Loïc Pottier,et al.  Generalisation de termes en theorie equationnelle. Cas associatif-commutatif , 1989 .

[78]  Adrian Walker,et al.  Towards a Theory of Declarative Knowledge , 1988, Foundations of Deductive Databases and Logic Programming..

[79]  David Makinson,et al.  General Theory of Cumulative Inference , 1988, NMR.

[80]  Stephen Muggleton,et al.  Machine Invention of First Order Predicates by Inverting Resolution , 1988, ML.

[81]  Marie-Christine Rousset,et al.  On the consistency of knowledge bases: the COVADIS system , 1988, Comput. Intell..

[82]  Christos H. Papadimitriou,et al.  Why not negation by fixpoint? , 1988, PODS '88.

[83]  V. Lifschitz,et al.  The Stable Model Semantics for Logic Programming , 1988, ICLP/SLP.

[84]  Teodor C. Przymusinski Perfect Model Semantics , 1988, ICLP/SLP.

[85]  Tim Niblett,et al.  A Study of Generalisation in Logic Programs , 1988, EWSL.

[86]  Kenneth Kunen,et al.  Negation in Logic Programming , 1987, J. Log. Program..

[87]  J. Paul Myers,et al.  The Path Prefix Software Testing Strategy , 1987, IEEE Transactions on Software Engineering.

[88]  J. Etchemendy The Concept of Logical Consequence , 1991 .

[89]  Laurent Fribourg,et al.  Test sets generation from algebraic specifications using logic programming , 1986, J. Syst. Softw..

[90]  Melvin Fitting,et al.  A Kripke-Kleene Semantics for Logic Programs , 1985, J. Log. Program..

[91]  Elaine J. Weyuker,et al.  Selecting Software Test Data Using Data Flow Information , 1985, IEEE Transactions on Software Engineering.

[92]  Jean H. Gallier,et al.  Linear-Time Algorithms for Testing the Satisfiability of Propositional Horn Formulae , 1984, J. Log. Program..

[93]  Simeon C. Ntafos,et al.  An Evaluation of Random Testing , 1984, IEEE Transactions on Software Engineering.

[94]  Carl H. Smith,et al.  Inductive Inference: Theory and Methods , 1983, CSUR.

[95]  John C. Cherniavsky,et al.  Validation, Verification, and Testing of Computer Software , 1982, CSUR.

[96]  Raymond Reiter,et al.  A Logic for Default Reasoning , 1987, Artif. Intell..

[97]  John McCarthy,et al.  Circumscription - A Form of Non-Monotonic Reasoning , 1980, Artif. Intell..

[98]  Anas N. Al-Rabadi,et al.  A comparison of modified reconstructability analysis and Ashenhurst‐Curtis decomposition of Boolean functions , 2004 .