-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
default clauses for datalog #37
Comments
Agreed. We won't be able to implement |
I like the latter two, with the second one perhaps giving us the most flexibility. E.g., if we want to calculate a balance, but some users haven't paid / received anything yet so their respective queries currently don't evaluate:
With third suggestion:
Second suggestion looks weird if used on the rules / subqueries (it certainly doesn't look like we're binding
...but using it on the
Also, we could perhaps even expand the
This would still leave the binding of With suggestion 3 we would sacrifice that granularity and could only speak about
|
I prefer suggestion 3, because it is no new syntax, just a new type of binding. The "alfredo" use case seems highly confusing, because it breaks the unification intuition ( And another (approximate?) way of expressing that could be: (conj/paid ?person ?paid)
(conj/recv ?person ?recv)
(conj/paid "alfredo" ?paid-alfredo)
(default ?paid ?paid-alfredo) Which on the front-end seems like an elegant solution ( |
Some more findings, mostly intended as memo. Default can't be something associated with just a symbol. E.g. I'll try and see how a |
So comnik/declarative-dataflow@1a65b0f adds experimental support for something like this. Indeed it is both simpler and more complex than expected. More complex, because (for new-query-engine reasons) default bindings are not just dependent on entity ids for context, but also on the attribute that they are acting on. Simpler, because now My initial worries were unfounded, because when validating other bindings, this binding will already have a set of entity ids for context. (Of course this means that we'll have to wait with frontend support, until the new query engine is the default.) |
To prevent a situation where queries fail simply due to missing data, it might make sense to introduce default values (similar to
get-else
in datomic).The text was updated successfully, but these errors were encountered: