Friday, September 28, 2012

Packt Publishing reaches 1000 IT titles and celebrates with an open invitation

Packt Publishing, the publisher of several Drools books and an active open source supporter, is celebrating the release of its 1000th IT book during this weekend.

As part of the celebration they are offering free ebook downloads to registered users and users that register until September 30th.

Here are the Drools books they published:

JBoss Drools Business RulesDrools JBoss Rules 5.0 Developer's GuideDrools Developer’s Cookbook


Congratulation to Packt and thank you for your support! Happy reading to all of you!

Their full press release:


PRESS RELEASE


28th September 2012

Packt Publishing reaches 1000 IT titles and celebrates with an open
invitation

Birmingham-based IT publisher Packt Publishing is about to publish its 1000th
title. Packt books are renowned among developers for being uniquely practical
and focused, but you’d be forgiven for not yet being in the know – Packt books
cover highly specific tools and technologies which you might not expect to see
a high quality book on.

Packt is certain that in its 1000 titles there is at least one book that everyone
in IT will find useful right away, and are inviting anyone to choose and
download any one of its eBooks for free over its celebration weekend of 28-
30th Sep 2012. Packt is also opening its online library for a week for free to give
customers an easy to way to research their choice of free eBook.

Packt supports many of the Open Source projects covered by its books through
a project royalty donation, which has contributed over $400,000 to Open
Source projects up to now. As part of the celebration Packt is allocating
$30,000 to share between projects and authors as part of the weekend
giveaway, allocated based on the number of copies of each title downloaded.

Dave Maclean, founder of Packt Publishing:

“At Packt we set out 8 years ago to bring practical, up to date and easy to use
technical books to the specialist tools and technologies that had been largely
overlooked by IT publishers. Today, I am really proud that with our authors
and partners we have been able to make useful books available on over 1000
topics and make our contribution to the development community.”

Thursday, September 27, 2012

Drools 5.5.0.Beta1 released

We're happy to announce the release of Drools (Expert, Fusion, Planner, Guvnor) 5.5.0.Beta1.

Documentation, Release Notes and Downloads are detailed below:
  • Download the zips from the bottom of the Drools download page
  • To try out the examples, just unzip one and run the runExamples.sh or runExamples.bat script.
Try it out and give us some feed-back (user list, issue tracker).

Wednesday, September 26, 2012

Integration and BPM week, Oct. 15-18

Join us for Red Hat Integration and BPM Week virtual event on October 15-18, 2012.
There you will learn about Red Hat's integration and BPM road map, find out how recent acquisitions will be integrated into the portfolio, and gain practical knowledge from the engineering leaders that are driving the most popular integration, messaging and rules, and BPM technologies and standards.
One registration grants access to all 17 information-packed webinar sessions!

Sessions include:
  • Fuse IDE makes integration easy – James Strachan (formerly FuseSource)
  • Getting Started with Apache Camel – Claus Ibsen (formerly FuseSource)
  • Enterprise integration at scale – Keith Babo
  • Business rules and event modeling made easy – Edson Tirelli
  • Simplify the complexity of your business processes – Kris Verlaenen
  • ActiveMQ in the cloud – Dejan Bosanac
  • Fuse Fabric and Fuse Management Console – Stan Lewis (formerly FuseSource)
The virtual event is FREE. Sessions will be delivered live, and will also be available on-demand afterwards. One registration gets you access to everything!

For more information on the agenda and sessions, please go to: www.redhat.com/promo/jboss_integration_week

Friday, September 21, 2012

4 Weeks Until Intellifest - Register soon to learn about Drools & jBPM.

Only 4 weeks to go for IntelliFest 2012, in San Diego, start Monday 22nd of October.

Program Overview ( detailed agenda for Monday and Tuesday below ):
Monday - Healthcare focus for Rules, Workflow, Ontologies and Events (Free)
Tuesday - General Drools&jBPM session (Free)
Tuesday - Rule Design Patterns in Production Rule Systems
Wed - Fri - General IntelliFest Sessions

There are limited spaces, so register soon here.





Monday - Healthcare focus for Rules, Workflow, Ontologies and Events (free)



0830-0920 Captain Emory Fry, MD
Socratic Grid : Open Source Distributed Decision Support for Healthcare

0930-1020  Dr Robert Greenes, Department of Biomedical Informatics, Arizona State University
Key Note : Embedding Decision Support in Clinical Systems

1030-1120 Dr Aziz Boxwala, Division of Biomedical Informatics, University of California
Clinical Decision Support Consortium

1130-1200 Dr Seong Ki Mun, President and CEO of OSEHRA
Open Source Electronic Health Record Agent 

1200:1300 Lunch

1300-1350  Dr Davide Sottara, Department of Biomedical Informatics, Arizona State University
Knowledge Representation Standards For Building Executable Clinical Processes Models

1400-1450 David Shields, Health ITS, University of Utah
OpenCDS: a Clinical Decision Support Infrastructure Based on Drools

1500-1520 Harold Solbring, Division of Biomedical Informatics, Mayo Clinic
Semantic Wiki

1530-1655 Conor Dowling, Caregraf
Semantic Terminology Services

1600-1620 Dr Xiao Hu, Department of Neurosurgery, University of California
Clinical Decision Support Driven Alarms

1630-1700
Panel Discussion - Collaboration Opportunities


Tuesday - General Drools&jBPM Workshop (free)

8.00 AM: Breakfast Social – pre-laptop setup, and QA time with solution Architects. 
-Key will be provided to setup your laptop, so you can view and run the examples used during the talks.
9.00 BRMS Product Overview (Prakash Aradhya 15min) 
How we turn the Drools and jBPM communtiy parts into a world class product. Supporting and harvesting all the innovation done in the open community, Red Hat delivers reliable, dependable and integrated solutions for enterprise customers.
9.15 Introduction to Drools Expert (Mark Proctor 45min) 
Drools Expert covers the business rule engine. A gentle, example driven, dive into the Drools technical rule language and engine features.
10.10 Introduction to Drools Fusion (Edson Tirelli 45min) 
Learn how Drools does CEP differently. Our unified approach extends Drools Expert with a series of language and sub-engine extensions to provide temporal reasoning and event correlation.
11.05 Introduction to jBPM and BPMN2 (Tihomir Surdilovic 45min) 
jBPM is a BPM engine designed for flexible processes, implementing and extending the BPMN2 spec. Built form the ground up to be part of a unified strategy for business automation and decision management. jBPM fully integrates with Drools Expert and Fusion.
11.45 Decision Modelling with Graphical Editors (Edson Tirelli 30min) 
Drools Expert provides sophisticated web based tooling, around decision tables, guided editors and templates. Our decision modelling approach draws from the very best research found at Dr Jan Vanthienien school of Decision Modelling.
12.30 Working Lunch – Experience Drools and jBPM – Hands on labs (Optional) (1hour)
13.30 Human Tasks up Close and Personal (Tihomir Surdilovic 40min) 
Human tasks are a central component of BPM. This example driven talk will build an example live, demonstrating what jBPM’s Human Task technology can do for you.
14.20 Building Games with Drools – Pong, Snake and Wumpus (Mark Proctor 40min) 
Time for some hard play, learn how to build classic computer games with Drools. These also provide interesting exercises in BA requirements gathering.
15.10 Drools Planner a Quick Overview (Geoffrey De Smet 40min) 
Whether it’s employee rostering, task scheduling, vehicle routing, bin packing or another planning problem: all organizations try to optimize their limited resources under constraints. Drools Planner optimizes business resources for normal Java programmers.
15.50 Drools Chance for Imperfect Reasoning (Davide Sottara 40min) 
Sometimes data quality is not perfect, so facts may not be known with precision and certainty. Likewise, crisp constraints such as hard thresholds might not be able to capture the complexity of a business policy. Drools Chance allows to apply gradual and/or probabilistic constraints to uncertain or vague data.
16.40 UberFire – Drools&jBPM Workbench framework (Mark Proctor 30min) 
UberFire is a new project that forms the foundation of our 6.0 web tooling. It’s standalone framework that provides a sophisticated workbench framework for the web; where everything is a plugin. Come learn about the Uberfire, and how you can use the workbench to build your own web applications.
17.10 Drools&jBPM 6.0 and Beyond (Optional : open as long as people remain) 
An open presentation and discussion about the design ideas, principles and goals that are driving the development of Drools & jBPM version 6.0. This will be an optional and informal session where attendees will have the opportunity to learn about what is coming, contribute ideas and provide feedback that will be taken in consideration by the development team.
17.10 Hands on Lab 
Run at the same time as "Drools&jBPM and Beyond" and Beyond. Solution Architects are on hand to help you with your coding problems, and running examples.

Tuesday - Rule Design Patterns in Production Systems

  1. Rule Design Patterns
  2. What is a “Rule Design Pattern”?
  3. Basic Rule Formats
  4. Fact Classification
  5. Handling Failure to Match
  6. Extending Rules
  7. Reasoning with Interfaces
  8. Active Facts
  9. Marker Facts
  10. Fact Proxies
  11. Application Design Patterns
  12. Short-Term Sessions
  13. Permanent Sessions

Friday, September 14, 2012

Business Process Simulation in jBPM Designer


We have added a new and exciting feature to jBPM and the jBPM Designer:  Business Process Simulation.

This is still an experimental feature and subject to changes, so community input and involvement is very important. 
Business Process Simulation allows you to to simulate your process models, and view helpful simulation results that can guide you to improving your models as well as be able to better understand and describe them to your peers and/or customers.

The below video showcases this new feature. Please give us your feedback by either posting your questions/opinions here or hit us up on the jBPM user mailing list, IRC, or the jBPM user forum.


