流口水规则中的输入不匹配
Mismatched input in rule of drools
我正在尝试 运行 我的规则集,但它显示:
ERROR[102]
我在缺少的地方添加了“)”,之后错误说它在“)”中[在 $transfer1 块中添加的“)”]
rule "balanceTransfers"
when
$bus1 : CloudBus();
$bus2 : CloudBus(id > $bus1.id);
$transfers1: Number() from accumulate(
CloudRoute(bus == $bus1, count(1))
$transfers2: Number() from accumulate( //<-line 51
CloudRoute(bus == $bus2, count(1)
then
scoreHolder.addSoftConstraintMatch(kcontext, -Math.abs($transfers1 -
$transfers2));
end
Exception in thread "Thread-114" java.lang.IllegalStateException:
There are errors in a score DRL: Error Messages: Message [id=1,
kieBase=defaultKieBase, level=ERROR, path=..., line=51, column=0
text=[ERR 102] Line 51:1 mismatched input '$transfers2' in rule
"balanceTransfers"] Message [id=2, kieBase=defaultKieBase,
level=ERROR, path=..., line=0, column=0 text=Parser returned a null
Package]
accumulate
语法错误。应该是accumulate ( Pattern(), fc())
。您没有关闭模式的括号:
rule "balanceTransfers"
when
$bus1 : CloudBus();
$bus2 : CloudBus(id > $bus1.id);
$transfers1: Number() from accumulate(
CloudRoute(bus == $bus1),
count(1)
)
$transfers2: Number() from accumulate(
CloudRoute(bus == $bus2),
count(1)
)
then
scoreHolder.addSoftConstraintMatch(kcontext, -Math.abs($transfers1 -
$transfers2));
end
希望对您有所帮助,
当我帮助一所大学解决这个错误时,是之前的规则缺少end
。
我正在尝试 运行 我的规则集,但它显示:
ERROR[102]
我在缺少的地方添加了“)”,之后错误说它在“)”中[在 $transfer1 块中添加的“)”]
rule "balanceTransfers"
when
$bus1 : CloudBus();
$bus2 : CloudBus(id > $bus1.id);
$transfers1: Number() from accumulate(
CloudRoute(bus == $bus1, count(1))
$transfers2: Number() from accumulate( //<-line 51
CloudRoute(bus == $bus2, count(1)
then
scoreHolder.addSoftConstraintMatch(kcontext, -Math.abs($transfers1 -
$transfers2));
end
Exception in thread "Thread-114" java.lang.IllegalStateException: There are errors in a score DRL: Error Messages: Message [id=1, kieBase=defaultKieBase, level=ERROR, path=..., line=51, column=0
text=[ERR 102] Line 51:1 mismatched input '$transfers2' in rule "balanceTransfers"] Message [id=2, kieBase=defaultKieBase, level=ERROR, path=..., line=0, column=0 text=Parser returned a null Package]
accumulate
语法错误。应该是accumulate ( Pattern(), fc())
。您没有关闭模式的括号:
rule "balanceTransfers"
when
$bus1 : CloudBus();
$bus2 : CloudBus(id > $bus1.id);
$transfers1: Number() from accumulate(
CloudRoute(bus == $bus1),
count(1)
)
$transfers2: Number() from accumulate(
CloudRoute(bus == $bus2),
count(1)
)
then
scoreHolder.addSoftConstraintMatch(kcontext, -Math.abs($transfers1 -
$transfers2));
end
希望对您有所帮助,
当我帮助一所大学解决这个错误时,是之前的规则缺少end
。