Last active
October 6, 2024 10:54
-
-
Save dacr/dc2a7ea4ba3db399e378166887e13765 to your computer and use it in GitHub Desktop.
Drools official minimalist FireKB example / published by https://github.com/dacr/code-examples-manager #f8f7f856-6439-49aa-b2ff-d7a0ab3ce15f/a9e33a6dda7d568dc1f4f28448bf55ac0a99efd0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : Drools official minimalist FireKB example | |
// keywords : scala, drools, mvel, ai, knowledgebase, @testable | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : f8f7f856-6439-49aa-b2ff-d7a0ab3ce15f | |
// created-on : 2019-10-23T22:02:54+02:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// --------------------- | |
//> using scala "3.5.1" | |
//> using dep "org.drools:drools-examples:9.44.0.Final" | |
// --------------------- | |
import org.kie.api._, org.kie.api.runtime._ | |
import org.drools.examples.fire._ | |
val kServices = KieServices.Factory.get | |
val kContainer = kServices.getKieClasspathContainer() | |
val base = kContainer.getKieBase("FireKB") | |
val session = base.newKieSession() | |
val names = kContainer.getKieBaseNames | |
println(names) | |
session.insert(new Fire(new Room("123"))) | |
session.fireAllRules() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment