【发布时间】:2023-03-04 10:00:01
【问题描述】:
您好,我是剪辑规则引擎的新手,必须在移动应用 (Android/Kotlin) 中的剪辑中进行跟踪。我们使用 CLIPS4android 库作为 JNI 的包装器。
当通过调用 clips.run() 执行规则时,如何从类文件中获取输出
类规则测试(文件路径:字符串?){ 私人 val 剪辑:环境 有趣的停止(){ 剪辑.destroy() }
/**
* Example of how to use "assert".
* @throws CLIPSError
*/
@Throws(CLIPSError::class)
fun assertItems(products: List<Item>) {
for (product in products) {
Log.d(tag, "(Product " + "(productId " + product.ProductId + ")" + "(uomid " + product.UOMId + " )" + "(quantity " + product.Quantity + " ))")
var InsertItem: String
InsertItem = "(Product " + "(productId " + product.ProductId + ")" + "(uomid " + product.UOMId + " )" + "(quantity " + product.Quantity + " ))"
clips.assertString(InsertItem)
}
}
fun run() {
clips.eval("(facts)");
clips.run()
}
companion object {
const val tag = "CLIPSProductRulesTest"
}
init {
clips = Environment()
clips.load(filepath)
Log.d(tag, "Loading .clp...\n\n")
clips.reset()
}
}
【问题讨论】:
-
不清楚您所说的“类文件输出”是什么意思。
-
@GaryRiley :实际上我们正在使用 CLIPS4android 库在 Android 中运行剪辑,见上面这是我正在使用的类
-
我可以使用 Clips.run() 函数运行规则。但规则输出仅记录在 logcat 中。没有获取输出的函数。
标签: android kotlin rules clips