|
[
Permlink
| « Hide
]
Andrew Perepelytsya added a comment - 13/Jul/05 07:36 AM
E.g. Drools project is JSR-94 compliant, and now it has a Spring integration. We could take this shortcut in short term, just the same it was with EJBs.
Be careful of the spring integration. Its intent was to allow for the creation of rules as pojos (and to configure drools). But with comming full RETE engine, defining rules as simple pojos with annotations (or other spring declarative mechanisms) indicating the conditions which also takes advantage of the full power of RETE is going to real hard.
I (the developer of drools-annotation and drools-spring) don't intend to try. What is need is a real DSL, similar to Jess' but more java-like. I believe that Mark has this planned. Of course, drools could continue to be configured with spring, but this is quite simple. Thanks for the pointers Barry. Actually, (to my shame) I don't know too much about rule engines, hence why this task has been done yet
I've been looking into rules engines a bit lately. How would Drools be used in a inference type routing question of "Where do we route this message next?". That sounds like a backward-chaining "inference" type question, not a forward-chaining "Assertion". Drools only does forward chaining, correct? Does JSR-94 only cover forward-chaining?
As someone who recently had to suffer through a class on rule reduction I might be able to help a bit here. There are essentially two types of rule engines: forward- and backward-chaining. They differ from what they try to accomplish: forward-chaining means you have an event/'fact' (i.e. 'something happened') and want to know 'what to do next'. Based on a precedence model when several rules match the fact you pick the rule that matches the fact criteria best and 'fire' it, essentially creating a new event/fact that leads to the next matching ruleset or none, in which case you have reached a conclusion. Backward-chaining works, as the name implies, backwards: you have a set of facts (prime example: symptoms for a disease) and want to know 'how did I get here?', i.e. what might have happened to make these events/facts appear. You select a set of rules that have lead to your current situation and (mostly recursively) try to reduce the ruleset backwards to the first fired rule, initiated by the first event (if it can be deduced). Doing this manually really sucks since you need to backtrack in case you have run into a branch of the ruleset tree that does not lead to the root 'cause'.
Now for event-based routing: essentially we need to decide what we want the router to decide Drools only supports forward-chaining and decision tables which are popular with business folks (for good reason: they are nice, simple and useful). For a nice 'high-level' (rather shallow, actually) overview of rules in SOA check out: http://www-128.ibm.com/developerworks/webservices/library/ws-soa-progmodel9/index.html I can also offer two resources that I "happen to have" in electronic formats for purely academic reasons:
Not sure if this was helpful in any way; if I talked nonsense someone please set me straight. You talking nonsense? Nonsense! ;P From trying to follow what you're saying, it sounds like forward-chaining would suit if you got an output from an assertion. I use the term "assertion" for its core definition - that I am asserting a fact into the knowledge base or working memory (I think this is what drools calls it). I'm not sure what assertion has to do with validation in the rules domain, besides one purpose of a forward-chaining rule.
Can someone describe how drools would fit into such a router or transformer? A narrative story-like process flow is what I'd love to see here. I've only used Algernon-J, which always has a full knowledge-base (I'm using protege) available to hold rules and facts for the rules to use in their decisions. From what I read on drools, you have to assert every fact into its working memory and call a method to run all rules. You said you have the two resources available in electronic format, can you give us the links? Thanks! setting fix-version to unknown since this won't make it for 1.3. probably needs someone to get familiar with Drools and also look how ServiceMix integrated it.
I implement my own version of drools service provider. Here is that roughly how to build:
1. make drools as service provider, so drools could use for message router or other rule message operation. Drools rules will check all those assertObjects and modify them. For rule base routing, I implement another service provider called "dynamic". Dynamic service provider get at real endpoint URI from message property. Here is the example: add endpoint URI to message property in Component: add endpoint to router and address is the URI property name: <endpoint address="dynamic:/mqadapter_output"/> The property also could be list. So it will send message by list of URI. To create rule base message routing: Example:
Model file: <!DOCTYPE mule-configuration PUBLIC "-//SymphonySoft //DTD mule-configuration XML V1.0//EN" <mule-configuration id="Logger" version="1.0"> <connector name="LoggerRuleConnector" className="org.mule.providers.rule.RuleConnector"> <model name="Logger"> </mule-configuration> Rule file: import org.mule.umo.UMOMessage; rule "Logger for large file" rule "Logger for small file" function long getFileSize(UMOMessage msg) Create JSR-94 version of rule service provider. Attach is the source file.
Well known issue: There are two example: Souce codes for JSR-94 implementation
Dynamic service provider is at: http://jira.symphonysoft.com/browse/MULE-970
Send new implementation of rule provider, it shoud fix some bug for previous version and make test case
Deleted an older attachment.
Hi David,
Thanks for the submission. We're going to start looking at this for the next release. Cheers, Ross Hi David,
I've just started importing this. The dependency info is not with the zip. Can you confirm the Jar required. I'm using drools-3.0.4 It also need this dependency - I can't find this anywhere, is it in a maven repo somehere, eclse could please attach it. Same for - org.apache.jakarta.commons:commons-jci-core:jar:1.0-406301 Thanks, Ross Hi Ross,
For compile, it only needs jsr94-1.1.jar since it does not implement as drools specific. If you want to run test program: org.mule.test.usecases.providers.rule.RuleSampleTestCase with drools, it needs: With third party library: Following libraries are shipped by drools but already in Mule: Following libraries does not need for test program. It uses for other drools feature like supporting XML rule file, Decision tree. You can get those files from: You also need change code in method getRuleInputStream(): from: since FileUtils method rename in 1.3. David Song Hi Ross,
To easy get start with drools, you don't have to do any additional setting and just run org.mule.test.usecases.providers.rule.RuleSampleTestCase, see attach file's comment. David Song Thanks David. The transport is now available under http://svn.codehaus.org/mule-contrib/transports/jsr94-rules
You should committer access to this repo and can build the module using mvn install Alex Kozlenkov has offerred to contribute his work on using the Prova Rule Engine with Mule
http://www.nabble.com/Agents-in-Prova-rule-language-wrapped-by-UMO-tf2448257.html Hi guys,
I have uploaded the promised example demostrating the use of Prova and Drools agents on the bus. Here is a short write-up with a more detailed one to follow. The key components ProvaUMOImpl.java and DroolsUMOImpl.java are used for sending and (for Prova agents) receiving messages. There are three parallel conversations ongoing at the same time. (1) Agent001 sends tow messages to Agent002; There is only one rulebase behind each UMO descriptor, which means that if Mule creates several instances, the access from them to the rulebase happens in parallel and in the case of a conversation protocol, should be executed in lock-step. Imagine that an agent expect messages A and then B. If B arrives first due to the thread parallelism, the agent will be in an incorrect state. Lock-step execution always exchanges messages in pairs, i.e., an ack is sent for each message, and then the other side continues. The formalism behind the agents is based on pi-calculus. It allows for sending and receiving messages in the rule bodies as well as sending agent addresses and conversation-id's as part of each message. The project uses both Maven 2 and a Maven 2 plugin for Eclipse so it can be run from both. The examples requires Prova 2.0 Beta 3 that is included in the local Maven repository. Alex Kozlenkov There is now a MuleForge project that hosts these patches: http://www.mulesource.org/display/DROOLS/Home
We will include this functionality in the Mule distribution sometime after 2.0 (hence we've flagged it a 3.0 for now) Alex, looking at the forge project you should be listed as despot as well. If you sign up on the forge I will get someone to add you to the project. There are currently no artifacts because one of the tests fail. Isn'y this on the MuleForge: http://www.mulesource.org/jira/browse/DROOLS
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||