<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Hi Michael,<br>
<br>
Thanks for you answer! Following you suggestion I've taken a look at at
"logical insertions" and on one hand I have to say that it looks like
what I need, but on the other hand it is not clear to me how to
"implement it".<br>
<br>
If you have some time to take a look, here are the objects in my
session:<br>
- one T object (something that can be considered as a "type" object)<br>
- many I objects (something that can be considered as "instance"
objects), I objects have one "type" field beeing a T (there is no link
from T to Is)<br>
<br>
Those facts are inserted into the session and I have the impression
that we are not speaking here of logical insertions: they have to be
here, it is the input data the user has to write rules on.<br>
The user can decide to retract the T object: in this case all I objects
have to be retracted as well.<br>
The user can decide to retract some I objects: when all of them have
been retracted, the T object should be retracted as well.<br>
<br>
The first "solution" I imagined was to have high-salience rules:<br>
<br>
rule "1"<br>
when<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t : T<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not I(type == t)<br>
then <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retract t<br>
<br>
rule "2"<br>
when<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i : I(t : type)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; not Type (this == t)<br>
then <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; retract i<br>
<br>
The other solution I imagined (that I have not tried) was to retract
facts using a WorkingMemoryEventHandler.<br>
However as I am a Drools' absolute beginner (not only to Drools, but to
the rule paradigm itself), I was wondering what is the "most natural
way" for you guys to implement that behavior :-).<br>
<br>
Bruno.<br>
<br>
<br>
Michael Anstis a &eacute;crit&nbsp;:
<blockquote
 cite="mid:AANLkTikwvHmtf9B5ebB8socf8UnMM1V40erCK2Ln-v2c@mail.gmail.com"
 type="cite">Would the other retractions be automatically provided for
by Drools' Truth Maintenance?<br>
  <br>
Otherwise, passing a StatefulKnowledgeSession to a
WorkingMemoryEventHandler subclass and invoking it's methods should,
IMO, not be an issue.<br>
  <br>
Have you tried it and experienced issues? <br>
  <br>
  <div class="gmail_quote">On 6 December 2010 09:32, Bruno
Freudensprung <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:bruno.freudensprung@temis.com">bruno.freudensprung@temis.com</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
everyone,<br>
    <br>
Do you know if it is possible to insert/modify/retract facts in a<br>
working memory event handler?<br>
    <br>
Here is my use case actually: I want my users to be able to write rules<br>
like "When ... Then retract X" without having to bother with the<br>
consequences of &nbsp;retracting X on the other objects of the sessions (some<br>
of them might be retracted as well). These consequences can be expressed<br>
by rules, but I would like them to be kind of "part of the framework"<br>
and it would be easier for users if those rules were implicitly defined.<br>
    <br>
Many thanks in advance for any hint,<br>
Best regards,<br>
    <br>
Bruno.<br>
    <br>
_______________________________________________<br>
rules-users mailing list<br>
    <a moz-do-not-send="true" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
    <a moz-do-not-send="true"
 href="https://lists.jboss.org/mailman/listinfo/rules-users"
 target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
  </blockquote>
  </div>
  <br>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
  </pre>
</blockquote>
<br>
</body>
</html>