Version 3



    New conditional elements: 'from', 'collect', 'accumulate', 'forall'



    'from' allows the engine to reason over data not inside the engine, this can be used with global variables to interact with data providing services, such as hibernate. MVEL provides the scripting language capabilities for this, any previously bound variable can be used in the MVEL expression. The following example shows a hibernate named query with some dummy properties that returns a list of Restaurants. Restaurant() is a standard pattern, and can have its own field constraint and bindings like any other pattern.

        $r : Restaurant( $postCode ) from hbSession.getNamedQuery( "some query" ).setProperties( [ key1 : value2, key2 : value ] ).list()



    'collect' allows reasoning over sets of data

    rule "Collect Test" salience 70
            $person      : Person( name == "Bob", $likes : likes )
            $cheeseList  : ArrayList(size > 2) from collect( Cheese( type == $likes ) );



    'accumulate' is a more powerful version of collect, it can be used to undertake set operations, like sum or total

    rule "Accumulate with Bindings" salience 90
            $person      : Person( name == "Bob", $likes : likes )
            $totalAmount : Integer() from accumulate( $cheese : Cheese( type == $likes ),
                                                      init( int total = 0; ),
                                                      action( total += $cheese.getPrice(); ),
                                                      result( new Integer( total ) ) );



    'forall' allows a rule to activate when it is true for all the values in the rule engine.

    rule "test nested CEs"     
             forall( State( $state : state ),
                     Person( status == $state, $likes : likes ),
                     Cheese( type == $likes ) )


    Full support to FOL: nesting of elements now complete

    You can now nest 'and' and 'or' inside 'not' and 'exists'.

    rule "test nested CEs"  
          not ( State( $state : state ) and
                not( Person( status == $state, $likes : likes ) and
                     Cheese( type == $likes ) ) )


    Support to multi restriction connective constraints:

    & and | can now be used inside a pattern. The behaviour is different, as it does not result in sub rule generation.

    rule "& operator with ! and strings"
        $person : Person( hair != "blue" & != "purple", age > 30 & < 40  )        
            list2.add( $person );
    rule "| operator with == and strings"
        $person : Person( hair == "blue" |  == "purple",   age < 30 )       
            list3.add( $person );


    Parser improvements:

    Keyword conflicts resolved

    Better support to line breaks

    Support to escaped characters inside strings


    Primitive type support: no more autoboxing/unboxing

    Primitives can now be used directly, allowing for easier to maintain rules and also for better performance


    Support to Templates:

    Fact Templates can now be used and allow you to define Facts in your drl that can be used in your rule, without the need for a pojo.

    template Cheese
        String  name
        Integer price
    rule "Match Stilton"
          $stilton : Cheese( name == "stilton" )
          $stilton.setFieldValue( "price", new Integer( 200 ) );
          list.add( $stilton );


    Support to additional predicate syntax:

    You no longer need to use the -> syntax directly after a variable binding. Now a predicate is simply a bracketted expression after a comma and the engine resolves the variables it needs, Pattern( $var1 : attr1, $var2 : attr2, ( $var1.blabla() != $ ) )




    Shadow facts:

    Shadow Facts allow the system to work in a multi-threaded environment, and for changes to take place outside of the engine. Each value is shadowed inside the engine, and is only updated at "safe points". So the integrity of the engine is never compromised.


    Support to constraints between fields of the same object:

    Previously a bound variable could only be used in the following pattern, they can now be used in the pattern they are defined in.


    Performance improvements

    JBoss Rules is now much faster than before, and uses less memory.


    Specialized "exists" node for performance:

    Traditional Rete based systems implement two Not nodes for "exists", we found that having a dedicated Exists node improvement performance and make for a simpler Rete network.


    IDE Summary


    The IDE now supports debugging rules: breakpoints can be added in drl files for rule right-hand side (consequences) and inside functions. Whenever a rule breakpoint is encounter during debugging, the corresponding rule is shown, and you can step through. Rule debugging is completely integrated with standard java debugging, so both can be used at the same time.




    A new Rules view allows you to get a quick overview of all the rules, functions, queries, functions and globals in your workspace. You can also quickly navigate to them by double clicking the selected element.




    Support for the new language features (like from, collect, accumulate) has also been included, and the IDE has been updated to support all other changes to the core. And continuously improving and fine-tuning other functionality, like adding filtering to the outline (and rules) view, (configurable) caching of parser results, etc.





    There has been a regression for M1, already fixed for upcoming M2.