clara

http://www.clara-rules.org/
2018-12-06T13:29:56.006700Z

Hello! I'm trying to get some explanations for my rules, but clara.tools.inspect/explain-activations doesn't print anything at all. With clara.tools.inspect/inspect I get a map but :fact->explanations is nil:

{:rule-matches
 {{:ns-name validator.typing,
   :lhs
            [[:not {:type validator.typing.LowCardinality, :constraints []}]],
   :rhs     (do (c/insert! (->ColType :t))),
   :props   {:salience -100},
   :name    "validator.typing/text",
   :doc     "The column is textual when cardinality is not low"}
  (),
  ...
  :query-matches ...
  :condition-matches
  {{:type validator.typing.ColInfo, :constraints [(= 1 non-num-vals)]}
                                                                   (),
   {:type validator.typing.LowCardinality, :constraints []}        (),
   ...
  :insertions
  {{:ns-name validator.typing,
    :lhs
             [[:not {:type validator.typing.LowCardinality, :constraints []}]],
    :rhs     (do (c/insert! (->ColType :t))),
    :props   {:salience -100},
    :name    "validator.typing/text",
    :doc     "The column is textual when cardinality is not low"}
   (),
   ...},
  :fact->explanations nil}

2018-12-06T13:30:13.007100Z

Is this a problem with my rules?

2018-12-06T13:30:57.007500Z

Also, how do I interpret this data?

2018-12-06T13:37:29.009200Z

OK, I re-read the docs, and I can't understand what is meant by 'logical insertions". Isn't this inserting a fact on the RHS of a rule? The one above is inserted in the RHS of a rule, but there's no explanation for it...

2018-12-06T15:07:54.010300Z

@hjrnunes logical insertion is the default c/insert! in the RHS of the rules

2018-12-06T15:08:35.011300Z

it is referring to insertions that are managed by the truth maintenance system (TMS) of the engine. If the rule is found to later become unsatisfied in its LHS, the logically inserted fact will be automatically retracted.

2018-12-06T15:08:53.011700Z

I don’t think that is your main question though, you are wondering why :fact->explanations is nil above

2018-12-06T15:12:14.012400Z

What you have above, if you look at :insertions, it is saying that the rule :name validator.typing/text had no facts inserted as a result of it.

2018-12-06T15:12:35.012700Z

Also, :rule-matches says similar, there were not matches for the rule

2018-12-06T15:13:03.013200Z

So the result of this is that you have no facts that were inserted from a rule, so there are no :fact->explanations to show

2018-12-06T15:13:25.013500Z

Perhaps you can show how you ran this rule.

2018-12-06T17:25:26.014800Z

@mikerod thanks! I'll take a better look at the inspect result and rules tomorrow based on your feedback to see if I get it

2018-12-06T17:25:39.015200Z

if not I'll come back with a fuller example

2018-12-06T17:37:28.015400Z

sounds good