[rules-dev] [rules-users] What would you call a Fact that is only evaluated once?

Mark Proctor mproctor at codehaus.org
Fri Aug 12 06:45:14 EDT 2011


On 12/08/2011 11:22, Wolfgang Laun wrote:
> One term (probably too long) would be "interjection".
>
> A more pictorial word is "flake", which (thinking of snowflake) 
> provides an inkling for the fast fade away.
The context here is I'm working on an adventure game. You insert 
commands, the engine evaluates what to do with them, then you retract it 
again. Once the initial conflict set is evaluated there is no more use 
for the fact, and you end with redundant rules. I'd rather declare 
@liftetime(flake) @liftetime(durable) and have the engine handle that, 
or something along those lines/terms.  Grindwork also adds something 
slightly different called "consume" for handling similar situations:
http://www.grindwork.com/site/node/6
"This rule fires when those conditions in the 'when' clause become true. 
When they become true, the "consume" causes the removal of the client 
message and the old alias (if one was set). The "rising" actions add (+ 
means add to the knowledge base) facts. One fact is the new alias, and 
the other is that an alias has changed. The alias changed fact allows 
others rules to notify people in the channel that the alias changed."


Currently how Commands are handled:
rule invalidMove no-loop when
     $c : MoveCommand($d : direction)
     $h : Here( $l : location)
     not ?connect( $d, $l; )
then
     System.out.println( rule.name + ':' + $c );
end

rule validMove no-loop when
     $c : MoveCommand($d : direction)
     $h : Here( $l : location)
     exists ?connect( $d, $l; )
then
     System.out.println( rule.name + ':' + $c );
     insert( new ExitEvent( $l ) );
     insert( new EnterEvent( $d ) );
     System.out.println( $d );
     modify( $h ) { location = $d };
end

rule retractCommand salience -100 when
     $c : Command()
then
     retract( $c );
end
>
> -W
>
>
> On 12 August 2011 12:00, Mark Proctor <mproctor at codehaus.org 
> <mailto:mproctor at codehaus.org>> wrote:
>
>     What would you call a fact that is inserted once and the conflict set
>     computed (the rules that can fire). The fact is then retracted so no
>     more matches can take place, but the conflict set itself is allowed to
>     fire (assuming their other facts remain true).
>
>     I think this is quite a common use case and most users will handle
>     this
>     via a lower salience and retracting the fact manually, but I think
>     it's
>     useful enough to build in as a keyword on type declaration. We
>     just need
>     a name for it :)
>
>     Mark
>
>
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110812/5b65df6d/attachment.html 


More information about the rules-dev mailing list