[rules-users] Precompilation of Rule Flows

Kris Verlaenen kris.verlaenen at cs.kuleuven.be
Mon Dec 1 13:07:41 EST 2008


[The following answers are based on the latest Drools 5 M3 code.]

> 1) I am assuming that when creating the constraints within a given node
> within a rule flow that the selection of "rule"  as the type will create a
> rule behind the scenes while selection of "code" will create some java
> object representation? If this is a correct understanding is there any
> preference from an engine perspective, are there performance or other
> considerations that must be taken into account?
Correct.  There are of course performance implications.  If you have a very 
simple
constraint like x > 3 (where x is for example a process variable), we 
recommend
simply using a code constraint. Rule constraints however do offer you a more
expressive constraint language and can reason about data in the working 
memory
as well.  This however has a small performance inpact.

> 2) Is there any way to precompile rule flows like rule files are (as 
> opposed
> to at runtime with a call to packageBuilder.addRuleFlow(source))? With the
> Drools builder any errors in the .drl files are highlighted. Not so with 
> the
> .rf.  In order to see what is generated it appears that you have to step
> through in debug mode at runtime and buried inside there is a string
> representation of everything that was generated as well a list of errors
> which refer to errors such as parse errors. Unfortunately this manifests
> itself eventually (at least with my flow) as a NullPointerException giving
> absolutely no indication as to the root of the problems, which I am 
> assuming
> are these parser errors. Seems to me that these errors should be returned
> with a call to packageBuilder.hasErrors() which is empty in my case.
There seems to be an error where rule compilation errors are not always 
shown
by the Drools Builder.  I have however just fixed this in trunk.  This means 
that
any errors in the process should now be detected by the Drools builder, and 
are also
added to the packageBuilder errors.  So runtime exceptions should not occur 
if
you check for errors after parsing.  Could you open a JIRA or send me the
ruleflow if you find an error that is still not detected during compilation?

> 3) Code assist doesnt appear to work in action editor or constraint editor
> which is I think is a pretty big usablity issue. Anything planned to make
> this available?
This is also supported in the latest Drools 5 M3.  Note that you will first 
need to
import the necessary fact classes to get useful code completion in rule 
constraints.

Kris 




More information about the rules-users mailing list