Hammurabi Scala规则引擎 项目简介
Hammurabi 是一个 Scala 编写的规则引擎,适合实现便于阅读的内部DSL。与其他 DSL 不同的是,Hammurabi 可直接使用宿主语言编写和编译规则。 示例规则: rule ("Person to Fred’s immediate right is wearing blue pants") let {
val p1 = kindOf[Person] having (_.name == "Fred")
val p2 = any(kindOf[Person])
when {
p2.pos equals p1.pos + 1
} then {
assign color "blue" to p2
}
}
val p1 = kindOf[Person] having (_.name == "Fred")
val p2 = any(kindOf[Person])
when {
p2.pos equals p1.pos + 1
} then {
assign color "blue" to p2
}
}