Jason带有一个使用表演性“tellRule”发送规则的演示,但在我的测试中它不起作用。我试图像这样发送给自我代理:
.send(self,tellRule, [{a :- b & c}])
结果是:
Command .send(self,tellRule, [{a :- b & c}]): included for execution Communication error -- no_applicable: Found a goal for which there is no applicable plan:+!kqml_received(self,tellRule,[{ a :- (b & c)}],mid511)
实际上,Jason没有默认定义的“tellRule”表演。事实上,提到的demo正在教授如何添加KQML表演。那么,对于你的代码工作,你应该首先创建“tellRule”,这样做:
.send(self, tellHow, {+!kqml_received(A,tellRule,Rules,_) <-
.print("Received rule(s) ",Rules, " from ",A);
for ( .member(R, Rules) )
{+R[source(A)];}
.relevant_rules(_,LR);
.print("Rules: ",LR)}).
在此之后,您可以运行命令:
.send(self,tellRule, [{a :- b & c}]).
顺便说一下,同样的想法可以用来创建类似“untellRule”的东西:
.send(self, tellHow, {+!kqml_received(A,untellRule,Rules,_) <-
.print("Removing rule(s) ",Rules, " from ",A);
for ( .member(R, Rules) )
{-R}}).
.send(self,untellRule,[{a :- b & c}]).