oracle-samples/clara-rules

Support field accessor syntactic sugar within accumulators that use field accessors

Opened this issue · 0 comments

As discussed on #498, clara supports the idea of syntactic sugar within the LHS constraints when accessing fields on both POJOs and Clojure Records.

However, the default accumulators do not expose the same contract with respect to the sugar provided. This can cause a bit of a gotcha in the sense that the user can avoid the distinction(POJO vs Record) within the constraints but must evaluate that distinction for the usage of the accumulator.

If possible I would like to extend the syntactic sugar portion of field access to all portions of the LHS if possible, such that Users need not make a distinction between the access pattern within the default accumulators.

For example, I would like the following rule:

(defrule some-java-fact-rule
  [?fact <- (acc/max #(.getValue %)) :from [MyObject]]
  =>
  (insert! ....))

to be expressible via something like:

(defrule some-java-fact-rule
  [?fact <- (acc/max value) :from [MyObject]]
  =>
  (insert! ....))