[rules-users] Writing complicated rules - consecutive number problem

Wolfgang Laun wolfgang.laun at gmail.com
Sat Nov 5 13:35:33 EDT 2011


You need an attribute that orders Person facts. For simplicity's sake,
let's call this pnr, a unique number. Then, for any two Person facts where
one pnr is less than another pnr the age of the first must be less than the
age of the second.

It's easy to show that for any two strictly monotonical increasing
sequences <a> and <b> and any pair of index values (i,j) where a[i] < a[j]
also b[i] < b[j] holds.

-W

On 5 November 2011 16:16, LCode <j_whittlesea at hotmail.com> wrote:

> I am trying to write a rather complicated rule via the guided rule editor
> and
> I wonder if it is indeed possible.
>
> The following is a simplified explanation of my scenario:
>
>
> A 'person' has a numerical property 'age'
>
>
> In a hypothetical world the following is allowed because the ages of the
> people are consecutive:
>
> Person A age = 24
>
> Person B age = 25
>
> Person C age = 26       OK
>
> Person D age = 27
>
>
> However I would like to write a rule that fires if the ages are not
> consecutive, something like this:
>
> Person A age = 24
>
> Person B age = 25
>
> Person C age = 29       NOT OK
>
> Person D age = 27
>
>
>
> I am starting with 'From collect all people [p]'.
>
>
> Any thoughts, comments or similar experiences much apprieciated as I am
> pulling my hair out!
> Jen
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Writing-complicated-rules-consecutive-number-problem-tp3482704p3482704.html
> Sent from the Drools: User forum 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/20111105/da71759d/attachment.html 


More information about the rules-users mailing list