6 ms·
I've used Drools: http://www.jboss.org/drools/ http://www.jboss.org/drools/ It's a deductive rules engine for Java, so you give it some objects with state and
by tansey 16y ago
I've used Drools: http://www.jboss.org/drools/ http://www.jboss.org/drools/
It's a deductive rules engine for Java, so you give it some objects with state and apply a set of first-order(ish) logic rules to them, in an if-then kind of form. You can give rules different precedence levels to create a sort of cascading effect.
Rules are stored in plain text, but they're read in and compiled into memory for efficient execution. Defining your own DSL spec is a breeze. Your rules are executed in the rest of the application with a few simple method calls. It integrates with Java in a really slick way, so you can work with POJOs and your rules operate on them.
It's a pretty cool DSL creator, actually. I used it in a research project by integrating it with the Eclipse JDT and creating a DSL for source code manipulation. Then I hooked it up to a little inference algorithm we created, and the result was a plug-in which could take a before and after piece of code, analyze the difference between the two (specifically in the case of adding annotations to legacy code), and generate a set of Drools rules that could automatically migrate similar legacy classes. See page 5 of our paper for an example of how our DSL rule base looked: http://people.cs.vt.edu/~tilevich/papers/rosemari-oopsla.pdf http://people.cs.vt.edu/~tilevich/papers/rosemari-oopsla.pdf