How to modify or delete JESS facts when there are more than 1 templates

81 Views Asked by At

I have 2 templates in JESS, how do I modify or retract facts from one of those templates?

2

There are 2 best solutions below

0
Ernest Friedman-Hill On

You modify or retract any facts by matching them on the left hand side of a rule, binding the facts to variables, and then retracting or modifying them on the right hand side:

(defrule example
  ?f <- (foo)
   =>
  (retract ?f))

This is pretty basic stuff in Jess — I think you’d better make some time, sit down, and give the manual a good reading.

0
laune On

You cannot "modify or retract facts from [...] templates".

Chapters 5 and 6 (and others) of the Jess Manual contain several examples for the functions (modify) and (retract).