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}
Is this a problem with my rules?
Also, how do I interpret this data?
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...
@hjrnunes logical insertion is the default c/insert!
in the RHS of the rules
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.
I don’t think that is your main question though, you are wondering why :fact->explanations
is nil above
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.
Also, :rule-matches
says similar, there were not matches for the rule
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
Perhaps you can show how you ran this rule.
@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
if not I'll come back with a fuller example
sounds good