Fork me on GitHub
#clara
<
2017-11-14
>
zylox18:11:11

when are you getting that exception

zylox18:11:39

session creation time it would appear

dave.dixon18:11:13

Yes, it's at session creation.

zylox18:11:31

ya sort-conditions specifically it would appear. im not as versed on queries though

zylox18:11:21

i cant get parameters to work unless they are used in a binding though. that doesnt seem right.

zylox18:11:19

(clara.rules/defquery ship-destroyed-at?
          [:?point]
          [?destroyed <- Destroyed (= ?ship ship)]
          [?placement <- ValidPlacement 
           (= ?ship ship)
           ((spaces this) ?point)])
for the record this doesnt seem to work either so its not the test node

mikerod18:11:44

Yeah, my first recommendation was going to be to not use a :test node when it isn’t necessary (although I’d still expect that to work)

mikerod18:11:56

However, @zylox has found that that is still a problem

zylox18:11:34

if i had to guess, the check this exception uses is too special cased and doesnt consider parameters.

zylox18:11:58

its the whole unbound vs bound thing again

zylox18:11:09

so its at least partially related to the thing from yesterday

ryanbrush18:11:59

The above queries won't work because ?point is not bound, although we could be more clear in our error messaging here.

ryanbrush18:11:38

The :?point is a query parameter, which just does a lookup. A query parameter is not "bound" when the rule engine is processing...it is simple used to look up bound values.

ryanbrush18:11:55

Since ?point is never bound in the query itself, we get that error message.

ryanbrush18:11:15

These semantics are a bit confusing in this case because we're conflating query parameters (which do not bind a variable) with variables that must be bound with an (= ?my-variable ...) or similar expression.

mikerod18:11:58

Woops, that makes sense to me. I blanked about how they were supposed to work here.

dave.dixon19:11:24

So presumably the way to attack this is to make a new fact using those conditions, rather than trying to just query?

zylox19:11:07

Clearly I need to brush up on queries

zylox19:11:14

...pun not intended

ryanbrush19:11:30

@dave.dixon Separating this out into another fact makes sense. I'm not quite sure what your objective for these rules is, but any approach that explicitly binds ?point in the query logic (not just the parameter) should work.

dave.dixon23:11:31

That worked great, thanks.