Some important features of jBPM Simulation in Designer:
* Awesome Simulation engine that is based on and uses jBPM 5
* Easy to work with and extend

You can start using this new feature now by building the jBPM Designer from source. To do that run:

git clone https://github.com/droolsjbpm/jbpm-designer.git
cd jbpm-designer
mvn clean install

and use one of the three different wars generated in the /target directory. You can use jBPM Designer with Drools Guvnor 5.3.x, 5.4.x and 5.5.x.

Enjoy :)

Monday, September 10, 2012

SBVR vs If-Then-Action Rules

I just found a nice interview with Ronald G. Ross about SBVR, that helps shed some light on how this works in relation to If-Then format's.

More on the If-Then Format for Expressing Business Rules
http://www.brcommunity.com/b588.php
...snip...

Question:  Do you have a rote way to translate an If-Then statement into declarative form?

RGR:  You can't translate If-Then-Action statements into declarative form because the business intent is missing.  Translating If-Then-Fact back and forth from RuleSpeak, on the other hand, is trivial.  We do that often.  One client described it "embarrassingly easy."

Question:  What would RuleSpeak do with the business rule, "If the news is bad, shoot the messenger."?

RGR:  As currently structured, that statement uses the If-Then-Action format.  In declarative form it would read:  The messenger of bad news must be shot.  Or if you prefer the If-Then-Fact format then:  If the news is bad, the messenger must be shot.

By the way, the business rule in its present form is not practicable.  For example, does the messenger need to be shot dead?  And does the messenger actually need to be shot, or is just killing him sufficient?

Question:  What would RuleSpeak do with the business rule, "If a rental car is returned more than one hour late, charge a late-return penalty."?

RGR:  That statement again uses the If-Then-Action format.  In declarative form it would read:  A late-return penalty must be charged for a car rental if the rental car is returned over one hour late.  Or if you prefer the If-Then-Fact format then:  If a rental car is returned over one hour late, a late-return penalty must be charged for the car rental.

As soon as you let any actions creep into business rules, all bets are off on side effects.  As the statements become more and more slanted toward programming, they become less and less comprehensible to business people and to most business analysts as well.
...snip...

Sunday, September 09, 2012

Conditional Branches with sub blocks and 'switch' statements

Last week Mario introduced the new left hand side conditional element 'if/else if/else'. The next plans for this is to allow nested blocks in each conditional branch and to then to provide a 'switch' statement for sugar. You can see more examples of both, plus their logical rule equivalents here, https://community.jboss.org/wiki/BranchCEs

Some time ago I started to write a pacman example, it's still unfinished, but I can share with you how these new constructs will improve maintainability with reduced rules. The original drl can be found here:
https://raw.github.com/droolsjbpm/drools/master/drools-examples/src/main/resources/org/drools/examples/pacman/pacman.drl

The pacman.drl has the following three rules:
/**
 * By increasing the tick we slow down the time to the next move.
 * I use the CE 'or' here rathre than an infix "in" to maximise node sharing
 * with both the EatFood and EatPowerPill rules.
 */
rule SlowWhenEating dialect "mvel" no-loop salience 10when
    $char : Character( name == "Pacman" )
    $l : Location( character == $char )
    $target : Cell( row == $l.row, col == $l.col)
    (or $contents : CellContents( cell == $target, cellType == CellType.FOOD )
        $contents : CellContents( cell == $target, cellType == CellType.POWER_PILL ) )    
    $update : ScheduledLocationUpdate( character == $char )
then  
    modify ( $update ) { tock += 2 };
end


/**
 * When we move onto a FOOD cell, increase the score by 1
 */
rule EatFood dialect "mvel" when
    $char : Character( name == "Pacman" )
    $l : Location( character == $char )
    $target : Cell( row == $l.row, col == $l.col)
    $contents : CellContents( cell == $target, cellType == CellType.FOOD )
    $s : Score()   
then
    modify( $contents ) { cellType = CellType.EMPTY };
    modify( $s ) { score += 1 };    
end

/**
 * When we move onto a POWER_PILL cell, increase the score by 5
 */
rule EatPowerPill dialect "mvel" when
    $char : Character( name == "Pacman" )
    $l : Location( character == $char )
    $target : Cell( row == $l.row, col == $l.col)
    $contents : CellContents( cell == $target, cellType == CellType.POWER_PILL )
    $s : Score()   
then
    modify( $contents ) { cellType = CellType.EMPTY };
    modify( $s ) { score += 5 };    
end

Once we support 'switch' with nested blocks we should be able to do the following. Note I also removed the 'no-loop', as it's no longer needed with property reactive.

rule eatFoodOrPill when
    $s : Score()  
    $char : Character( name == "Pacman" )
    $l : Location( character == $char )
    $target : Cell( row == $l.row, col == $l.col)
    $contents : CellContents( cell == $target )
    switch( cellType ) {
        case CellType.FOOD : {  
            do[scorePlus1]      
            $update : ScheduledLocationUpdate( character == $char )
            do[slowWhenEating]
        }
        case CellType.POWER_PILL  : {
            do[scorePlus5]        
            $update : ScheduledLocationUpdate( character == $char )
            do[slowWhenEating]            
        }        
    }
