[rules-users] Simple rules to "facts"; constraint "all members of a collection exist"

Mark Proctor mproctor at codehaus.org
Tue Dec 11 04:41:11 EST 2007


Ingomar Otter wrote:
> Folks,
> I have a buch of rather simple rules in a configuration use-case which
> look like
> rule "requires-rule"
> when
>    o1: O(id=2)
>    o2:O(id=4)
>   (not (exists (O(id=7))
> then
>   //assert a conflict "O2 and O4 require O7"
>
> In subsequent rules I deal with the conflicts detected. The resolution
> of these holds the "juicy bits".
>
> As the above creates quite some text and does not allow me to reason
> on the rule itself, I was thinking whether I should
> introduce the "domain rule" (o2 & O4 require O7) as a fact and use
> 'meta rules' to do the processing.
> Have you seen similar scenarios? Or is this misuse?
>
> For the time being, I have modeled the requires-rule as something like
> class RequiresDomainRule {
>     Collection<Items> andTermItems; //eg o2, o4
>         Item requiredItem; O7
> }
> Then I assert o2,o4 and a RequiresRule( (o2,o4),o6)
> But I have a knot in my brain and can't get the LHS written down,
> which in prose would be:
>  there is a "requires rule" whose andTermItems are all present in WM
> and whose requiredItem is not present in WM then...
> The "andTermItems are all present"  got me. I can test for any but
> all? - I'm stuck, need help.
checkout the  forall and not conditional elements
>
> Cheers,
>   Ingomar
>




More information about the rules-users mailing list