Business Rules Engine in Java Introduction to JBoss Rules by Tom Sausner.

Slides:



Advertisements
Similar presentations
10/4/2003COMP 474/674 Fall 2003 Michelle Khalife1 Conflict Resolution in CLIPS COMP 474/674 FALL 2003 Michelle Khalifé.
Advertisements

Drools – Diabetes Phenotype Identification
1 01/12/2011Knowledge-Based Systems, Paula Matuszek Intro to CLIPS Paula Matuszek CSC 9010, Spring, 2011.
Chapter 12: Expert Systems Design Examples
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 2 Introduction to Database Development.
© 2002 Franz J. Kurfess Introduction 1 CPE/CSC 481: Knowledge-Based Systems Dr. Franz J. Kurfess Computer Science Department Cal Poly.
1 Chapter 9 Rules and Expert Systems. 2 Chapter 9 Contents (1) l Rules for Knowledge Representation l Rule Based Production Systems l Forward Chaining.
© C. Kemke Control 1 COMP 4200: Expert Systems Dr. Christel Kemke Department of Computer Science University of Manitoba.
Production Rules Rule-Based Systems. 2 Production Rules Specify what you should do or what you could conclude in different situations. Specify what you.
Chapter 9: Modular Design, Execution Control, and Rule Efficiency Expert Systems: Principles and Programming, Fourth Edition.
EXPERT SYSTEMS Part I.
CS 561, Session 25 1 Introduction to CLIPS Overview of CLIPS Facts Rules Rule firing Control techniques Example.
Lino Vázquez – PJAS at CERN GS-AIS-HR.  Declarative programming  Rules  Rules Engines  Rete algorithm  Why use rules engines  Drools.
Copyrighted material John Tullis 8/13/2015 page 1 Blaze Software John Tullis DePaul Instructor
Oakkar Fall The Need for Decision Engine Automate business processes Implement complex business decision logic Separation of rules and process Business.
Java Course Outline Kumar Harshit, USW. Course Description Teaches students to program using the Java programming language with the help of the Netbeans.
ERecruiter Expert System Presenters: Date. Agenda Review (Wei 2 mins) – Problem domain – Overview of the system Milestones (Jon S. 2 mins) – Timeboxes.
Application Express 4.1 New Features Hilary Farrell, Principal Member of Technical Staff, Oracle.
Evaluating Centralized, Hierarchical, and Networked Architectures for Rule Systems Benjamin Craig University of New Brunswick Faculty of Computer Science.
Katanosh Morovat.   This concept is a formal approach for identifying the rules that encapsulate the structure, constraint, and control of the operation.
Chapter 9: Modular Design, Execution Control, and Rule Efficiency Expert Systems: Principles and Programming, Fourth Edition.
1 Programming a Knowledge Based Application. 2 Overview.
February 3rd, 2010 KS BRMS. Discalaimer The GUI for the BRMS is currently not running, and was developed using a outdated framework so fixing is not an.
© 2007 by «Author»; made available under the EPL v1.0 | Date | Other Information, if necessary Eclipse SOA Tools Platform Project Eric Newcomer IONA Technologies.
Effectively Validate Query/Report: Strategy and Tool Steven Luo Sr. System Analyst Barnes & Noble Session id:
A Metadata Based Approach For Supporting Subsetting Queries Over Parallel HDF5 Datasets Vignesh Santhanagopalan Graduate Student Department Of CSE.
Auckland Connected Systems User Group November 19th 2009 Jeffrey Chilberto BizTalk Consultant
Querying Structured Text in an XML Database By Xuemei Luo.
Developing C/C++ applications with the Eclipse CDT David Gallardo.
Object-Oriented Programming (OOP). Implementing an OOD in Java Each class is stored in a separate file. All files must be stored in the same package.
DEPICT: DiscovEring Patterns and InteraCTions in databases A tool for testing data-intensive systems.
Selected Topics in Software Engineering - Distributed Software Development.
Drools Sofia Jonsson CADEC2006, Drools, Slide 2 Copyright 2006, Callista Enterprise AB Agenda Rule Engines - History/Background.
Jess: A Rule-Based Programming Environment Reporter: Yu Lun Kuo Date: April 10, 2006 Expert System.
TAKE – A Derivation Rule Compiler for Java Jens Dietrich, Massey University Jochen Hiller, TopLogic Bastian Schenke, BTU Cottbus.
MD – Object Model Domain eSales Checker Presentation Régis Elling 26 th October 2005.
Secure Active Network Prototypes Sandra Murphy TIS Labs at Network Associates March 16,1999.
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
Welcome to the Twin Cities BizTalk User Group July 2006.
1 Biometric Databases. 2 Overview Problems associated with Biometric databases Some practical solutions Some existing DBMS.
Eclipse 24-Apr-17.
PROGRAMMING LANGUAGES: PROLOG, CLOJURE, F# Jared Wheeler.
1 Knowledge Based Systems (CM0377) Lecture 10 (Last modified 19th March 2001)
© Donald F. Ferguson, All rights reserved. Topics in Computer Science: Modern Internet Service Oriented Application Development Lecture 8: IPaaS.
TAKE – A Derivation Rule Compiler for Java Jens Dietrich, Massey University Jochen Hiller, TopLogic Bastian Schenke, BTU Cottbus/REWERSE.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
Artificial Intelligence Lecture No. 19 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science, COMSATS Institute of Information Technology.
RIA to visualize the health of a project Team #4 Midterm presentation February 28,2008.
1 Copyright © 2008, Oracle. All rights reserved. I Course Introduction.
Mostly adopted from Jason Morris notes (Morris Technical Solutions)
Requirement Engineering with URN: Integrating Goals and Scenarios Jean-François Roy Thesis Defense February 16, 2007.
Technician Table Editor Academic advisor : Professor Ehud Gudes Technical advisor : Menny Even Danan Team: Olga Peled Doron Avinoam Ira Zaitsev ADD Presentation.
Summary for final exam Agent System..
Part 1: Overview of LINQ Intro to LINQ Presenter: PhuongNQK.
Business rules.
Intelligent Systems JESS constructs.
Introduction to Expert Systems Bai Xiao
PHP Training at GoLogica in Bangalore
Chapter 7: Introduction to CLIPS
An Architecture for Policy-based C2 Decision Support Systems
Jess Architecture Diagram WORKING MEMORY INFERENCE ENGINE EXECUTION ENGINE PATTERN MATCHER RULE BASE Here you can see how all the parts fit.
Database management concepts
Chapter 8: Advanced Pattern Matching
Knowledge Representation and Inference
Jess Knowledge, Influence, Behavior
Chapter 6: Programming Languages
Expert System Implementation
Developing and testing enterprise Java applications
Java IDE Dwight Deugo Nesa Matic Portions of the notes for this lecture include excerpts from.
Rule Engine Concepts and Drools Expert
Presentation transcript:

Business Rules Engine in Java Introduction to JBoss Rules by Tom Sausner

Overview ● JBoss Rules introduction ● Rules Engine Overview ● Applications ● Integration with Java applications ● Eclipse IDE plug-in ● Rules ● Demos ● Conclusion

JBoss Rules ● Apache License v2.0 open source license ● Previously Drools ● Other Business Rules Engines – Jess, OPS5, Clips, SOAR, Lisa ● Eclipse IDE integration!!! ● Runs on Jdk 1.4 or greater

BRE Standards ● Java Rule Engine API -JSR-94 ● Wrapper around a rules engine – Register and unregister rules – Parse rules – Inspect rule metadata – Execute rules – Retrieve results – Filter results ● W3C is working on Rules Interchange Format (RIF) and ● RuleML, a standard rule language, SWRL ● Existing rules need to be ported

Business Rules Engines ● Rule Based approached to implement an Expert System ● Primarily Implements the Rete algorithm – Created by Charles Forgy – “efficient pattern matching algorithm for implementing production rule systems” – Network of nodes... each node is a pattern defined by the LHS of the rules – Designed to sacrifice memory for increased speed ● Leaps algorithm

Why, When and Where ● Why – Separate decision making logic from data – Speed and Scalability – Declarative Programming – Centralization of Knowledge ● When – Problem does not lend itself to algorithmic sol'n – Logic often changes – Domain experts are available but not technical ● Where –