then[slowWhenEating]  
    modify ( $update ) { tock += 2 };
then[scorePlus1]
    modify( $contents ) { cellType = CellType.EMPTY };
    modify( $s ) { score += 5 };    
then[scorePlus5]
    modify( $contents ) { cellType = CellType.EMPTY };
    modify( $s ) { score += 5 };     
end

Drools Spring Enhancements in the 5.x releases

Version 5.3 of Drools introduced the ability to declare Knowledge Listeners via the Spring XML. You could declare 3 types of listeners to be added to the KnowledgeSessions - AgendaListener,  WorkingMemoryListener, ProcessEventListener.

The drools-spring module allowed configuration of these listeners to KnowledgeSessions using XML tags. These tags have identical names as the actual listener interfaces i.e., <drools:agendaEventListener....>, <drools:workingMemoryEventListener....> and <drools:processEventListener....>.

http://docs.jboss.org/drools/release/5.3.0.Final/droolsjbpm-integration-docs/html/ch02.html#d0e509

The upcoming 5.5.0.Beta1 would include the following enhancements to the drools-spring module

Support declarative configuration for knowledge runtime loggers (console, file, threaded-file)
With this addition, all the requisite loggers can be defined declaratively and attached to the Knowledge Sessions. All the logger types supported by Drools Expert can be configured via XML.
   <drools:ksession id="…" type="…" kbase="…">
        <drools:consoleLogger/>
 …
    </drools:ksession>

    <drools:ksession id="…" type="…" kbase="…">
        <drools:fileLogger id="…" file="[path]"/>
    </drools:ksession>

    <drools:ksession id="…" type="…" kbase="…">
        <drools:fileLogger id="…" file="[path]" threaded="true" interval="5"/>
    </drools:ksession>

You can find more information on the options and the corresponding Java Code here: https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-container/drools-spring/src/test/resources/org/drools/container/spring/loggers.xml
https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-container/drools-spring/src/test/java/org/drools/container/spring/SpringDroolsLoggersTest.java

  Defining an environment (org.drools.runtime.Environment)
 <drools:environment id="drools-env">
    <drools:entity-manager-factory ref="myEmf"/>
    <drools:transaction-manager ref="txManager"/>
    <drools:globals ref="my-globals"/>
    <drools:date-formats ref="my-date-formats"/>
    <drools:calendars ref="my-calendars"/>

    <drools:object-marshalling-strategies>
      <drools:serializable-placeholder-resolver-strategy strategy-acceptor-ref=".."/>
      <drools:identity-placeholder-resolver-strategy strategy-acceptor-ref=".."/>
      <drools:jpa-placeholder-resolver-strategy env-ref=".." />
      <drools:process-instance-resolver-strategy/>
    </drools:object-marshalling-strategies>

   <!--
        <drools:scoped-entity-manager scope="app" >
        </drools:scoped-entity-manager>
    -->
You can find more information on the configuration options and the corresponding Java Code here: https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-container/drools-spring/src/test/resources/org/drools/container/spring/environment.xml

https://github.com/droolsjbpm/droolsjbpm-integration/blob/master/drools-container/drools-spring/src/test/java/org/drools/container/spring/EnvironmentTest.java

Author
Vinod Kiran
BRMS Practice Lead with ValueMomentum Software Services Pvt. Ltd
http://www.linkedin.com/in/vinodkiran

Friday, September 07, 2012

IntelliFest Drools & jBPM Healthcare Workshop Agenda (San Diego Oct 2012)

Yesterday I posted the general Drools & jBPM work shop agenda. This year there is an additional day dedicated to Healthcare professionals, with top keynote speaker Dr Robert Greenes.


The Healthcare day is being chaired by Captain Emory Fry, MD and Dr Davide Sottara.

Monday 22nd October, Bahia Resort Hotel, San Diego. Free Entrance to first 100 registrations.

0830-0920 Captain Emory Fry, MD
Socratic Grid : Open Source Distributed Decision Support for Healthcare

0930-1020  Dr Robert Greenes, Department of Biomedical Informatics, Arizona State University
Key Note : Embedding Decision Support in Clinical Systems

1030-1120 Dr Aziz Boxwala, Division of Biomedical Informatics, University of California
Clinical Decision Support Consortium

1130-1200 Dr Seong Ki Mun, President and CEO of OSEHRA
Open Source Electronic Health Record Agent 

1200:1300 Lunch

1300-1350  Dr Davide Sottara, Department of Biomedical Informatics, Arizona State University
Knowledge Representation Standards For Building Executable Clinical Processes Models

1400-1450 David Shields, Health ITS, University of Utah
OpenCDS: a Clinical Decision Support Infrastructure Based on Drools

