You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, datalog-rules/rules can only return the whole list of registered rules, which potentially contains tens or hundreds of rules.
As long as you only use the returned list without post-processing it, this is fine, because the Datalog engine itself will cache the compilation of this monolithic list of rules. However, if you want to do something fancy e.g adding a programmatically generated rule, you won't hit the cache, causing compilation and caching of a large ruleset at each call, which would be problematic for performance.
Most of the time, a query only needs a very small subset of the registered rules to run. Therefore, we could enhance datalog-rules by adding an option to explicitly state which rules to export, using dependency tracking behind the scenes to export only those rules and their dependencies.
The API could look like:
(dr/rules rs :only [rule-name-1 rule-name-2])
Implementation difficulties:
The dependency digraph between rules may not be acyclic, because of mutual recursion.
In order to know which rules a given rule depends on, one needs to identify the rule-exprs in its body, which may require nontrivial parsing.
The text was updated successfully, but these errors were encountered:
Currently,
datalog-rules/rules
can only return the whole list of registered rules, which potentially contains tens or hundreds of rules.As long as you only use the returned list without post-processing it, this is fine, because the Datalog engine itself will cache the compilation of this monolithic list of rules. However, if you want to do something fancy e.g adding a programmatically generated rule, you won't hit the cache, causing compilation and caching of a large ruleset at each call, which would be problematic for performance.
Most of the time, a query only needs a very small subset of the registered rules to run. Therefore, we could enhance
datalog-rules
by adding an option to explicitly state which rules to export, using dependency tracking behind the scenes to export only those rules and their dependencies.The API could look like:
Implementation difficulties:
rule-expr
s in its body, which may require nontrivial parsing.The text was updated successfully, but these errors were encountered: