[rules-users] Modifying in built rule in new formatt

Michael Anstis michael.anstis at gmail.com
Thu Dec 30 13:31:09 EST 2010


1) You insert Facts into WM like records into a RDBMS and rules can be
considered with some equivalence to RDBMS triggers. So if you insert 2
"container" facts into WM the rules will match for each container fact
separately. E.G. (pseudo code):-

class ParamContainer {

private int p1;
private int p2;
private int p3;

//Getters...

}

ParamContainer pc1 = new ParamContainer(1, 2, 3);
ksession.insert(pc1);

ParamContainer pc2 = new ParamContainer(5, 6, 7);
ksession.insert(pc2);

ksession.fireAllRules();

rule "one"
when
ParamContainer($p1 : p1, $p2 : p2, $p3 : p3)
...
then
//do something
end

Rule "one" will trigger twice, once for object pc1 and again for pc2.

2) Lower salience rules have their activations on yhre agenda executed
beforre other higher salience rules. So you can use low salience rules to
initialise state or bootstrap processing. E.G (more pseudo code):-

rule "bootstrap"
salience -10
when
then
//Could equally read from a RDBMS
insert(new ParamContainer(1, 2, 3));
insert(new ParamContainer(4, 5, 6));
end

rule "my business rules"
salience 0
when
ParamContainer($p1 : p1, $p2 : p2, $p3 : p3);
...
then
...
end


On 29 December 2010 06:15, wasim.khan318 <khanwasim07 at yahoo.co.in> wrote:

>
> what exactly  you mean by  lower salience rule
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Modifying-in-built-rule-in-new-formatt-tp2151450p2161308.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20101230/bbc7f921/attachment.html 


More information about the rules-users mailing list