Repository navigation
Coln query/logical query program abstraction - #182
Merged
Merged
Conversation
…ery IR (using an antijoin)
…d predicates and atoms
… through logical program
…g index out of bounds
…redicate not yet being anounced
… (non-existing) row id of a derived view
… and their dependencies using graphviz
…but statically ensure that only a valid program can ever be turned into a query program
…phs, and query programs under target/test_artefacts if COLN_QUERY_TEST_DUMP is set
…d in atoms, no duplicate declarations, no malformed head declarations in rules
…n positive atom), strict negation safety (vars of negated atom must appear in positive atom) and comparison safety (vars in comparisons must appear in positive atom)
…sed to negative) consistently
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a proper logical program (Datalog) layer in between the FLIR (which is essentially Datalog + implications) and the query IR. It is a real Datalog layer insofar that each rule must be in Horn-clause form, requiring a little translation to go from FLIR to logical program (especially true for constraints). The second translation from logical program to query IR is then handled just on top of this Datalog view without any knowledge of what a FLIR is.
rulewithselection(antecedent, x != y)on top of the queryantecedentwhich computes, well, the antecedent. Whenever the consequent is just onePropand all its variables are covered by the antecedent, the helper predicate can be omitted and "inlined", which I want to implement after my vacation.For this to work properly, the logical program layer performs some static analysis checks:
0..arityrange of its predicate and each referenced predicate has been declared ("no dangling predicates").p -> smeans that predicatepdepends ons. A red edge with label¬indicates negation.This is

TransitiveClosure.coln:This is

GraphOfGraphs.coln:And this is the Datalog pretty print of
TransitiveClosure.coln:@olynch: To your dismay, all friendliness is gone for good from the translation, so you won't find
FriendlyVars and friends anymore on my next easter egg (bug?) which I've placed in some hard-to-finddebug_assert!(side_effect)for you 😄.