Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 25, 2024 10:20
Show Gist options
  • Save dacr/dc2a7ea4ba3db399e378166887e13765 to your computer and use it in GitHub Desktop.
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/a2728e954190560266a61bbb417f15a956f6c814
// 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.4.2"
//> using dep "org.drools:drools-examples:7.54.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