Yes, Thank you. That helps quite a bit. On Jan 13, 2011, at 11:45 PM, Wolfgang Laun wrote:
> A (single or joined) cell below CONDITION must contain something that results > in a valid pattern when > a pair of parentheses is appended > the constraint(s) resulting from the cells below are inserted into these > parentheses > Looking at "person: Person, op: Person from otherPersonList", you realize > that "person: Person, op: Person" is not a valid CE, not even if you omit the > comma Also, the cell cannot end with "from otherPersonList". > > A constraint (2 rows down from CONDITION) is expanded with values from cells > below it by appending "==" and the cell value. > > Apart from the basic design flaw Greg has pointed out: you can add a from > clause by using an additional column with "from otherPersonList" in the 3rd > row after RuleTable and an 'x' in each of the value cells. > > > You will also have to change the constraint "person.getRelationShip(op) == > ..." into an eval since this isn't correct constraint syntax. > > ------------------------------- > CONDITION > person: Person() op: Person > activity > PLAYING > ----------------------------- > CONDITION > > from otherPersonList > x > ------------------------------ > CONDITION > > eval( "$param".equals( person.getRelationShip(op) ) ) > FRIEND > ------------------------------- > > > I suggest that you try and write your rules in DRL first before you start > thinking about decision tables. As you can see, certain conditions and CE > combinations cannot be expressed in tables. After all, a row of cells is > linear, but the syntaxl of LHS expression includes non-linear (recursive) > structures. > > -W > > > > 2011/1/13 Gregory Mace <[email protected]> > Here is a simple example where 'otherPersonList' is a global java.util.List: > > RuleTable Are friends having fun > CONDITION CONDITION > ACTION > person: Person, op: Person from otherPersonList > person.getRelationShip(op) op.getActivity() > System.out.println("$param"); > FRIEND PLAYING > Your friend is having fun > ENEMY WORKING > Not your friend and not having fun > > which produces the following drl output: > > #From row number: 31 > rule "Friends are having fun_31" > > when > person: Person, op : Person from > otherPersonList(person.getRelationShip(op) == "FRIEND", op.getActivity() == > "PLAYING") > then > System.out.println("Your friend is having fun "); > end > > #From row number: 32 > rule "Friends are having fun_32" > > when > person: Person, op : Person from > otherPersonList(person.getRelationShip(op) == "ENEMY", op.getActivity() == > "WORKING") > then > System.out.println("Not your friend and not having fun"); > end > > shouldn't the 'from' be after the statement like this:? > > person: Person, op : Person(person.getRelationShip(op) == "ENEMY", > op.getActivity() == "WORKING") from otherPersonList > > Thx > > On Jan 13, 2011, at 11:47 AM, Wolfgang Laun wrote: > >> I think I understand your question, but I'm not sure how to answer it. ;-) >> >> What, exactly, are you trying to do? "Pulling" from a list means what? >> >> -W >> >> >> On 13 January 2011 20:34, Gregory Mace <[email protected]> wrote: >> I believe I have the list set up correctly as a variable, but I am not sure >> how to set up a condition that pulls from a global list. Any examples? >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