Rule Processing ● Forward Chaining ● Object asserted into Working Memory ● RETE selects matching Rules ● Rule Engine fires executes any rules that match ● Agenda resolves conflicts ● Consequences fire

Rules Engine

Rule Terms ● Fact ( application data ) ● Working Memory ( stateful collection of facts ) ● Production Memory ( the rules ) ● Inference Engine ( JBoss Rules & RETE ) ● Agenda ( conflict resolution ) ● Salience ( priority ) ● Assert, Retract and Modify

Rule File Organization ● package org.rjug ● #list any import classes here. ● #declare any global variables here ● #implement functions here ● rule "Your Rule" ● #include attributes such as "salience" here... ● when ● #conditions ● then ● #action ● end

Rule Syntax ● rule “ ” ● ● when ● ● then ● ● end

When - LHS ● Binding – Parameter – Fact ● Field Constraints ● Query – Allows you to query object in working memory – Looks like the “when” part. – Use 'workingMemory.getQueryResults(...)'

Columns ● The list of constraints on an object type ● Constraint types – Literal – Bound variable – Return value ( must evaluate to an object ) – Predicate ( must evaluate to primitive boolean ) ● Associated by the normal operators + matches(regex), contains, excludes( collections) ● Eval – catch all that executes and returns a boolean ● Autoboxing can be quirky

Rule Attributes ● Salience – priority ● Agenda-group – Allows partitioning of the agenda, only rules in this group are allowed to fire ● Auto-focus – Gives focus to an agenda group ● Activation-group – Xor group ● No-loop – Prevents recursion ● duration

Conflict Resolution ● Two phase recursive Agenda ● Agenda Evaluation – Selects the next rule & calls Working Memory Action – If no rules are left, exit ● Working Memory Action – Fires the consequence – Switches to Agenda Evaluation ● Resolution Strategy – Salience – LIFO ( Last In First Out ) ● Agenda Filtering

Decision Tables ● Ideal for spreadsheet-friendly staff ● Entry validation ● Control which fields can be changed ● Each row is a rule ● Each column is a conditional or consequence

Domain Specific Languages ● Allows rules to be more easily edited by analysts ● Maps common language to rule expression ● Aids developer and business collaboration ● DSLs can also act as "templates" of conditions or actions that are used over and over in your rules ● No impact on rules at runtime – Just a parse/compile time issue ● DSL support in the eclipse plugin

DSL Example ● [when]There is a Person with name of "{name}"=Person(name=="{name}") ● [when]Person is at least {age} years old and lives in "{location}"=Person(age > {age}, location=="{location}") ● [then]Log "{message}"=System.out.println("{message}"); ● [when]And = and

DSL from the IDE plug-in

Integration with Java ● Can write java directly in the rules file – Not much fun to debug here ● Can import and dereference java objects in the “then” part of a rule – Don't want the “when” part to change.

Jboss Rules Workbench ● Eclipse plug-in – 3.2 or greater ● Rules Project Creation ● Rule Editor – Syntax Highlighting!!! – Content assist – Outline – Builder... watch out! ● DSL editor ● Rule validation ● Views – Working memory, agenda, global data, Rete

Demo 1 ● Simple rules application ● Java – Read rules file – Assert facts – Fire all rules ● Rules – Rules file layout – Simple rules evaluation – Eclipse “views” on the rules – Binding objects and parameters – Retract

Demo 2 ● Same Java setup – different facts – Implement functionality called from the rules ● Rules – Globals – Multi – layer rules ● Re-asserting facts ● Utility rules( array list ) – Functions in the rule file – Calling out to methods elsewhere in java

Demo 3 - “The Road Test” ● Java – same setup, different facts ● Rules – Controlling the Agenda – Salience – Activation - Groups – no-loop

Best Practices ● Building rules – Strong vs. loose coupling – Use fine grained rules – Try not to rely on rule order – Consider asserting an object before making it global ● Stateful or stateless memory? ● Rule versioning ● Test Cases ● Performance testing & tuning

Other Enterprise Issues ● Rule Authoring – Validation – Profiling – Testing ● Business Rule Management Systems(BRMS) – Managing rules/rule sets – Versioning – BR system life cycle ● Fair Issac - Blaze Advisor

Questions? ●