Hi again,
I have another problem. I want to state that, if some "part" (task) needs to
be completed and is not available, then
all sub "part"s or tasks of that "parent" part/task need to be completed too
and they should be specified as "needed-part"s. For that, I tried two
different things.
--
First unsuccesfull attempt:
(defrule BuildPlanBackward
(needed-part (name ?a))
(not (available-part (name ?a)))
(depends-on (parent ?a) (children ?list))
=>
(foreach ?c ?list
(assert (needed-part (name ?c)))
)
)
Result: No subtask ?c in form of "(needed-part (name ?c))" is added.
--
Second unsuccesfull attempt:
(defrule BuildPlanBackward
(needed-part (name ?a))
(not (available-part (name ?a)))
(depends-on (parent ?a) (children ? ?c ?))
=>
(assert (needed-part (name ?c)))
)
Result: Only one of the children ?c is added in form of (needed-part (name
?c)).
--
I do not understand both of the solutions.
To insert new facts, I use
the two lines
----------------------
executeCommand(...);
runEngine();
where the function definitions are:
public void executeCommand(String fact) {
try {
engine.executeCommand(fact);
} catch (JessException re) {
re.printStackTrace(System.err);
}
}
and
public void runEngine(){
try {
engine.run();
} catch (JessException re) {
re.printStackTrace(System.err);
}
}
---------------
I really did not understand what is going on in this simple code.
Thanks for advance,
--
Levent Kent