Interface Knowledge

All Superinterfaces:
Environment, EventBus, FluentEnvironment<Knowledge>, FluentImports<Knowledge>, Named, RuleSet<RuleDescriptor>, RuleSetContext<Knowledge,RuleDescriptor>, RuntimeContext<Knowledge>
All Known Implementing Classes:
KnowledgeWrapper

public interface Knowledge extends RuleSetContext<Knowledge,RuleDescriptor>
Knowledge is a preprocessed ruleset. Although the engine allows direct creation of rule sessions, having a prepared ruleset enables faster instantiation of sessions. Building knowledge instances especially makes sense if the rules use literal conditions and therefore require a very CPU-intensive compilation stage.
  • Method Details

    • getSessions

      Collection<RuleSession<?>> getSessions()
      Retrieves a collection of active RuleSessions associated with the Knowledge.
      Returns:
      a collection of RuleSessions
    • newStatefulSession

      StatefulSession newStatefulSession()
      Returns:
      new stateful session
    • newStatefulSession

      default StatefulSession newStatefulSession(ActivationMode mode)
      Creates a new stateful session with the specified activation mode.
      Parameters:
      mode - the activation mode to set for the session
      Returns:
      a new stateful session instance
    • newStatelessSession

      StatelessSession newStatelessSession()
      Returns:
      new stateless session
    • newStatelessSession

      default StatelessSession newStatelessSession(ActivationMode mode)
      Creates a new StatelessSession with the specified ActivationMode.
      Parameters:
      mode - the activation mode to set for the session
      Returns:
      a new stateless session instance with the specified activation mode
    • activationManager

      default <A extends ActivationManager> Knowledge activationManager(Class<A> factory)
      Sets the Activation Manager for the Knowledge instance.
      Type Parameters:
      A - the type of Activation Manager
      Parameters:
      factory - the class of the Activation Manager
      Returns:
      the updated Knowledge instance