seanpmaxwell / trool Goto Github PK
View Code? Open in Web Editor NEWA rule engine for NodeJS written in TypeScript
License: MIT License
A rule engine for NodeJS written in TypeScript
License: MIT License
I was wondering if Trools has the capability to configure a rule in CSV that has an AND / OR.
( variable1 = 1 and variable1 = 2 ) OR ( variable3 = 3 and variable4 = 4 ).
Drools a similar rule engine has a feature called ACTIVATION-GROUP to stop execution if one rule in the same activation group evaluates to T.
A question:
Hi,
I'm trying to find a way to compare 2 facts. So for example if I have
priceOne
priceTwo
and I want a rule to use whichever price is lower. If rules have to be of the form
fact (operator) $param
where param is specified in the table, I don't think I can do that?
thanks
Hello I'm currently working on your lib: He is what I discover
1)"While on a rule's action column, each param specified must be separated by a comma. If no params are specified (the cell is blank), the rule will skip that action column."
I would like to put n parameter $param in my method actions according to your rules:
eg ==> addNumber($param $param) , on the next row I have to put:
eg ==> 2, 3 separated by comma.
I got the follow issue :
Error: Error on DecisionTable(ADDITION) : The number of params for an action operation must match the number of argument for the method: addNumber($param $param)
I resolved that issue by modifying the source code :
SOLUTION 1:
filename: engine.ts
method: callActionOp()
line: var cellVals = cellValStr.split(';') changing the comma into semi colon
EDIT :
SOLUTION 2:
add quote in the csv for example: addNumber($param $param) --> "3,5"
Because my CSV was delimiter by comma so I'm getting trouble to seperate parameters for a same action
2)Can we do something like cond1 ==> action1 ==> condi2 ===> action2 ?
seems that the 1st table will be overwrited by the 2nd...
3)Finally, Can I return the result to another object other than the Fact object? Does it have to be inside of that object or I can put that fact to another object?
Thank you in advance for your reply.
Hey there,
Thank you for such an amazing library.
We gave this a try and it works quite well, but we want to make sure that it can scale up as the ruleset size increases and the request-load increases, how would this tolerate load.
Would it be better to load the CSV just once, return an instance object, and then let the user call applyRules
as many times as needed? This will reduce reading the file from a disk again and again on every evaluation call.
Let me know what you think.
Cheers, Anuraag.
Hello,
I was wondering if there is any feature to export or read rules that are already in the .csv file. This would save a lot of time and handling when attempting to read the table on our own.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.