Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Why don't rules with the same constraint don't all match? #79

Closed
williamwsmith opened this issue Oct 1, 2013 · 1 comment
Closed

Comments

@williamwsmith
Copy link

I have a rule file below based on one of your examples. Originally I started out playing with salience (took me a short while to figure out the syntax in the DSL to set the salience since their weren't an examples). Anyway, in the example below the "count3" rule does not fire ever. I can if I start setting salience, but, even then it seems nonsensical at times. The "count2" rule that modifies the Counter seems to win always. I would assume that all the rules would fire. Thanks.

define Counter {
count: 0,
constructor: function(count){
this.count = count;
}
}

rule "counted too high" {
when {
ctr: Counter ctr.count == 100;
}
then{
console.log("Look ma! I counted to " + ctr.count);
halt();
}
}

rule "not count" {
when {
not(ctr: Counter);
}
then{
console.log("Imma gonna count!");
assert(new Counter(1));
}
}

rule count1 {
when{
ctr: Counter {count: count}
}
then{
console.log("Count 1");
}
}

rule count2 {

when{
    ctr: Counter {count: count}
}
then{
    modify(ctr, function(){this.count = count + 1;});
    console.log("Count 2");
}

}

rule count3 {

when{
    ctr: Counter {count: count}
}
then{
        console.log("Count 3");    
}

}

@williamwsmith
Copy link
Author

I tested something similar in CLIPS and see it acts that way too. I don't run DROOLs so I don't know how that operates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant