A (single or joined) cell below CONDITION must contain something that results in a valid pattern whenLooking 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 pair of parentheses is appended
- the constraint(s) resulting from the cells below are inserted into these parentheses
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 <gregorymace@earthlink.net>Here is a simple example where 'otherPersonList' is a global java.util.List:RuleTable Are friends having funCONDITION CONDITION ACTIONperson: Person, op: Person from otherPersonListperson.getRelationShip(op) op.getActivity() System.out.println("$param");FRIEND PLAYING Your friend is having funENEMY WORKING Not your friend and not having funwhich produces the following drl output:#From row number: 31rule "Friends are having fun_31"whenperson: Person, op : Person from otherPersonList(person.getRelationShip(op) == "FRIEND", op.getActivity() == "PLAYING")thenSystem.out.println("Your friend is having fun ");end#From row number: 32rule "Friends are having fun_32"whenperson: Person, op : Person from otherPersonList(person.getRelationShip(op) == "ENEMY", op.getActivity() == "WORKING")thenSystem.out.println("Not your friend and not having fun");endshouldn't the 'from' be after the statement like this:?person: Person, op : Person(person.getRelationShip(op) == "ENEMY", op.getActivity() == "WORKING") from otherPersonListThxOn 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?
-WOn 13 January 2011 20:34, Gregory Mace <gregorymace@earthlink.net> 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
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users