1500-1520 Harold Solbring, Division of Biomedical Informatics, Mayo Clinic
Semantic Wiki

1530-1655 Conor Dowling, Caregraf
Semantic Terminology Services

1600-1620 Dr Xiao Hu, Department of Neurosurgery, University of California
Clinical Decision Support Driven Alarms

1630-1700
Panel Discussion - Collaboration Opportunities

(Conditional) Named consequences in Drools 5.5

Until now Drools rules have been always expressed in the form:
rule "name"
when
    LHS (conditional element)
then
    RHS (consequence)
end
Sometimes this could be somewhat limiting and leads to verbose and difficult to be maintained repetitions like in the following example:
rule "Give 10% discount to customers older than 60"
when
    $customer : Customer( age > 60 )
then
    modify($customer) { setDiscount( 0.1 ) };
end

rule "Give free parking to customers older than 60"
when
    $customer : Customer( age > 60 )
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
end
It is already possible to partially overcome this problem by making the second rule extending the first one like in:
rule "Give 10% discount to customers older than 60"
when
    $customer : Customer( age > 60 )
then
    modify($customer) { setDiscount( 0.1 ) };
end

rule "Give free parking to customers older than 60"
    extends "Give 10% discount to customers older than 60"
when
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
end
Anyway, starting from Drools 5.5, it is possible to define more labelled consequences other than the default one in a single rule, so, for example, the 2 former rules can be compacted in only one like it follows:
rule "Give 10% discount and free parking to customers older than 60"
when
    $customer : Customer( age > 60 )
    do[giveDiscount]
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
then[giveDiscount]
    modify($customer) { setDiscount( 0.1 ) };
end
This last rule has 2 consequences, the usual default one, plus another one named "giveDiscount" that is activated, using the keyword do, as soon as a customer older than 60 is found in the knowledge base, regardless of the fact that he owns a car or not. The activation of a named consequence can be also guarded by an additional condition like in this further example:
rule "Give free parking to customers older than 60 and 10% discount to golden ones among them"
when
    $customer : Customer( age > 60 )
    if ( type == "Golden" ) do[giveDiscount]
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
then[giveDiscount]
    modify($customer) { setDiscount( 0.1 ) };
end
The condition in the if statement is always evaluated on the pattern immediately preceding it. In the end this last, a bit more complicated, example shows how it is possible to switch over different conditions using a nested if/else statement:
rule "Give free parking and 10% discount to over 60 Golden customer and 5% to Silver ones"
when
    $customer : Customer( age > 60 )
    if ( type == "Golden" ) do[giveDiscount10]
    else if ( type == "Silver" ) break[giveDiscount5]
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
then[giveDiscount10]
    modify($customer) { setDiscount( 0.1 ) };
then[giveDiscount5]
    modify($customer) { setDiscount( 0.05 ) };
end
Here I wanted to give a 10% discount AND a free parking to Golden customers over 60, but only a 5% discount (without free parking) to the Silver ones. I achieved this result by activating the consequence named "giveDiscount5" using the keyword break instead of do. In fact do just schedules a consequence in the agenda, allowing the remaining part of the LHS to continue of being evaluated as per normal, while break also blocks any further pattern matching evaluation. Note, of course, that the activation of a named consequence not guarded by any condition with break doesn't make sense (and generates a compile time error) since otherwise the LHS part following it would be never reachable.

-- updated --
To clarify some of comments. Here is an if..do rule, from above
rule "Give free parking to customers older than 60 and 10% discount to golden ones among them"
when
    $customer : Customer( age > 60 )
    if ( type == "Golden" ) do[giveDiscount]
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
then[giveDiscount]
    modify($customer) { setDiscount( 0.1 ) };
end

That rule is the equivalent of the two single rules:
rule "Give free parking to customers older than 60 and 10% discount to golden ones among them"
when
    $customer : Customer( age > 60 )
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
end

rule "Give free parking to customers older than 60 and 10% discount to golden ones among them - 1"
when
    $customer : Customer( age > 60 )
    eval ( $customer.type == "Golden" )
then
    modify($customer) { setDiscount( 0.1 ) };
end

The same rule but a 'if..break' instead:
rule "Give free parking to customers older than 60 and 10% discount to golden ones among them - 2"
when
    $customer : Customer( age > 60 )
    if ( type == "Golden" ) break[giveDiscount]
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
then[giveDiscount]
    modify($customer) { setDiscount( 0.1 ) };
end

Notice the negation of the eval:
rule "Give free parking to customers older than 60 and 10% discount to golden ones among them - 1"
when
    $customer : Customer( age > 60 )
    eval ( ! ($customer.type == "Golden") )
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
end

rule "Give free parking to customers older than 60 and 10% discount to golden ones among them - 2"
when
    $customer : Customer( age > 60 )
    eval ( $customer.type == "Golden" )
then
    modify($customer) { setDiscount( 0.1 ) };
end

If we take the last, more complex rule:
rule "Give free parking and 10% discount to over 60 Golden customer and 5% to Silver ones"
when
    $customer : Customer( age > 60 )
    if ( type == "Golden" ) do[giveDiscount10]
    else if ( type == "Silver" ) break[giveDiscount5]
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
then[giveDiscount10]
    modify($customer) { setDiscount( 0.1 ) };
then[giveDiscount5]
    modify($customer) { setDiscount( 0.05 ) };
end

That translates into the following three rules. Notice for the free parking I explicitly add in all the negations that are implicit to the above rule.
rule "Give free parking and 10% discount to over 60 Golden customer and 5% to Silver ones - 1"
when
    $customer : Customer( age > 60 )
    eval( $customer.type == "Golden" )
then
    modify($customer) { setDiscount( 0.1 ) };
end

rule "Give free parking and 10% discount to over 60 Golden customer and 5% to Silver ones - 2"
when
    $customer : Customer( age > 60 )
    eval( !( $customer.type == "Golden" ) && $customer.type == "Silver" )
then
    modify($customer) { setDiscount( 0.05 ) };
end

rule "Give free parking and 10% discount to over 60 Golden customer and 5% to Silver ones - 3"
when
    $customer : Customer( age > 60 )
    eval( ( $customer.type == "Golden" ) || 
             ( !( $customer.type == "Golden" ) && !( $customer.type == "Silver" ) ) ) ) 
    $car : Car ( owner == $customer )
then
    modify($car) { setFreeParking( true ) };
end
We have further work coming down the line, that will allow nested patterns inside of the branch's. You can see an early draft proposal of this here: https://community.jboss.org/wiki/BranchCEs

Wednesday, September 05, 2012

IntelliFest Drools & jBPM Workshop Agenda (San Diego Oct 2012)

At IntelliFest this year there are two Drools workshops.  There is the "General Drools&jBPM Workshop",  which is a series of high level talks explaining the various features of Drools&jBPM. The second is the workshop "Rule Design Patterns in Production Systems", by Dr Wolfgang Laun, which is aimed at rule authoring techniques. The agenda for both is below, you can see the more detailed and up to date agenda here.

Only 7 weeks to go, and there are limited spaces, so register soon here.


General Drools&jBPM Workshop

8.00 AM: Breakfast Social – pre-laptop setup, and QA time with solution Architects. 
-Key will be provided to setup your laptop, so you can view and run the examples used during the talks.
9.00 BRMS Product Overview (Prakash Aradhya 15min) 
How we turn the Drools and jBPM communtiy parts into a world class product. Supporting and harvesting all the innovation done in the open community, Red Hat delivers reliable, dependable and integrated solutions for enterprise customers.
9.15 Introduction to Drools Expert (Mark Proctor 45min) 
Drools Expert covers the business rule engine. A gentle, example driven, dive into the Drools technical rule language and engine features.
10.10 Introduction to Drools Fusion (Edson Tirelli 45min) 
Learn how Drools does CEP differently. Our unified approach extends Drools Expert with a series of language and sub-engine extensions to provide temporal reasoning and event correlation.
11.05 Introduction to jBPM and BPMN2 (Kris Verlaenen 45min) 
jBPM is a BPM engine designed for flexible processes, implementing and extending the BPMN2 spec. Built form the ground up to be part of a unified strategy for business automation and decision management. jBPM fully integrates with Drools Expert and Fusion.
11.45 Decision Modelling with Graphical Editors (Edson Tirelli 30min) 
Drools Expert provides sophisticated web based tooling, around decision tables, guided editors and templates. Our decision modelling approach draws from the very best research found at Dr Jan Vanthienien school of Decision Modelling.
12.30 Working Lunch – Experience Drools and jBPM – Hands on labs (Optional) (1hour)
13.30 Human Tasks up Close and Personal (Kris Verlaenen 40min) 
Human tasks are a central component of BPM. This example driven talk will build an example live, demonstrating what jBPM’s Human Task technology can do for you.
14.20 Building Games with Drools – Pong, Snake and Wumpus (Mark Proctor 40min) 
Time for some hard play, learn how to build classic computer games with Drools. These also provide interesting exercises in BA requirements gathering.
15.10 Drools Planner a Quick Overview (Geoffrey De Smet 40min) 
Whether it’s employee rostering, task scheduling, vehicle routing, bin packing or another planning problem: all organizations try to optimize their limited resources under constraints. Drools Planner optimizes business resources for normal Java programmers.
15.50 Drools Chance for Imperfect Reasoning (Davide Sottara 40min) 
Sometimes data quality is not perfect, so facts may not be known with precision and certainty. Likewise, crisp constraints such as hard thresholds might not be able to capture the complexity of a business policy. Drools Chance allows to apply gradual and/or probabilistic constraints to uncertain or vague data.
16.40 UberFire – Drools&jBPM Workbench framework (Mark Proctor 30min) 
UberFire is a new project that forms the foundation of our 6.0 web tooling. It’s standalone framework that provides a sophisticated workbench framework for the web; where everything is a plugin. Come learn about the Uberfire, and how you can use the workbench to build your own web applications.
17.10 Drools&jBPM 6.0 and Beyond (Optional : open as long as people remain) 
An open presentation and discussion about the design ideas, principles and goals that are driving the development of Drools & jBPM version 6.0. This will be an optional and informal session where attendees will have the opportunity to learn about what is coming, contribute ideas and provide feedback that will be taken in consideration by the development team.
17.10 Hands on Lab 
Run at the same time as "Drools&jBPM and Beyond" and Beyond. Solution Architects are on hand to help you with your coding problems, and running examples.


