-
Notifications
You must be signed in to change notification settings - Fork 25
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
supporting expressions #38
Comments
This is a proposal to add a new term type to hold expressions over values, like addition, string concatenation, list intersection, etc. We would define that new term type as follows:
The terms inside he expression could be normal values (numbers, strings, etc) or variables, or even other expressions, that could be resolved when applying a rule. as an example, if we had the facts Unfortunately, with the current (naive) approach of pregenerating all of the facts by applying rules over and over, we could get into an infinite loop with this rule: To support this, we could either allow expressions only in the body of rules, or switch to a more conventional top down evaluation of rules and facts, ie applying rules only if the generate facts we are looking for in our queries and caveats |
Question, has there been any cross-pollination from Ddlog? |
Not really. It seems that every project that integrates a Datalog starts an implementation from scratch 😆 |
Yeah, but I'm wondering if taking some syntax and semantics from there might be interesting. I like the way the language feels there. |
Which ones, more specifically? |
Mainly the richer atom types provided and pattern matching. |
I've given this more thought, and I think we should instead evolve the constraints to be expressions. This would allow most of the interesting cases, but without unbounded generation of new values. This would also provide an easy upgrade path, as current constraints are a subset of expressions (only one variable, comparison with a constant). |
Sounds like a good plan. |
I'd like to add support for aggregates too, but it can significantly increase the complexity of datalog evaluation. There are great use cases there, though, like generating the intersection of sets: each block comes with a fact containing a set of accepted values, we have a verifier rule that generates the set of accepted values from all blocks |
Current list of operations that should be supported (the schema will be updated): Unary operations: Boolean:
String, Bytes, set:
Binary operations: Integer:
Date:
Date:
String:
Symbol:*
Byte array:
Boolean:
Set:
There is now a sample for those operations: 1c09f36 |
do we need operations like these:
they would not be too hard to implement, but integrating them to the syntax might be complex
The text was updated successfully, but these errors were encountered: