JESS: Iteration over list

2009-07-28 Thread levent kent
Hi everybody, I am doing my masters thesis and have a problem with lists. It is actually very simple. I want to create a rule which says: If all subtasks of a parent task are completed, then the parent task can be completed too. I tried the code below, but it seems that I can not use foreach

Re: JESS: Iteration over list

2009-07-28 Thread Nick Tinnemeier
Dear Levent, You are using a function (foreach) at the LHS of a rule. See http://www.jessrules.com/FAQ.shtml#Q17 for an explanation on why this is not good practice. Try putting the foreach loop on the RHS of the rule, and most likely things will work as expected. (defrule BuildPlanForward

Re: JESS: Iteration over list

2009-07-28 Thread Wolfgang Laun
It would be easier to detect a depends-on where the available-part would be missing for one of its name list elements. As it stands now, you'll need an identifier for depends-on so that the binding into the not (via ?x) is possible. (defrule every-subtask (depends-on (id ?x)(parent ?a)) (not

Re: JESS: Iteration over list

2009-07-28 Thread levent kent
I would do that. But the problem is I want to test if [there exists a fact of the form (available-part (name X)) for all X inside the list]. That's why the solution you offered would not work, since I just want to test instead of adding new facts. Thanks for your response and I hope I could

Re: JESS: Iteration over list

2009-07-28 Thread Ernest Friedman-Hill
This is the right solution; it could be simplified a little using the forall conditional element, which would make this closer to the spirit of the Levent's original: (defrule every-subtask (depends-on (id ?x)(parent ?a)) (forall (depends-on (id ?x)(name ? ?n ?))

JESS: strings and quoting

2009-07-28 Thread jo
Hi everybody, I am wrestling with strings in jess java Now everytime strings get trough a printout to file I get more and more escaped quotes and escaped backslashses, like ie . mystring ... How can I avoid this trouble? I tries str-cat, implode$, nothing but somehow quoting

Re: JESS: Iteration over list

2009-07-28 Thread levent kent
Thanks again, but I didn't get it. I don't have any slot named id or name. Idefined my templates as follows. (deftemplate depends-on (slot parent) (multislot children)) (deftemplate available-part (slot name)) Here, depends-on relation specifies which parent task depends on the subtaks given in

Re: JESS: Iteration over list

2009-07-28 Thread Wolfgang Laun
Sorry, where I have name in depends-on, that was meant to be your slot children. As for the id slot I added: I don't think it can be done without. It just should be a unique identifier. It serves the same or similar purpose in Ernest's solution, to freeze the forall iteration to the children list

Re: JESS: strings and quoting

2009-07-28 Thread Wolfgang Laun
How can we read your mind? I tried Tarot cards, a Crystal Ball and ESP, but somehow... Kindly show an example of Jess or Java code, what it prints and what you expect it to do. -W On Tue, Jul 28, 2009 at 5:22 PM, jo etaoi...@yahoo.com wrote: Hi everybody, I am wrestling with strings in

Re: JESS: Iteration over list

2009-07-28 Thread Ernest Friedman-Hill
I think you can replace all occurrences of id with parent, removing the redundant parent reference in the first fact. On Jul 28, 2009, at 1:35 PM, Wolfgang Laun wrote: Sorry, where I have name in depends-on, that was meant to be your slot children. As for the id slot I added: I don't

JESS: Debugging Jess

2009-07-28 Thread Dresdner, Barry
Is it (will it) possible to Run/Debug JessML in the JessDE? Thanks a lot, Barry To unsubscribe, send the words 'unsubscribe jess-users y...@address.com' in the BODY of a message to majord...@sandia.gov, NOT to the list (use