Discussions

News: Drools 2.1 Released

  1. Drools 2.1 Released (53 messages)

    The Drools development team is proud to announce the release of Drools 2.1. Drools is a Rete-based Rules Engine written in Java, but able to run on Java and .Net.

    Release highlights include:
    • Excel Decision Tables
    • Spring and POJO integration
    • Xor Group
    • Improved exception handling via JDK1.4 Nested Exceptions
    See the Release Notes for more details.

    For a great introduction article read Using Drools in Your Enterprise Java Application by Paul Browne.

    Drools is designed to allow pluggeable language implementations. Currently rules can be written in Java, Python and Groovy. Drools also enables Domain Specific Languages (DSL) via XML using a Schema defined for your problem domain. DSLs consist of XML elements and attributes that represent the problem domain. An XML Authoring tool provides a semi-rapid development environment with a drag and drop type interface based on the provided Schema.

    The Project Downloads page contains full information on obtaining Drools.

    Support, consultancy and training for Drools are available from Iterion.

    Threaded Messages (53)

  2. Drools 2.1 Released[ Go to top ]

    .Net????
    :)

    Really, that is good news. I do work in both enviroments and it is nice to have the same set of tools available in both.
    Drools, [N]Hibernate, JUnit/NUnit, Ant/NAnt, Spring[.Net], etc.

    I look forward to the new release.
  3. .. its open source![ Go to top ]

    .Net???? :)

    if you want to step up and do the port, no-one on the drools team will stop you. or you can always use something like ikvm to just run the java version :)
  4. .. its open source![ Go to top ]

    .Net???? :)
    if you want to step up and do the port, no-one on the drools team will stop you. or you can always use something like ikvm to just run the java version :)
    Hmm. Thought the orignal post said it would work with .Net. Hence my jest and comment.
  5. .. its open source![ Go to top ]

    .Net???? :)
    if you want to step up and do the port, no-one on the drools team will stop you. or you can always use something like ikvm to just run the java version :)
    Ahhh. I see I should have clicked the .Net link and read further.
  6. The purpose of a rule engine is to "externalize" the business logic so it can be manipulated "outside" of the main code, is not it? Possibly even by non-programmers.

    So what is the point of a rule engine system where rules themselves are written in programming language and require programming expertize to manipulate? Would not I be better off by not using a rule engine and instead simply organizing biz logic in some kind of chain-of-command based code, possibly with command configuration stored "outside", in XML?
  7. The purpose of a rule engine is to "externalize" the business logic so it can be manipulated "outside" of the main code, is not it? Possibly even by non-programmers.So what is the point of a rule engine system where rules themselves are written in programming language and require programming expertize to manipulate? Would not I be better off by not using a rule engine and instead simply organizing biz logic in some kind of chain-of-command based code, possibly with command configuration stored "outside", in XML?

    Agreed. Isn't it much simpler to create rules in Groovy or any other scripting language, thereby satifying the "externalization urge" and not being beholden to another XMLized framework?
  8. general question for the rule-engine crowd[ Go to top ]

    The purpose of a rule engine is to "externalize" the business logic so it can be manipulated "outside" of the main code, is not it? Possibly even by non-programmers.So what is the point of a rule engine system where rules themselves are written in programming language and require programming expertize to manipulate? Would not I be better off by not using a rule engine and instead simply organizing biz logic in some kind of chain-of-command based code, possibly with command configuration stored "outside", in XML?
    Agreed. Isn't it much simpler to create rules in Groovy or any other scripting language, thereby satifying the "externalization urge" and not being beholden to another XMLized framework?

    Ariba(ERP system) uses javascript for complex business rules and drag-and-draw UI for chain rule. However, most of rules are still based on javascript which is essentially calling java APIs. In other words, I haven't seen any rule engine that doesn't require programming skill to be fully managed.

    sithu
  9. The purpose of a rule engine is to "externalize" the business logic so it can be manipulated "outside" of the main code, is not it? Possibly even by non-programmers.So what is the point of a rule engine system where rules themselves are written in programming language and require programming expertize to manipulate?

    I'm just getting into rules using Jess, and my impression is that understanding rules is harder, not easier, than straight programming.

    The first thing I would think about would be efficency...Rete is intended to increase efficiency because already computed nodes are not re-computed again and again. I've heard it said that Rete scales much better as rules are added than alternatives, such as you suggest.

    We're looking at rules inside of Agents, that's the first application I've come across, I'm interested to hear how rules are being applied nowadays in ERP systems, etc.

    One problem I see straight away is the conversion that can be required to take external data and assert it into a rules knowledge base. In our case, we have Jena-based schema the Agent already sits on top of, and now we're plugging in Jess, which has it's own KB.

    I have played a small bit with OwlJessKb, but want to get some traction on rules at first. Not an insolvable problem.

    I'll show just how stupid I really am by pointing to what I just blogged on rules and agents.....god help me...hope that adds something to the discussion. At least this is an example of what Jess rules look like:

    http://www.unc.edu/~mconway/mt_static/archives/2005/10/rule1_dont_ever.html#more
  10. The purpose of a rule engine is to "externalize" the business logic so it can be manipulated "outside" of the main code, is not it? Possibly even by non-programmers.So what is the point of a rule engine system where rules themselves are written in programming language and require programming expertize to manipulate?

    I'm just getting into rules using Jess, and my impression is that understanding rules is harder, not easier, than straight programming.The first thing I would think about would be efficency...Rete is intended to increase efficiency because already computed nodes are not re-computed again and again. I've heard it said that Rete scales much better as rules are added than alternatives, such as you suggest.We're looking at rules inside of Agents, that's the first application I've come across, I'm interested to hear how rules are being applied nowadays in ERP systems, etc.One problem I see straight away is the conversion that can be required to take external data and assert it into a rules knowledge base. In our case, we have Jena-based schema the Agent already sits on top of, and now we're plugging in Jess, which has it's own KB. I have played a small bit with OwlJessKb, but want to get some traction on rules at first. Not an insolvable problem.I'll show just how stupid I really am by pointing to what I just blogged on rules and agents.....god help me...hope that adds something to the discussion. At least this is an example of what Jess rules look like:http://www.unc.edu/~mconway/mt_static/archives/2005/10/rule1_dont_ever.html#more

    Since I'm totally opinionate on this topic, here is my .2 cents worth. Writing rules for non programmers is still a difficult task. Even though commercial products offer tools for pseudo-natural language, it is still very hard to "get right." having written rule compilers that take pseudo-natural language and generate declarative rules, it's a difficult task.

    I say "pseudo natural language" because the language is usually a small set of grammatical structures with a fixed number of terms. Generally, the grammar is mapped to a corresponding rule template, which describes the type of pattern. A pattern in this case would be x object in a specific grammatical structure. For example, "if the order meets x conditions, then calculate discount." would be one template. "if the customer meets x conditions and order meets y conditions, then calculate discount." would be another rule template.

    For me, externalizing the rules isn't the primary goal of using a rule engine. The primary purpose of using a rule engine should be efficiency and flexibility. Using hardcode if/then/else statements isn't too flexible, but in the hands of a top notch programmer it can be very fast and arguably as fast or faster than a rule engine. Assuming the programmer has unlimited time to optimize the execution for a fixed set of rules. If the ruleset changes frequently and the system can't tolerate a big drop in performance, than a rule engine is a good way to go. One problem RETE rule engines solve well is dynamic environments where new facts are introduced during the evaluation cycle. Since RETE rule engines are finite state machines, it remembers what has been evaluated.

    In practice, adding new rules to a live production system is dangerous, and needs to be handled with care. It's very easy to write a bad rule and take down the production servers.

    Perhaps the hardest part about writing efficient rules that take advantage of rule chaining is learning to think in terms of pattern matching. I've seen plenty of cases where people just don't think that way and have a hard time. I think RETE is great, but it doesn't magically solve problems. the developers still have to understand how RETE works and write rules to take advantage of rule chaining.

    peter
  11. which rule engine should I choose ?[ Go to top ]

    We are developing a product that requires a embedded rule engine. I have played a bit with JESS rule engine. But have not dive into other open source engine yet.

    We have also looked at other commercial rule engines: especially JRule from ILog and Blaze from Fair Issac. They are good products. But I felt it's a bit overkill for our
    product. So we are looking for a free open source rule engine that can be embedded in it.

    Which open Rule engine would you recommended for production use in a non-mission-critial (unlike financial application) type of product ? And Why ?

    so far I am pondering between Jess and Drool. This is simply because I don't know any better. There are a whole list of open source rule engines:

    http://www.manageability.org/blog/stuff/rule_engines/view

    I don't know their current state, developer community, maturity, support, documentation etc.

    Any one has experience with different rule engines are wellcome to share his/her experience/impression/recommendation.

    Thanks a lot.


    Chester
  12. which rule engine should I choose ?[ Go to top ]

    I am not sure that Jess is free to use .. I think only free for development and academic use. Drools is free .. something that should be considered.
  13. which rule engine should I choose ?[ Go to top ]

    We are developing a product that uses Drools. I didn't even look at Jess because of its license. But even then I liked what saw in Drools. I did consider Mandarax, but based on what Peter said (and that he is so smart AND does stuff for Drools :) ), I decided to go with Drools.

    What I have found while hand coding the rules are certain patterns to my rules - specific to our application. I also found that I could extract common code back into my Java code base. I believe I can now code a UI that will allow a technical business analyst to visually create the rules. I don't know yet if I will actually store them in the Drools format or a much more generic format. The reason being I'll need to be able to pull the rules back into the design UI. I would use the Decision Tables but I think it is still too free form for my purpose.

    I would suggest making sure you can fully exercise your rules before making a big pile of rules. Make sure it all works together and that way you can test as you develop.
  14. which rule engine should I choose ?[ Go to top ]

    <code>
    What I have found while hand coding the rules are certain patterns to my rules - specific to our application. I also found that I could extract common code back into my Java code base. I believe I can now code a UI that will allow a technical business analyst to visually create the rules. I don't know yet if I will actually store them in the Drools format or a much more generic format. The reason being I'll need to be able to pull the rules back into the design UI. I would use the Decision Tables but I think it is still too free form for my purpose
    I would suggest making sure you can fully exercise your rules before making a big pile of rules. Make sure it all works together and that way you can teslt as you develop.
    </code>

    Mark, thank sharing your experience.

    Decision Table is one thing I am going to experiement with. We are planning to store the rules in Database so it can be admin and managed in distributed manner. I assume Drool (or it's format) does not prevent this.

    Also, do you use AOP to separate/glue the Rule Engine and Java Code as Suggest in the book : AspectJ in Action ?


    thanks

    Chester

    Chester
  15. which rule engine should I choose ?[ Go to top ]

    ...Also, do you use AOP to separate/glue the Rule Engine and Java Code as Suggest in the book : AspectJ in Action ? thanksChesterChester
    No AOP yet. I hope to do something like that, but not for this release. And currently, my rules are applied in one place.

    I would have used the Decision Tables - I do like them - but I want "users" to be able to drag and drop instances of POJOs.

    BTW, anyone know the link to download the newest version of the D.T.s? I must be blind, cause I no can find.
  16. which rule engine should I choose ?[ Go to top ]

    We are developing a product that uses Drools. I didn't even look at Jess because of its license. But even then I liked what saw in Drools. I did consider Mandarax, but based on what Peter said (and that he is so smart AND does stuff for Drools :) ), I decided to go with Drools.What I have found while hand coding the rules are certain patterns to my rules - specific to our application. I also found that I could extract common code back into my Java code base. I believe I can now code a UI that will allow a technical business analyst to visually create the rules. I don't know yet if I will actually store them in the Drools format or a much more generic format. The reason being I'll need to be able to pull the rules back into the design UI. I would use the Decision Tables but I think it is still too free form for my purpose.I would suggest making sure you can fully exercise your rules before making a big pile of rules. Make sure it all works together and that way you can test as you develop.

    thanks for the compliment, I'm pretty sure I don't deserve or earned it. in the past, I used RuleML as the markup for rule editors. For me, it worked well and made it easier to map UI widgets to ruleml atoms. the benefit of RuleML for me is it defines types of conditions. For example, RuleML defines the following condition types (http://www.ruleml.org/0.89/).
    formula
    var
    ind

    Having said that, it does take a bit of patience to understand RuleML and many people find it un-intuitive. One thing about ruleml that throws people off is that ruleml Body is the conditions (aka left-hand side) and Head is the actions (aka right-hand side). Depending on the kind of application one needs to build and the skills of the developers, it may be easier to just make your own language. Though creating a rule language can be a huge task by itself.

    peter
  17. which rule engine should I choose ?[ Go to top ]

    We are developing a product that requires a embedded rule engine. I have played a bit with JESS rule engine. But have not dive into other open source engine yet. We have also looked at other commercial rule engines: especially JRule from ILog and Blaze from Fair Issac. They are good products. But I felt it's a bit overkill for our product. So we are looking for a free open source rule engine that can be embedded in it.Which open Rule engine would you recommended for production use in a non-mission-critial (unlike financial application) type of product ? And Why ?so far I am pondering between Jess and Drool. This is simply because I don't know any better. There are a whole list of open source rule engines: http://www.manageability.org/blog/stuff/rule_engines/viewI don't know their current state, developer community, maturity, support, documentation etc.Any one has experience with different rule engines are wellcome to share his/her experience/impression/recommendation. Thanks a lot. Chester

    JESS is a commercial product, so it definitely is not free. If you expect to have hundreds or even thousands of rules, Drools may not be fast enough. Drools has come a long way and mark proctor has done a ton of solid work, but we still have a ways to go. Since the current implementation doesn't store alpha memory it is good for cases where facts do not change during the evaluation cycle. one of the benefits of having alpha memory is the cost of retracting/modifying facts, so as long as your project doesn't use a lot of rules and doesn't modify facts, performance should be acceptable.

    peter
  18. which rule engine should I choose ?[ Go to top ]

    Peter
       thanks for the deep insight on Drool. Yes, I am aware of Jess is not free (sorry I did not make it clear in my previous post). Since Jess is JSR-94 reference implementation and there is a book on it (Jess in Action), it has some edge on that front.


    Chester
  19. which rule engine should I choose ?[ Go to top ]

    looks like drools has got a book on the way
    http://www.apress.com/book/bookDisplay.html?bID=10065&APRESSESSID=300648ebfdb6f0f32977b6de998f650b
  20. which rule engine should I choose ?[ Go to top ]

    Does JESS have any advantages over Drools ?

    Thanks.
  21. Advantages over Jess?[ Go to top ]

    Yes, it will make you poorer due to the licensing costs ;-).
  22. Advantages over Jess?[ Go to top ]

    LOL
  23. I guess idea is to write your own "language" or tool which will translate your grammar to normalized XML of Drools. Look for Doman Specific Languages in Drools documentation.

    My concern is different. I know where I CAN use Drools. Security evaluation rules, discount calcucations, ... . However is't here somebody who use Drools in real system a for which puprose?

    TNX
  24. Rules aren't really designed to eliminate programming, but they are designed to make certain types of programming easier to use.

    Let's take a simple Health Care example.

    BMI is the Body Mass Index, a routine indicator that is based on your height and weight. There are different thresholds for "underweight", "normal", "overweight" and "obese".

    Say you want a rule such as:

    IF BMICAT == "OBESE" THEN
        ALERT "You need to lose weight!"
    END IF

    As presented, that is a pretty straight forward rule.

    The detail is that BMICAT isn't really defined anywhere. It's defined by another rule:

    IF BMI > 30 THEN
        BMICAT = "OBESE"
    END IF

    and then, of course, BMI is calculated:

    BMI = weight / (height^2)

    All of these are fairly simple rules.

    But the power of the rule system is this. When I enter a new weight, since BMI is dependent on weight, it gets recalculated. Since, BMICAT is dependent on BMI, it gets recalculated, and since the "Obese Alert" rule is dependent on BMICAT, it gets evaluated.

    All of that logic happens "for free" when weight is changed. The relationship and dependancies between the rules are implied, whereas in typical code, those relationships are explicit.

    Now, there are two kinds of rule systems (and some mix the types). A forward chaining system is much like I described. Changes to the base data fires rules based on the the dependencies. The changes move forward through the system.

    A backward chaining system is one that you ask questions of. So for this contrived case, let's rewrite the Obese Alert Task to such:

    IF (BMICAT == "OBESE") THEN
        CURRENT_OBESE_TASK = "You need to lose weight";
    ELSE
        CURRENT_OBESE_TASK = NULL;
    END IF

    Now, I would ask "what is the CURRENT_OBESE_TASK", and the rule system would say "To get CURRENT_OBESE_TASK, I need BMICAT. To get BMICAT, I need BMI..." etc., working its way back to eventually getting the weight and height. The rule system works down the tree to find the data that it requires.

    Again, the relationships determine the fire order rather than how the code is entered in to the system (like in normal programming). You can, ideally, enter the rules in any order you wish.

    So, the point is that with a rules based system, it can be a more declaritive system that is more fluid and easier to change than the typical rigidity of a normal programming language. On the other hand, they can be a bugger to debug!

    There is a lot of simplicity is dealing with the individual rules as they are rather then with the whole interdependent mess. But you will always need to understand the interdependencies at some level when creating new rules.

    As far as externalizing the rules, since typically the rule engine is the compiled code, the rules tend to be "data", loaded through an external mechanism. This allows you to change and adapt rules "on the fly" by simply loading in a new rule set, or making a change to the loaded set.
  25. Thank you for a good "Rule Engines for dummies". Rule Engines stem from AI world, and they are doing a very good job for handling logic that is otherwise too difficult to handle with traditional if-else statements.

    IMHO, the question is not whether Rule Engines are good, but rather is the implementation technique good? I have looked at several rule engines, and most of them use some sort of unsafe programming model like XML, scripting language etc. Allow me to explain what I mean:

    In my experience, managing rules requires some degree of programming skills. So using a declarative language like XML does not help non-programmers to maintain the rule, except if the rules are very simple. I have seen many such examples, even for a programmer, the XML style is too complex to understand. Besides, the debugging is too difficult with XML. Many projects end up writing some tool to validate the XML rules, and obs we are writing a compiler! The next level is to some scripting language. Why? because we feel scripting languages are more simple for average programmer to use. But again, you hand over a lot of control to the runtime environment, things that could be handled at compile but a programming language like Java.

    In my opinion, rule engines should provide two interfaces: light and heavy. The light interface could be based on XML or a simple scripting language. The heavy interface should be based on a programming language like Java.
  26. Since you have looked at server rule engines, can you recommend one ? which one are you using (or used before) ?
  27. Thank you for a good "Rule Engines for dummies". Rule Engines stem from AI world, and they are doing a very good job for handling logic that is otherwise too difficult to handle with traditional if-else statements.IMHO, the question is not whether Rule Engines are good, but rather is the implementation technique good? I have looked at several rule engines, and most of them use some sort of unsafe programming model like XML, scripting language etc. Allow me to explain what I mean:In my experience, managing rules requires some degree of programming skills. So using a declarative language like XML does not help non-programmers to maintain the rule, except if the rules are very simple. I have seen many such examples, even for a programmer, the XML style is too complex to understand. Besides, the debugging is too difficult with XML. Many projects end up writing some tool to validate the XML rules, and obs we are writing a compiler! The next level is to some scripting language. Why? because we feel scripting languages are more simple for average programmer to use. But again, you hand over a lot of control to the runtime environment, things that could be handled at compile but a programming language like Java.In my opinion, rule engines should provide two interfaces: light and heavy. The light interface could be based on XML or a simple scripting language. The heavy interface should be based on a programming language like Java.

    in terms of "safety", I think this is one area where the industry needs a lot more work. one of the things I worked on in the past is automated rule validation. since rule engines make it easier to add new rules to the production system, it's also easier to shoot yourself in the foot with a canon. without some kind of functional/regression testing or automated validation, doing bad things is rather easy. given that humans make mistakes, the balance between "release now" and go through an intensive QA process is always a difficult decision. there are plenty of horror stories in the industry about analysts publishing new rules without going through regression and killing the production systems.

    Most commercial rule engines do provide a light and heavy interface. the light interface is usually a pseudo natural language interface and the heavy is the primary rule language. JESS currently lacks a light interface and is primarily focused on developers. That has been the primary focus of JESS since the beginning. iLog has been one of the leaders in the rule IDE area, but there's still a long way to go in my bias opinion. hopefully the industry will move towards creating domain specific language for the popular domains, so that rule translation and interchange is easier.

    peter
  28. Agree,XML does not help non-developer to express rules
    and we should see in the near future dedicated UI to generate/manage rules.I guess,the UI may cover 90% of
    the rules creation and the remaining may be covered by a scripting language such as groovy .

    Last year,when I have investigated the usage of Drools to replace a commercial personalization engine ,I did notice
    a project on the top of Drools which is supposed to facilitate the creation/management of rules.
    Is it still a commercial produt or is it an open-source ?

    Claude Hussenet
    Independent Consultant
    http://claudehussenet.com
  29. Agree,XML does not help non-developer to express rulesand we should see in the near future dedicated UI to generate/manage rules.I guess,the UI may cover 90% ofthe rules creation and the remaining may be covered by a scripting language such as groovy .Last year,when I have investigated the usage of Drools to replace a commercial personalization engine ,I did noticea project on the top of Drools which is supposed to facilitate the creation/management of rules.Is it still a commercial produt or is it an open-source ?Claude HussenetIndependent Consultanthttp://claudehussenet.com

    I think you mean Zymose (DRLAssistant)? It is still commercial AFAIK.

    There is work in progress for this "value added" stuff on top of drools to turn it into a full blown "BRMS" (business rule management system - not sure if ILog invented that term ! but kudos to them if they did). Watch this space.

    Yes Groovy is a fantastic language for rule fragments. Drools supports it. Its support for properties and general type-less friendliness make for very human readable rules. I would be interested in hearing about anyone using groovy for a large rulebase.
  30. We use a rules engine since some logic is intrinsically tied to our data. (e.g. user X can do 123, user Y can do 456, user Z can't do anything, etc.) So we basically can store lots of custom logic for individual users. Arguably we can probably do this without a rules engine, but this probably seemed more straight-forward at the time. We also get the benefit of changing logic in production without having to go through the QA/release process that we normally need to do. Of course, the power of this tool also makes it potentially dangerous and since we're not dealing with compiler and are using a psuedo-language it's also more difficult to maintain and enhance. The user never touches it. Personally, I would only use it if you really can't get away from it. (e.g. job security through obscurity or resume padding ;) )
  31. Paul,

    I think you make an interesting observation. My position on this is that there is a big difference between rule engine technology for developers and business rules for policy managers. If developers are writing and maintaining rules and the rules are strongly tied to the underlying object model (Java classes for example) the benefits are typically restricted to relatively narrow domains where high performance pattern matching is required. These might be areas like alarm filtering and correlation in the telco world for example.

    If however policy managers own, manage and define the rules, and the rules are relatively indepedent of the underlying implementation, then you open up a whole new range of benefits. As a business you have a formal description of how your business operates, one that can be mapped onto implementation classes and executed. The business rules can evolve and the implementation classes can evolve on linked, but seperable, evolutionary cycles.

    You have seperated the "What from the How". It is hard to overstate the importance of this in my opinion. Having your business policy defined in an ad-hoc way in scattered document and as a side-effect of rushed implementation choices is not rational in the fast changing world we live in.

    Ok, time to get off my soap box! :-)

    Daniel Selman
    (ILOG - http://www.ilog.com/products/jrules/)
  32. RETE-based[ Go to top ]

    In case some people are new to rule engines. Drools is a forward chaining engine and is like RETE, but currently is not strict RETE. We are currently working on strict RETE, so it will get there eventually. Some of the limitations of not being strict RETE is that as the number of rules increase, the performance drops. We are also working on a number of optimizations that should make future version of drools considerably faster.

    peter
  33. documentation[ Go to top ]

    Ok, drools is good. but like all the codehaus projects on site documentation are seriously lacking.
    instead of spreading to different platforms or languages for sake of just doing it, do one thing good, focus on at least java documentation.
  34. Business Rules for Java[ Go to top ]

    First I wanted to plug the good info at http://www.javarules.org for people new to this subject area.

    The main reason I find business rules fun and challenging is that it gets to the heart of the biggest hurdle in building good IT systems -- making programmers and "business types" work together to define and implement a solid system.

    A business rules approach can have a range of benefits, depending on the domain:
    - documentation (what is your business policy?)
    - time travel (apply the busines policy you had two years ago)
    - reuse (business rules are more atomic and more independent of context than most code)
    - performance (in some domains)
    - agility (business rules are expressed in business terms and owned by the business)
    - static analysis (it is easier to do some forms of advanced static analysis on business rules than code)
    - temporal object model evolution (something like Java really struggles here)

    My general observation, after a few years, is the business rules approach is slowly helping us solve some of the process related issues in the development cycle. Developers should concentrate on "platform and middleware" issues (things like integration, messaging, user interface, performance, transformation) while policy managers should be responsible for business policy.

    Of course you need synchronization and interplay between the two groups, but the old model of the "business" throwing requirements ("increase the discount on widgets by 10% and add a new bundle type for doodads") to IT is thankfully coming to an end. Using the old model, IT is simply not able to respond fast enough to keep the business competitive.

    I have never met a developer than enjoyed implementing business policy anway! Why do you think there are so many frameworks for wiring hunks of code together and so few for expressing business policy? ;-)

    Daniel Selman
    (ILOG)
  35. Benefits of Rule Engines[ Go to top ]

    I see the benefits of business rules in much the same way I see the benefits of Dependency Injection frameworks. In a similar way that a DI factory can assist in instantiation of an object and it's dependencies (like DB connections, other business logic objects, etc), the "then" portion of business rules are also dependencies.

    For example, there may be an ApplyDiscount business object which under various circumstances applies different discounts. Without a rule engine, it might have to go to different fields in various tables (see if the client is a preferred client, or has purchased items before, etc) to determine the appropriate discount rate. With a rule engine, that "dependency" is externalized and the business object is provided that information. This makes ApplyDiscount MUCH easier to test because the application of the discount is decoupled from the calculation of the discount. This separation is what is driving me to try to make use of a rule engine in our development.
  36. Benefits of Rule Engines[ Go to top ]

    Wow, I did not expect my question would create such a lively discussion.

    It is funny you mentioned Dependency Injection. I wrote an article a while back discussing the parallels between Rule Engines and DI frameworks and built an example using Spring and Spring context as rule repository:

    http://www.javaworld.com/javaworld/jw-04-2005/jw-0425-ruleengine.html

    This also can be example of a programmer-oriented rule processing system.
  37. I wish that was true[ Go to top ]

    Of course you need synchronization and interplay between the two groups, but the old model of the "business" throwing requirements ("increase the discount on widgets by 10% and add a new bundle type for doodads") to IT is thankfully coming to an end.
    ;-)
    Daniel Selman(ILOG)

    I totally agree the old method of throwing requirements over the wall and developers implementing said requirements is terrible. Unfortunately, many businesses are still blind and doing things the same old way. For developer's sake, I'll pray that style of development is coming to an end. So far, my experience is a mixed bag. When the product managers are technical and act as a bridge between business guys and developers, it works well. When product managers are ignorant and don't work well with the business guys, the same problems occur. In those cases, using a rule engine doesn't help :) Actually, it can make the situation worse since the business guys will falsely believe a rule engine means they can change their minds every other day. Then again, bad management isn't a technical problem.

    peter
  38. XML[ Go to top ]

    I have been told there is a non XML DRL format in the works. If you are slightly dyslxecic like me then all the angle brackets can cause headaches if editing manually. This non XML format will possibly use some of the language features of Groovy.

    PS good to see Daniel from ILog popping in - any word on ILogs take on RuleML?
  39. RuleML[ Go to top ]

    I think RuleML is great work. They have done more than anyone to gather rules requirements from the various communities and try to unify them. That said, personally I am one of those people Peter mentioned that find RuleML a challenge to understand!

    At the moment ILOG is working with the RuleML group and the W3C to try to define a pragmatic XML standard for rules exchange:
    http://www.javarules.org/index.php?name=News&file=article&sid=98

    The OMG also has some interesting work underway both at the model and the business vocabulary level. So I am hopeful we will get some useful standards in the medium/long term -- but with so many stakeholders and defintions of "rules" the work is bound to be complex.

    Daniel Selman
    (ILOG)
  40. RuleML[ Go to top ]

    I think RuleML is great work. They have done more than anyone to gather rules requirements from the various communities and try to unify them. That said, personally I am one of those people Peter mentioned that find RuleML a challenge to understand!

    At the moment ILOG is working with the RuleML group and the W3C to try to define a pragmatic XML standard for rules exchange:http://www.javarules.org/index.php?name=News&file=article&sid=98The OMG also has some interesting work underway both at the model and the business vocabulary level. So I am hopeful we will get some useful standards in the medium/long term -- but with so many stakeholders and defintions of "rules" the work is bound to be complex.

    Daniel Selman(ILOG)

    I'm hopeful the OMG Object oriented Production Rules standard will be more fruitful than the W3C efforts. W3C has been trying to come up with a standard since 2K and they're still pushing RDF triples. Given a choice, my preference is for CLIPS syntax. It's compact, simple and easy to parse from a rule compiler perspective. I like RuleML, but there's definitely a learning curve. The modular aspect of RuleML and the sublanguages is very appealing to me, but it is a lot digest. The real challenge with RuleML as a standard language is the lack of a great IDE.

    I plan to write a LISP parse and RuleML parser for Drools, so eventually Drools will support both. Before that can happen, the rewrite of the core has to get done. In my freetime, I'm still working on my slot-based implementation, since it's easier to support CLIPS syntax. Eventually, it will all get merged together, but that is still 1-2 years away at best.

    peter
  41. rules and parameters[ Go to top ]

    what I saw in the real life -- it's difficult/impossible to write NEW rules for non-programmers but non-programmers can update PARAMETERS of existing rules. Let's say hypothetical car insurance company has a rule:

    "if applicant age is between X1 and X2 and his FICO score is between X3 and X4 then give him X5 discount"

    A policy analyst of that company can constantly fine-tune those 5 parameters not knowing how to write Java or Rules. Yes, if she needs a new rule or add a new parameter then she will ask rule engines programmer. Otherwise, she might be changing those parameters for months or years.

    Creating something new vs. fine-tuning the existing system behind the control panel. An operator of a nuclear power plant does not create or change reactor. He sits behind console and move thousand of those handles. When he needs a new handle he calls engineer.

    Commercial rule engines give good console for fine-tuning a working system. And I hope Drools is moving in that direction too.
  42. rules and parameters[ Go to top ]

    what I saw in the real life -- it's difficult/impossible to write NEW rules for non-programmers but non-programmers can update PARAMETERS of existing rules. Let's say hypothetical car insurance company has a rule:"if applicant age is between X1 and X2 and his FICO score is between X3 and X4 then give him X5 discount"A policy analyst of that company can constantly fine-tune those 5 parameters not knowing how to write Java or Rules. Yes, if she needs a new rule or add a new parameter then she will ask rule engines programmer. Otherwise, she might be changing those parameters for months or years.Creating something new vs. fine-tuning the existing system behind the control panel. An operator of a nuclear power plant does not create or change reactor. He sits behind console and move thousand of those handles. When he needs a new handle he calls engineer.Commercial rule engines give good console for fine-tuning a working system. And I hope Drools is moving in that direction too.

    This is a common approach in rule application development. I tend to call it a rule template. There are couple of different terms for it, but it's basically the same approach. Knowledge engineers work with the business guys to define a set number of rule templates. From that, the developers build GUI's, which produce new rule instances from the template. In many applications like policy rules, financial compliance, and workflow, there's generally a fixed number of rules that take a specific number of parameters. the business analyst will use the GUI to tweak the parameters and a rule repository will provide version control, validation and deployment features.

    One day, Drools may get to that point, but it's a lot of work. In the past, only large corps could afford to use these types of systems, but it's starting to become more affordable. It is still rather expensive and still requires lots of expertise in the given domain, but over time it should get easier.

    peter
  43. Decision Tables[ Go to top ]

    In a sense, Decision tables follow this "rule template" approach, simplistically. Users do not edit or see the templates directly, they can only modify the parameters that drive these templates.

    Also, Decision Tables are part of the main distribution now (not a seperate add on).
  44. rules and parameters[ Go to top ]

    what I saw in the real life -- it's difficult/impossible to write NEW rules for non-programmers but non-programmers can update PARAMETERS of existing rules. Let's say hypothetical car insurance company has a rule:"if applicant age is between X1 and X2 and his FICO score is between X3 and X4 then give him X5 discount"A policy analyst of that company can constantly fine-tune those 5 parameters not knowing how to write Java or Rules. Yes, if she needs a new rule or add a new parameter then she will ask rule engines programmer. Otherwise, she might be changing those parameters for months or years.Creating something new vs. fine-tuning the existing system behind the control panel. An operator of a nuclear power plant does not create or change reactor. He sits behind console and move thousand of those handles. When he needs a new handle he calls engineer.Commercial rule engines give good console for fine-tuning a working system. And I hope Drools is moving in that direction too.

    Drools certainly is, take a look at Decision tables.

    I promise I will stop pimping my wares now ! (sorry !).

    Good points though.
  45. rules and parameters[ Go to top ]

    what I saw in the real life -- it's difficult/impossible to write NEW rules for non-programmers but non-programmers can update PARAMETERS of existing rules. Let's say hypothetical car insurance company has a rule:"if applicant age is between X1 and X2 and his FICO score is between X3 and X4 then give him X5 discount"A policy analyst of that company can constantly fine-tune those 5 parameters not knowing how to write Java or Rules.

    The point is that this is not the promise of the rule based system (in the sales pitch). The policy analysts job is usually to tune the policy not the parameters. I have seen a lot of problems originating from that very fact and a rules engine will only take you so far. The classical example is:

    "IF CUSTOMER_STATUS==GOLD THEN DISCOUNT=X"

    Now what is X? Nice if it would be dynamic.... Worse, what is a GOLD customer?

    Well we want those that bought for more than $2000 (create binding). Oh wait we want also the ones that have travelled more than 20000 miles last year. Oh and they need to live in the US. Except Alabama. And they must be over 35. And not work in farming. Oh no the one in farming will get a discount as well, but only 10% but also if they live in Alabama.

    The point is, this does not happen in one setting. It happens in weekly increments and after the system is already runnning. Setting up the rules itself is than fairly straightforward (and so would be programming it, btw.). Deploying the rules will often be easier than deploying a new application version. BUT: The system will often need development very different from rules in creating new bindings in various systems to feed the rules, which in turn requires the programmers, database analysts etc.

    The only real advantages I can see is that the business decision tree is decoupled from the technical decision tree of the actual runnning application and of course that the rules can vary with time.
  46. Drools 2.1 Released[ Go to top ]

    How easy or difficult is it to moves from CLIPS rule engine to Drools rule engine. Please reply. :)
  47. depends[ Go to top ]

    How easy or difficult is it to moves from CLIPS rule engine to Drools rule engine. Please reply. :)

    there are a few important differences, which one has to consider moving from CLIPS to droops.

    1. no truth maintenance. the current drools implementation is direct memory and doesn't create a shadow copy, which means developers are responsible for calling modify when an object changes.

    2. certain concepts in clips like defmodules do not exist in drools. we've started to work on it, but it's not ready yet.

    3. ordered facts are not supported in drools, so there is no equivalent.

    4. NOT nodes are not supported in drools, so depending whether you need that or not, you'll have to find an acceptable work around. Not nodes are used to test for the existance of a specific fact. the common examples is manners benchmark.

    hope that helps

    peter
  48. Thanks Peter[ Go to top ]

    Thanks Peter for the reply.
  49. BRML[ Go to top ]

    Does Drools support BRML? or have plans to?


    Hans Ospina G.
    Solution Architect
    Grupo INTeNT de Colombia S.A.
    (Intelligent Enterprise)
  50. BRML[ Go to top ]

    Does Drools support BRML? or have plans to?Hans Ospina G.Solution ArchitectGrupo INTeNT de Colombia S.A. (Intelligent Enterprise)

    I personally have no plans to implement support for BRML for Drools. I know that Benjamin Hoff at MIT has been working on a set of tools for translating rules from one markup to another. For those who don't know, Benjamin is one of the founders of RuleML and used to lead the group at IBM that worked on commonRules. CommonRules started out as a tuple based implementation and Benjamin has a few patents related to rule repositories. IBM also has ABLE (agent building and learning environment) on the alphaworks site. Translating BRML to RuleML or any other XML based rule markup should be straightforward. one can either write a specific transformer or chain transformers together.

    It's really anyone's guess right now as far as which language will become the defacto standard. OMG's OO production rules has some pretty grand goals of linking model driven development with rules to provide an easy way of connection the two. the next decade should be interesting to see what ends up becoming the standard.

    peter
  51. BRML[ Go to top ]

    Hi Peter. It would be great if you did want to make RuleML work in some form for Drools though ! Go for it.

    It is very verbose though... really need a non XML format for compact rules.

    For instance, the microsoft BRE xml syntax is incredibly wordy to do the most basic things... RuleML would look similar I imagine. You can't even hope to edit RuleML by hand !
  52. I know what you mean[ Go to top ]

    Hi Peter.

    It would be great if you did want to make RuleML work in some form for Drools though ! Go for it.It is very verbose though... really need a non XML format for compact rules. For instance, the microsoft BRE xml syntax is incredibly wordy to do the most basic things... RuleML would look similar I imagine. You can't even hope to edit RuleML by hand !

    I work with the ruleml group, so as long as I can find the time to work it, I do plan to implement support for OO Ruleml. RuleML wasn't really intended for human consumption to be honest and the founders have explained that hundreds of times. Most of the design decisions were based on logic, knowlege base/case base and AI theory. For people that just want to get the job done, it's way too much to learn. My knowledge of AI and Kb/Cb is still very limited, but I try to learn enough so I understand why RuleML uses Head/body instead of if/then.

    peter
  53. Compilation and loading of rules[ Go to top ]

    Does drools compile one's xml rules into something like a java class, or is the xml parsed at runtime (like Jess/Clips rules code)? I was hoping for the former, so that I can minimize runtime blowups by having my rules code validated as part of my project build.

    What happens if my code does a divide by zero and blows up? Do I get a typical java stack trace, and if so, will I be able to make any sense of the line numbers and method names?
  54. Compilation and loading of rules[ Go to top ]

    Does drools compile one's xml rules into something like a java class, or is the xml parsed at runtime (like Jess/Clips rules code)? I was hoping for the former, so that I can minimize runtime blowups by having my rules code validated as part of my project build. What happens if my code does a divide by zero and blows up? Do I get a typical java stack trace, and if so, will I be able to make any sense of the line numbers and method names?

    currently it uses janino to compile it to java, but that's not the most flexible approach from a rule engine perspective. one feature I want to add to Drools is a real shell, so that users can debug easier. sorta like CLIPS shell or JESS shell.

    peter