[jboss-jira] [JBoss JIRA] Commented: (JBRULES-46) Prolog Style Query Based Backward Chaining

Vincent Legendre (JIRA) jira-events at lists.jboss.org
Fri Apr 15 14:24:35 EDT 2011


    [ https://issues.jboss.org/browse/JBRULES-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595940#comment-12595940 ] 

Vincent Legendre commented on JBRULES-46:
-----------------------------------------

My comment was lacking some precisions ...
Other vendors has a sequential mode in which facts updates in first rules are taken in account for rules triggered after (BlazeAdvisor does this, not sure about JRules). 
Anyway, it could be an interresting feature.
Drools sequential mode collects all t-uples, then apply rules. This prevents 'first' rules to do some updates that could change one t-uple value or even trigger (or not trigger) other rules that comes after in the rule sequence.

With a backward chaining way of evaluating rules (in a backward sequential mode), you can take in account updates after one rule execution for others. This could solve one use-case that I often encounter : Rules application that compute counters then validate them. 

rule "UpdateCounter"
salience 10000
when
    $c : Counter( .... , $value : value)
    $o : BusinessObject( .... ) 
then
    $c.setValue($value + $o.getSomething());
    update($c);
end

rule "CheckCounter"
when
    $c : Counter(value > 1234)
then
    Alerts.addNew(...);
end

This way of writing rules is quite natural (and thus easier for a business user to author). 
Of course there are solutions (use a rule flow, don't call the update($c) when counting and use $c.getValue() in action part, then update all counter in a separate task, and finally run the validation rules).
Another solution could be a kind of sequential mode that accepts updates for subsequents rules.

A last solution could be to handle ruleflows in sequential mode, having as many sequential evaluation as tasks, with the RETE updated a end of tasks. Yes this last point have nothing to do with backward chaining ... but I would find that very useful (and that could solve my common problem more efficiently than a backward-sequential-mode). 


> Prolog Style Query Based Backward Chaining
> ------------------------------------------
>
>                 Key: JBRULES-46
>                 URL: https://issues.jboss.org/browse/JBRULES-46
>             Project: Drools
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: Mark Proctor
>            Assignee: Mark Proctor
>
> Forward Chaining means that facts are asserted and propgated forward throughout the network, during forward propagation matching takes place which results in rules being fired - the rules are event based, in that they are fired in response to changed in the working memory.
> Backward chaining is query based. Rules attempt to fire first but do not have the necessary matched facts, so facts are pulled in from an external source.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list