Interface SessionOps

All Known Subinterfaces:
RhsContext, RuleSession<S>, StatefulSession, StatelessSession
All Known Implementing Classes:
AbstractSessionWrapper

public interface SessionOps
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deletes a fact from the working memory.
    default FactHandle
    insert(Object fact)
    Inserts a fact in working memory and returns a serializable fact handle.
    insert0(Object fact, boolean resolveCollections)
    Inserts a fact in working memory and returns a serializable fact handle.
    insert0(String type, Object fact, boolean resolveCollections)
    Inserts a fact and explicitly specifies its Type name.
    default FactHandle
    insertAs(String type, Object fact)
    Inserts a fact and explicitly specifies its Type name.
    void
    update(FactHandle handle, Object newValue)
    Updates a fact that already exists in the working memory
  • Method Details

    • insert

      default FactHandle insert(Object fact)
      Inserts a fact in working memory and returns a serializable fact handle. The engine will derive the fact's logical type from its Java class.
      Parameters:
      fact - object to insert
      Returns:
      fact handle assigned to the fact
      Throws:
      NullPointerException - if argument is null
      See Also:
    • insert0

      FactHandle insert0(Object fact, boolean resolveCollections)

      Inserts a fact in working memory and returns a serializable fact handle. When resolveCollections is set to true, and the fact is an Iterable or an Array, the engine will instead insert its components and return a null FactHandle. The engine will derive logical type of the fact(s) from their Java class names.

      Together with the insert0(String, Object, boolean) method, this operation constitutes the core insert operations that are actually implemented by the engine. The other insert methods are just convenience wrappers of the two.

      Parameters:
      fact - object to insert
      resolveCollections - collection/array inspection flag
      Returns:
      fact handle assigned to the fact, or null if multiple facts were inserted
      Throws:
      NullPointerException - if argument is null
      See Also:
    • insert0

      FactHandle insert0(String type, Object fact, boolean resolveCollections)

      Inserts a fact and explicitly specifies its Type name. When resolveCollections is set to true, and the fact is an Iterable or an Array, the engine will instead insert its components, and return a null FactHandle.

      Together with the insert0(Object, boolean) method, this operation constitutes the core insert operations that are actually implemented by the engine. The other insert methods are just convenience wrappers of the two.

      Parameters:
      fact - object to insert
      resolveCollections - collection/array inspection flag
      type - explicit logical type of the inserted fact(s)
      Returns:
      fact handle assigned to the fact, or null if multiple facts were inserted
      Throws:
      NullPointerException - if argument is null
      See Also:
    • delete

      void delete(FactHandle handle)
      Deletes a fact from the working memory.
      Parameters:
      handle - The FactHandle associated with the fact to be deleted.
    • update

      void update(FactHandle handle, Object newValue)
      Updates a fact that already exists in the working memory
      Parameters:
      handle - fact handle, previously assigned to original fact
      newValue - an updated version of the fact
    • insertAs

      default FactHandle insertAs(String type, Object fact)

      Inserts a fact and explicitly specifies its Type name.

      Parameters:
      type - explicit logical type of the inserted fact
      fact - fact to insert
      Returns:
      fact handle assigned to the fact
      Throws:
      NullPointerException - if argument is null
      See Also: