-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Apply idea strategy for chain engine. #105
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,10 +22,11 @@ export async function main(sequelize: Sequelize): Promise<void> { | |||||||||||||||
|
|
||||||||||||||||
| const handler = (rule: Rule) => { | ||||||||||||||||
| const ds = rule.toString(); | ||||||||||||||||
| tasks.push(insertOrIgnore(Fact, ds)); | ||||||||||||||||
| const idea = strRuleGetStrIdea(ds); | ||||||||||||||||
| if (idea) { | ||||||||||||||||
| tasks.push(insertOrIgnore(Idea, idea)); | ||||||||||||||||
| } else { | ||||||||||||||||
| tasks.push(insertOrIgnore(Fact, ds)); | ||||||||||||||||
|
Comment on lines
26
to
+29
|
||||||||||||||||
| if (idea) { | |
| tasks.push(insertOrIgnore(Idea, idea)); | |
| } else { | |
| tasks.push(insertOrIgnore(Fact, ds)); | |
| tasks.push(insertOrIgnore(Fact, ds)); | |
| if (idea) { | |
| tasks.push(insertOrIgnore(Idea, idea)); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes the chain engine insert into
Factsonly when no idea is derived. Sincestr_rule_get_str_idea()returns an idea for common derived rules (e.g. parsed "a => b" becomes "a\n----\nb\n"), this will drop inferred facts from thefactstable and break the system contract where engines publish new facts and (optionally) ideas. Suggestion: keep insertingdsintoFactsunconditionally, and insert intoIdeasadditionally whenideais present (matchingddss/search.pyand the chain tests).