View Source Wongi.Engine (Wongi.Engine v0.9.2)

A forward-chaining inference engine for Elixir.

A port of the Ruby library with the same name.

Summary

Functions

Returns an engine with the given fact added to the working memory.

Returns an engine with the given fact added to the working memory.

Returns an engine with the given rule installed.

Returns an engine with the given rule installed and the rule reference.

Returns a set of all facts matching the given template.

Returns a set of all facts matching the given template.

Creates a new engine instance.

Returns all production node references.

Returns an engine with the given fact removed from the working memory.

Returns an engine with the given fact removed from the working memory.

Returns a set of all tokens for the given production node reference.

Types

Functions

@spec assert(t(), fact()) :: t()

Returns an engine with the given fact added to the working memory.

Link to this function

assert(rete, subject, predicate, object)

View Source
@spec assert(t(), any(), any(), any()) :: t()

Returns an engine with the given fact added to the working memory.

@spec compile(t(), rule()) :: t()

Returns an engine with the given rule installed.

See Wongi.Engine.DSL for details on the rule definition DSL.

Link to this function

compile_and_get_ref(rete, rule)

View Source
@spec compile_and_get_ref(t(), rule()) :: {t(), reference()}

Returns an engine with the given rule installed and the rule reference.

The rule reference can be used to retrieve production tokens using tokens/2.

See Wongi.Engine.DSL for details on the rule definition DSL.

@spec find(t(), template()) :: MapSet.t()

Returns a set of all facts matching the given template.

Link to this function

find(rete, subject, predicate, object)

View Source
@spec find(t(), any(), any(), any()) :: MapSet.t()

Returns a set of all facts matching the given template.

@spec new() :: t()

Creates a new engine instance.

Returns all production node references.

@spec retract(t(), fact()) :: t()

Returns an engine with the given fact removed from the working memory.

Link to this function

retract(rete, subject, object, predicate)

View Source
@spec retract(t(), any(), any(), any()) :: t()

Returns an engine with the given fact removed from the working memory.

Returns a set of all tokens for the given production node reference.