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.<br>
<br>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.<br><br>-W<br><br><div class="gmail_quote">
On 5 November 2011 16:16, LCode <span dir="ltr"><<a href="mailto:j_whittlesea@hotmail.com">j_whittlesea@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am trying to write a rather complicated rule via the guided rule editor and<br>
I wonder if it is indeed possible.<br>
<br>
The following is a simplified explanation of my scenario:<br>
<br>
<br>
A 'person' has a numerical property 'age'<br>
<br>
<br>
In a hypothetical world the following is allowed because the ages of the<br>
people are consecutive:<br>
<br>
Person A age = 24<br>
<br>
Person B age = 25<br>
<br>
Person C age = 26 OK<br>
<br>
Person D age = 27<br>
<br>
<br>
However I would like to write a rule that fires if the ages are not<br>
consecutive, something like this:<br>
<br>
Person A age = 24<br>
<br>
Person B age = 25<br>
<br>
Person C age = 29 NOT OK<br>
<br>
Person D age = 27<br>
<br>
<br>
<br>
I am starting with 'From collect all people [p]'.<br>
<br>
<br>
Any thoughts, comments or similar experiences much apprieciated as I am<br>
pulling my hair out!<br>
Jen<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Writing-complicated-rules-consecutive-number-problem-tp3482704p3482704.html" target="_blank">http://drools.46999.n3.nabble.com/Writing-complicated-rules-consecutive-number-problem-tp3482704p3482704.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>