Blog Posts

Introducing Drools Fiddle

Blog: Drools & jBPM Blog

Drools Fiddle is the fiddle for Drools. Like many other fiddle tools, Drools Fiddle allows both technical and business users to play around with Drools and aims at making Drools accessible to everyone. 


The entry point to Drools Fiddle is the DRL editor (top left panel), which allows to define and implement both fact models and business rules, using the Drools Rule Language. Once the rules are defined, they can be compiled into a KieBase by clicking on the Build button.

If the KieBase is successfully built, the visualization panel on the right will visualize the fact types as well as the rules as graph nodes. For instance, this DRL will be displayed as follows:

declare MyFactType
    value : int
end


rule “MyRule”
when
   f : MyFactType(value == 42)
then
   modify( f ) {setValue( 41 )}

end



All the actions that are performed on the working memory will be represented by arrows in this graph. The purpose of the User icon is to identify all the actions performed directly by the user. 

For example, let’s see how we can dynamically insert fact instances into the working memory. After the KieBase compilation, the Drools Facts tab is displayed on the left:


This form allows you to create instances of the fact types that have been previously declared in the DRL. For each instances inserted in the working memory a blue node will be displayed in the Visualization tab. The arrow coming from the User icon shows that this action was performed manually by the user.

Once your working memory is ready, you can trigger the fireAllRules method by clicking on the Fire button. As a result, all the events occurring in the engine: rule matching, fact insertion/update/deletion are displayed in the visualization tab.

In the above example, we can see that the fact inserted by the user in step 1 triggered the rule “MyRule” which in turn modified the value of the fact from 42 to 41.

Some additional features have been implemented in order to enhance the user experience: 

So far, only the minimum set of functionalities have been implemented to showcase the Drools Fiddle concept but there are still a lot of exciting features in the pipe:

  • Multi tabbed DRL editor
  • Decision  table support
  • Sequence diagram representation of rule engine events
  • Fact history visualization
  • Improvement of log events visualization
  • KieSession persistence to resume stateful sessions
  • Integration within Drools Workbench
The source code of Drools Fiddle is available on GitHub under Apache v2 License and you can access the application at http://droolsfiddle.tk. Should you wish to contribute, pull requests are welcome 😉

We would love to have the feedback of the Drools community in order to improve the fiddle and make it evolve in the right direction.
by Julien Vipret & Matteo Casalino

Leave a Comment

Get the BPI Web Feed

Using the HTML code below, you can display this Business Process Incubator page content with the current filter and sorting inside your web site for FREE.

Copy/Paste this code in your website html code:

<iframe src="https://www.businessprocessincubator.com/content/introducing-drools-fiddle/?feed=html" frameborder="0" scrolling="auto" width="100%" height="700">

Customizing your BPI Web Feed

You can click on the Get the BPI Web Feed link on any of our page to create the best possible feed for your site. Here are a few tips to customize your BPI Web Feed.

Customizing the Content Filter
On any page, you can add filter criteria using the MORE FILTERS interface:

Customizing the Content Filter

Customizing the Content Sorting
Clicking on the sorting options will also change the way your BPI Web Feed will be ordered on your site:

Get the BPI Web Feed

Some integration examples

BPMN.org

XPDL.org

×