Skip to content
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

Problem iterating the engine with a list of rule packages #201

Open
raulrojasadl opened this issue Feb 25, 2020 · 1 comment
Open

Problem iterating the engine with a list of rule packages #201

raulrojasadl opened this issue Feb 25, 2020 · 1 comment

Comments

@raulrojasadl
Copy link

@raulrojasadl raulrojasadl commented Feb 25, 2020

Hi @CacheControl , I need your help.

I'm trying to iterate the engine.run with packages of rules and a initials facts that takes new facts every time that the engine evaluate new rules. The problem is that the engine take the first facts and evaluate all rules with this facts and avoid the new facts.

It's something like this:

currentFacts = set initial facts
rulePackages = [ruleList1, ruleList2....]
rulePackages.forEach(ruleList => {
const engine = new Engine(ruleList, engineOptions);
await engine.run(currentFacts).then(results => {
          if (results.events.length > 0) {
            results.events.forEach(e => {
              Object.keys(e.params).forEach(key => {
                   currentFacts[key] = e.params[key];
        });
});
}
});

})

The problem is that currentFacts[key] = e.params[key]; not works, the facts in the results object of every iteration is the same as initial facts.

Thanks for your help.

@raulrojasadl
Copy link
Author

@raulrojasadl raulrojasadl commented Mar 25, 2020

Hi @CacheControl, sorry for insisting. Do you have any ideas to address this problem?

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.