Rule Design Patterns in Production Systems

  1. Rule Design Patterns
  2. What is a “Rule Design Pattern”?
  3. Basic Rule Formats
  4. Fact Classification
  5. Handling Failure to Match
  6. Extending Rules
  7. Reasoning with Interfaces
  8. Active Facts
  9. Marker Facts
  10. Fact Proxies
  11. Application Design Patterns
  12. Short-Term Sessions
  13. Permanent Sessions

Monday, September 03, 2012

Human Interactions: Task List UIs Requirements


Most of the times the Front Ends Applications which are built on top of Process Engines contains a fair amount of screens/components dedicated to deal with Human Interactions. On this post the requirements to build these panels will be dissected to define which bits are important. The main idea behind this analysis is to be able to evolve the current state of art of the Human Interactions screens/components to the next level.

State of the Art

Nowadays most of the BPM Suites offers the following set of screens:
  • Inbox  - (Personal) Task Lists
  • Task Creation
    • Task Details
    • Sub Tasks
    • Task Help
    • Task Content
  • Task Forms
  • Group Task Lists
  • Identity related screens
Let's dive into each of these categories in order to understand in details what is required in each of them:

Inbox a.k.a. Personal Task List

This is the main screen for a User to interact. This screen will contain a list or a data grid which will display all the pending tasks for the currently logged in user. The following image describe in detail the key bits:
Personal Task List (Inbox)
This screen is usually compared with the Inbox folder of any Email Client application where per each mail we have a row and in order to see the content of the email we need to drill down into each item.
It is not necessary to explain each button and piece of information that is being displayed in the previous picture but for the sake of this analysis we can divide the features into two big groups:

Basic Features

A set of Basic Features can be quickly coded based on the mechanisms provided by the Engine:
  1. All the pending tasks for the user
  2. Generic data about those tasks (Columns)
  3. A set of actions to interact with each task (also bulk actions as displayed in the image)
All these features will represent the basic pieces that needs to be provided by the, but on top of those bits a set of user customizations needs to be allowed by the tool.

Domain Specific & Usability Features

In order to adopt a Generic Task List interface most of the companies requires a high degree of customization on top of the basic set of features provided by the tools. Most of these customizations are domain specific and are extremely difficult to provide in a generic way. But what we can provide, as tools designers, is several layers of flexibility to allow each company to modify and adapt the generic tooling to their needs.
Specifically for Task Lists these custom features can be:
  1. Filter/Search by generic and domain specific data inside or related with the tasks
  2. Define Labels and Label Tasks
  3. Define different perspectives to display the same information. For example: Number of Columns to Display, Default Sorting, etc
  4. User defined graphical annotation and comments,
  5. User defined timers and alerts
  6. Find other users associated with each task and use different communication channels to get things done, etc
  7. User defined Meta-Data for future analysis
I can list a very extensive list of features that can be added, but we need to be careful and be focused on the features that will make our task lists/inbox usable and not more difficult to use.
So there is an extra factor that we need to consider, and that factor is how the end users want interact with our software. The cruel reality is that there is no single answer, we need to provide an infrastructural framework flexible enough to allow each user to customize his/her experience in front of the software. Each user will need to be able to add or limit the set of features that they want to use. The company need to know that if there is a feature missing, the learning curve to add it is almost none and the developers needs to be comfortable with how these additions or removals are done.

 Task Creation & Task Details

If we do a similar analysis for the screens intended to allow the user to create a new task or to modify an existing task we will start finding a lot of repeated requirements.
The following figure shows a set of screens that are usually involved in the Task Creation and Task Details Edition process:
Task Creation + Task Details
The previous figure shows a very simple and fluid mechanism to quickly create new Tasks.
In order to create a task we just need a name and all the rest of the properties will be defaulted based on global or the user configurations.
If we want to edit the task basic properties we will have a different panel with the most common things that the user will want to change, like for example: Due Date, Priority and Assignment.

Advanced Details

More advanced options can be displayed separately and only if the User wants to see them:
Advanced Task Details
Sub Tasking strategies, Deadlines and Escalation Options can be shown if they are needed. There are cases when these advanced behaviors are not required, and for that reason they should be all optional at the UI level.

Sub Tasks

If Sub Task are allowed by Default a separate panel embedded in the Task Details view can be added to allow the quick creation of subtasks that are related with a specific parent Task.
Adding Sub Tasks
Once the Sub Task are created, they can be edited via the normal panels, which will probably add the reference to the parent Task and some bits of extra information (like for example the parent task name and assignee for reference).

Task Help

Something that we usually leave to the end is the Help feature. As you can see in the following figure, with a very simple panel we can write a set of localized help texts which will guide to the person that needs to work in such task. For simple Tasks, the help can be avoided, but for more complex tasks, such as legal, medical, government tasks which usually contains CODEs and regulations this can be very useful.
Task Contextual Help

Task Content

One very important aspect of every task is the information that the task will handle and how this information will be exposed to the user and how the UI will gather the required input from the user.
For this reason we will need a way to define the Task Input Data and The Task Output data.
Defining Task Content
The Task Inputs represent all the information that will be displayed and is required by the user in order work on the task. The Task Ouputs are the data that the user must enter in order to complete the particular task.
As extension points we can also add a set of Completion Rules that will need to be validated in order to automatically decide if all the data is coherent and the task can be successfully completed or if the user will be pushed to add more or modify the current information.
In the same way we can define a simple mechanism to define which actions will be available for each specific task. Creating a set of Default set of actions the user just can select between different groups of standard actions that will be rendered inside the Task Form.
Most of the time, if our task is in the context of a Business Process, the Task Inputs and Task Outputs can be inferred by the process data mappings specification around the Task.
Task Inputs and Outputs can also be defined by using a Form Builder which can aggregate information from different places and allows us to have a more flexible way of defining the information that will be handled by the task. A mixed approach is also valid.
It's important to understand that Task Inputs and Outputs are vital to handle complex tasks that are in some way standard to the company and are executed multiple times. For a simple TODO task, which will merely serve as a reminder to ourselves, we can avoid adding such complexity. The idea of Inputs and Outputs also make more sense when we are creating a Task that will be executed by a different person who doesn't fully understand the goal of the task. Specifying the Inputs and Outputs we will be formalizing the task expected results as well as the required information needed to do the expected work.

Task Forms

The final goal of Task Lists and all the previously introduced panels is to help and guide the users to do their work. In order to do the work, the users needs to interact with we usually as a Task Form. The most simplistic and generic representation of a Task Form can be the one shown in the following figure:
Generic Task Form Structure
There are no limitation on how the Task Form needs to look like, but it will usually contain the information displayed in the previous figure. Most of the information that will be displayed is based on the Task information that we have stored and the graphical arrangement of components that we can do using  Form Builder tool. No matter the technique that we use, it's important to highlight that there is no good or bad way of structuring the information. We can say that we did a good job if the user who is interacting with the task:
  1. Have all the information required to work
  2. Is not delayed by the tool
  3. Doesn't feel that there are too many options that are not used in the normal course of actions

Group Task Lists

As you may know most of the Task Lists systems also provide the possibility of showing in a separate list all the tasks assigned to the groups were a certain user belongs. The tasks displayed in this list are not assigned to any person in particular, but they can be claimed. So, let's say that you don't have any task to do today, you can go to the Group Tasks list and claim a task from there. Once you claim the task, the task is automatically assigned to you and no one else can work on it. For this specific kind of tasks you will have a specific Task Action to release it if you can no longer work on it. As soon as you release the task, the task is placed again into the group tasks and anyone inside that group can claim it.
Group Task Lists
There are sometimes when we will want to display both lists in the same screen which make total sense if the user wants to have a quick overview about the overall work load related to him/her.

Identity Related Screens

All the identity information is usually handled by a separate component and it is usually central to the company. From the UI Perspective is important to have a set of simple tools which allows us to query the company directory and relate a User to a Task or query for Groups to be able to assign a Task.
Identity Utility
One important thing here is to notice that this panel depends on the underlaying technology used to contain the Identity information. If your company uses Active Directory or LDAP or a Database this component will need to be adapted to connect to your Identity Directory and consume data from it. There is no single generic solution that fits all the environments.

Get Involved

If you think that all the features described here are important, or if you are planning to adopt a solution like the one described in this post please get involved and share your thoughts and extra requirements that you may need. I will start sharing my personal experiments on the basic components exposed in this post. This is a very good opportunity to join forces and help in the creation of these components. If you wanna help and learn in the process please write a comment here or contact me via the public jBPM5 channels. The more requirements that we can gather, more re-usable will be the end results.

Summary

This post cover what I believe are the most important bits that every Task Lists Oriented Software should provide. I'm not saying that these features are enough but this post will serve as the starting point for more advanced mechanisms to improve how the work is being done. I've intentionally left out of this post two important topics: the Form Builder and Task Statistics and Reporting. Both topics will be covered in future posts. Now that you reach the end of the post please read again the "Get Involved" section and drop us a line with your comments/suggestions.