Solved my problem with assertion of the clean-up facts. Don't know
whether this is the most elegant solution but certainly the one which works.
By the way is there in Jess anything to delete queries? "undefrule"
doesn't work for queries as I've noticed. I also couldn't find anything
in the book on this topic.
Bogdan Werth wrote:
I did follow the advise and made a really simple rule to retract
unused facts ... but this clean-up-rule fires sporadically. I can't
understand why. It fires every time if I have one agent but if I have
more than one agent it starts it's sporadic life. Can it be that the
clean-up-rule fires before the death rule and this causes the problems?
So here is my situation:
(deftemplate person (slot householdID) (slot ID) ... (slot stl))
(defrule deaths
?id <- (person (householdID " + getID() + ") (ID ?number) ... (stl
?stepsToLive))" +
=>
(if (<= ?stepsToLive 0)) then (retract ?id) else ())
)
(defrule cleanUp
(not (person (householdID " + getID() + ") ))
=>
< do something >
)
Any good suggestions (or mistakes in my code :-) )?
Thanks in advance
[EMAIL PROTECTED] wrote:
I think Bogdan Werth wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
Hello Jess-list,
I wonder if it is possible to delete old rules/facts in a
while-loop if they all contain the same ID in either
rule-name or fact-name.
You could certainly use the Rete.listDefrules() method and look at the
name of each Defrule object returned by the Iterator. It would be safe
to hand the name of each rule to the Rete.unDefrule() method as you
encounter it.
For facts, if you can't simply have a rule which matches the facts you
want to retract, you could use a defquery. That would give you access
to all the matching facts, and again, you could retract them one by
one.
---------------------------------------------------------
Ernest Friedman-Hill Advanced Software Research Phone:
(925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify
[EMAIL PROTECTED]
--------------------------------------------------------------------
--
Bogdan Werth
Doctoral Researcher Centre for Policy Modelling
The Graduate School of Business
Aytoun Building
Aytoun Street
Manchester
M1 3GH
UK
Tel: +44 161 247 6481
Fax: +44 161 247 6802
Email: [EMAIL PROTECTED]
Web: http://cfpm.org/~bogdan
**************************************************************
Before acting on this email or opening any attachments you
should read the Manchester Metropolitan University's email
disclaimer available on its website
http://www.mmu.ac.uk/emaildisclaimer
***************************************************************
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------