clara

Dave Russell 2023-03-07T22:48:54.525669Z

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?

âś… 1
2023-03-08T15:28:37.025529Z

I’d typically not favor an unconditional insertion approach to this.

2023-03-08T15:28:49.823479Z

Instead, do not make this particular rule sensitive to only inserting 1 edge

2023-03-08T15:29:25.403769Z

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.

2023-03-08T15:30:21.389849Z

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.

2023-03-08T15:32:21.464019Z

(unless you want serialized sessions as already mentioned).

Dave Russell 2023-03-07T22:56:20.209479Z

Solved by https://clojurians.slack.com/archives/C08TC9JCS/p1632454527004400 duckie