[rules-users] Logical insert and cyclic rules dependences

Wolfgang Laun wolfgang.laun at gmail.com
Tue Jul 3 07:01:53 EDT 2012


On 03/07/2012, zephyr <ls262570 at students.mimuw.edu.pl> wrote:
> It almost
> worked, almost is this logic junk that stays and brakes some of my
> conclusions.

Isn't this a very good metaphor for our brain?  ;-))

Here's one way that I've thought of that might help you to detect such "junk".

Let's assume that you wrap insertLogical() and run a check prior to
the actual insertion. If you have a graph representing the logical
dependencies between inferred facts it's a simple thing to detect any
cycles. As soon as an insertion would create a cycle, do not insert.

For each actual insertion, determine the logically inserted facts
backing the new insertion and extend the graph with one new node and
edges.

Use a listener for retractions. For an inferred fact that is
retracted: locate the node in the graph and destroy it and its
incoming and outgoing edges, if any. (Do not propagate this successors
of deleted edges - there should be another retract for them soon
enough.)

The iffy part here is that I've recklessly assumed that the logically
inserted facts don't have any mutable attributes.

I hope that this is logically sound. The technical task should be feasible,

-W


More information about the rules-users mailing list