JBoss Community

Drools Expert

Code Examples


Flexible use of field constraint connectives:

  Person(age > 30 && < 40 || hair == "black")


Auto vivification of field constraints in evals and return value constraints, without previous bindings to the field:

  Cheese(newPrice == ( oldPrice * 1.10 ))


Supports both infix and prefix and/or conditional elements:

  Person(name == "matthew") or Person(name == "john")
  (or Person(name == "matthew")  Person(name == "john") )


Field constraints on bound pattern's fields, without having to explicitly bind the field first:

  p: Person() i: Item(id == p.id, value > 100) 


Map accessor:

  Person(pets["rover"].type == "dog")


Forall:

  forall(Bus (color=="red"))


From used to reason over a nested collection:

  $owner : Person( name == "mark" )  Pet( name == "rover" ) from $owner.pets


From used to reason over an expression result:

  $zipCode : ZipCode() Person( ) from $hbn.getNamedQuery("Find People")  .setParameters( [ "zipCode" : $zipCode ] )  .list()


From used to constrain the results of an accumulate

  Number( intValue > 100 )   from accumulate( Bus( color == "red", $t : takings ),  sum( $t ) )


Advanced syntaxing showing the nesting of conditional elements using from using from

  $zipCode : ZipCode() $list : Number( intValue > 100 )   from accumulate( Bus( color == "red", $t : takings )   from $hbn.getNamedQuery("Find Buses")  .setParameters( [ "zipCode", $zipCode ] )  .list(),  sum( $t ) )


Eclipse authoring with DSL code completion

/drools/drools-expert/mainColumnParagraphs/0/image/portugues_rule.png

Side by side ruleflow authoring with rules

/drools/drools-expert/mainColumnParagraphs/01/image/ruleflow_numberguess.png

Interactive Debugging

/drools/drools-expert/mainColumnParagraphs/02/image/helloworddebug.png

Guided Editor

/drools/drools-expert/mainColumnParagraphs/03/image/guidededitor1.png

Decision Tables

/drools/drools-expert/mainColumnParagraphs/04/image/decision_tables.png