Another example

Consider the following action rule:
   p(X,Y), {event(X,O),event(Y,O)} => write(O).
An agent, which is attached to both X and Y, echoes the event object when activated by an event. The following gives several sample queries and their expected outputs:

$\char93 $ Query Output
1 p(X,Y),post_event(X,a) a
2 p(X,Y),post_event(Y,b) b
3 p(X,Y),post_event(X,a),post_event(Y,b) ab
4 p(X,Y),post_event(X\/Y,c) c
5 p(X,Y),post_event(X/\Y,c) c
6 p(X,Y),p(U,V),post_event(X\/U,c) cc
7 p(X,Y),p(U,V),post_event(X/\U,c)  
8 p(X,Y),p(U,V),X=U,post_event(X/\U,c) cc

Query number 7 gives no output since no agent is attached to both the channels X and U. When two channels are unified, the younger variable is set to reference the older one,12.2 and all the agents attached to the younger variable are copied to the older one. So in query number 8, after X=U, X and U become one variable and the two agents p(X,Y) and p(U,V) become attached to the variable. Therefore, after post_event(X/\U,c) both agents are activated. In the examples, the queries will give the same outputs if post_event_df is used instead of post_event. This is not the case in general if an action rule also posts events.

Neng-Fa Zhou 2012-01-03