Skip to content
Jesse Bouwman edited this page Apr 7, 2017 · 3 revisions

Naga

Naga is a forward chaining production rules engine, built on graph databases.

Overview

Naga is a rules engine based on a variation of the RETE Algorithm. The variation here is that instead of using memory for the Alpha and Beta memory nodes in the network, it uses database indexes to identify the data associated with the nodes. Counting of pattern resolutions is used to perform "semi-naïve evaluation", evaluating when rules need to be executed, which substitutes for the memory update triggers in the traditional RETE approach.

In practical terms, this means that rules are expressed as queries on a graph database. These queries are pulled apart to identify interdependencies, and this dependencies are checked by performing fast database operations to identify when the entire query needs to be evaluated.

Naga is based on Predicate Logic, and is oriented around binary predicates. Other arities are supported by deconstruction into binary-predicate form (this is managed at the data layer). Predicate assertions are represented as "triples" in a graph database, which allows for efficient indexing of data along any axis. Naga interfaces with graph databases through a protocol, so it should be simple to wrap various graph DB APIs for inclusion. This includes databases such as Datomic, RDF databases, OrientDB, Neo4j, and others. Naga includes an in-memory database to use by default.

Clone this wiki locally