Replies: 1 comment 2 replies
-
Hi @maarek Currently, you can't add more fact into the Datacontext from within the rule. Unless, you add more fact your self from your own helper function. For example: type Fact struct {
Ctx *ast.DataContext
}
func (f *Fact) AddFact() {
f.Ctx.Add("MoreFact", morefact)
}
...
...
dataCtx := ast.NewDataContext()
myFact := &Fact {
Ctx : dataCtx,
}
dataCtx.Add("MyFact", myFact) And from the GRL
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that you get quite a few errors when a rule tries to evaluate against the known facts and the current context does not have the fact or selector defined that is present in the rule. What I am trying to do is evaluate what is know and add facts to the system during execution or rerun, keeping the current context, if the current execution exhausts all paths and new facts are introduced.
For example, if during the execution of a fact against rules, a function is called which would add new facts into the context. This would be opposed to introducing change to the currently known facts of the system in way of the known facts having some sort of map that new facts would be loaded into.
Is something like this possible or another way I should be thinking about a system like this? I should note that I'm using facts and rules from json and not struct types.
Beta Was this translation helpful? Give feedback.
All reactions