Hiya! Another question 🙂 I have a rule to infer edges in a graph:
B
/ \
A C
This ^ is checked by the LHS and inserts an edge A -> C in the RHS. The issue is that I don't want to insert an edge if one already exists. So I added a [:not ...] clause which checks that an edge from A -> C doesn't exist. This now causes an infinite loop. Can anyone help me understand why?I’d typically not favor an unconditional insertion approach to this.
Instead, do not make this particular rule sensitive to only inserting 1 edge
Instead insert some intermediary fact type that you then aggregate with an “all” collecting accumulator in another rule to give you your distinct edge fact you are looking for.
This way you can still get the utility from the truth maintenance system (TMS). When you mix in unconditional logic, you could get your rules into an inconsistent state. You’d generally have to fix this with various salience settings and overall I think that leads to more order-dependent rule flow that is more difficult to manage.
(unless you want serialized sessions as already mentioned).
Solved by https://clojurians.slack.com/archives/C08TC9JCS/p1632454527004400 duckie