clara

http://www.clara-rules.org/
sparkofreason 2018-02-06T02:07:51.000293Z

Is there any documentation of the :exists feature? I saw some discussion about it on google groups and maybe in an issue, but haven't found much else.

2018-02-06T15:02:40.000694Z

@dave.dixon not sure if there are any docs on it

2018-02-06T15:02:45.000113Z

https://github.com/cerner/clara-rules/issues/130 has some discussion

2018-02-06T15:03:12.000283Z

that’s the best I’ve found as far as docs on it

2018-02-06T15:03:27.000857Z

(didn’t do an exhaustive search)

2018-02-06T15:12:35.000126Z

@dave.dixon I don’t see any docs on it based on a search for “exists” in the clara-site repo. Having doc would be desirable. In the meantime it is really a pretty form of syntax sugar - you can just mentally make the substitution the compiler does at https://github.com/cerner/clara-rules/blob/master/src/main/clojure/clara/rules/compiler.clj#L618 if you’re trying to understand the behavior

sparkofreason 2018-02-06T15:41:49.000792Z

@wparker Thanks. So looking at that, [:not [:exists ...]] should work as expected, i.e. that "no fact satisfying the conditions exists" as opposed to "maybe some fact exists that doesn't satisfy the conditions"?

2018-02-06T15:43:36.000584Z

Unfortunately not at the moment; see https://github.com/cerner/clara-rules/issues/329

2018-02-06T15:44:11.000849Z

In the case of :not :exists there isn’t much reason to write it like that though, as I mentioned on the issue

sparkofreason 2018-02-06T15:44:43.000257Z

Ah. Okay, I thought maybe I was just writing the expression, wrong. I'll take a look at the discussion.

2018-02-06T15:44:47.000940Z

as a general API concern, it is something that seems like it should work.. but haven’t gotten around to fixing it

sparkofreason 2018-02-06T16:40:53.000418Z

It does seem to work. I was having some issues and thought this may be the culprit, but it was other things (which had nothing to do with clara per se). I was a little suspicious of that binding inside the negation as well, but is seems to operate as intended, i.e. "There is no Request fact equal to the Request entry on the Response fact".

sparkofreason 2018-02-06T21:46:04.000584Z

It looks like the current behavior of parameterized queries is to just return an empty seq if all of the arguments are not bound in the call to query. It would be useful sometimes if leaving out a parameter just treated it as unbound, though I think you could only get away with this when the parameters are used in simple equality constraints, e.g. [?:foo] [Foo (= ?foo foo)]. I can get this behavior by wrapping query, but was wondering if there was a way to achieve it directly in clara.