Fork me on GitHub
#clara
<
2018-12-06
>
hjrnunes13:12:56

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}

hjrnunes13:12:13

Is this a problem with my rules?

hjrnunes13:12:57

Also, how do I interpret this data?

hjrnunes13:12:29

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...

mikerod15:12:54

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

mikerod15:12:35

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.

mikerod15:12:53

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

mikerod15:12:14

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.

mikerod15:12:35

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

mikerod15:12:03

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

mikerod15:12:25

Perhaps you can show how you ran this rule.

hjrnunes17:12:26

@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

hjrnunes17:12:39

if not I'll come back with a fuller example

mikerod17:12:28

sounds good