In the docs, there’s an example rule:
(defrule get-windspeeds-from-location
[?temp <- [Temperature (= ?location location)]]
[?wind <- (acc/all) :from [WindSpeed (= ?location location)]]
=>
;; do something
)
Am I correct in thinking that the first condition should actually be [?temp <- Temperature (= ?location location)]
, i.e. with no nested vectors?
It can be either insofar as I know
@cfleming I have some changes that I’m not totally happy with that try to accommodate that
Oops. Looks like that would entail an “extraneous vcector error”
@alex-dixon @cfleming I think the first condition of that rule is incorrect
There shouldn’t be a vector around Temperature in the non-accumulator case. What @cfleming said is right on that one.
If Clara accepts it. I think it would be with the wrong semantics.
Great, thanks Mike
[?order <- [WorkOrder (= ?clientid clientid)
(= scale :big)
(< (days-between requestdate duedate) 14)]]
=>
CompilerException clojure.lang.ExceptionInfo: Type [WorkOrder (= ?clientid clientid) (= scale :big) (< (days-between requestdate duedate) 14)] is a vector and appears to contain expressions. Is there an extraneous set of brackets in the condition?
It’d consider the whole thing to be the “fact type”. Which is related to the issue of ambiguity of syntax when you allow any arbitrary structure for a fact type. We discussed this on some issue recently
As the unofficial ranter about macro error messages, that’s a very nice message indeed.
Oh nice. Yeah I guess that case was special cased. Due to it being fairly easy to mistakenly do
@mikerod I haven’t gotten around to doing a comprehensive writeup, but basically I was looking at how to address https://github.com/cerner/clara-rules/issues/343 and ran into what I think are some issues with to-dnf. Basically since the :or operation is actually more of a union in the set theory sense, I think the to-dnf transforms can end up messing with cardinality. For example, [:not [:and A B]] is equivalent to [:or [:not A] [:not B]] in a boolean sense, but the second can match twice and the first can’t in the context of Clara.
@wparker thanks. I remember the topic better now.