Open source project Nadia Rule/Policy Engine with C/C++. This project is based on original project Nadia Rule/Inference Engine.. As this project is titled, this project is written in C/C++.
In addition, this C/C++ version of NADIA includes its own script engine unlike Java and C# version because C/C++ language does not support JavaScript engine. The script engine is implemented based on a book of 'Crafting Interpreters' written by Robert Nystrom, which can be found at a link of 'Crafting Interpreters'.
In order to see an example of implementation of back-end database and front-end, please see NADIA Java REST.
Video is also avaiable at NADIA Policy / Business rules Engine from NExST.R&DLabs
or
another link is Introduction of NADIA Policy / Business rules Engine from NExST.R&DLabs.
NADIA Java
NADIA Java REST
NADIA C#
This project is building a Rules(Policies)/Inference Engine with ease of use and maintain rules/policies. It aims to be:
- A rule author is allowed to write rules or policies in a plain text file for the engine rule parser
- A rule author or business person does NOT need to implement the rules/policies separately like other rules engines
- A user of the engine can carry out Foward-chaining and Backward-chaining with a given rule/policy set
Note: current source code is developed in Mac XCode.
In order to install the project in your workspace, you may need to do followings;
- Install C++ compiler(current source code is targeted for GNU++17(C++) and GNU 11(C)).
*Please note that there will be Demo video available soon.
Add more features as follows (particularly this C/C++ version);
- Completing an Interpreter for evaluating calculations within rules
- GUI for Rule IDE (it is just more than editor. working as an development IDE)
- Retrieving Rule/Policy file from database (DONE with PostgreSQL in this version)
- Workflow engine with GUI based diagram editor
- Machine Learning type inference mechanism (DONE in this version)
If you would like to contribute to this project, then please create your own branch and name the branch clearly. Once the work is done in the branch then do 'pull request' and send an email to '[email protected]'.
Please have a look at a file of testing rule. Within the example file, all indented rules uses 'Tab' key for indentation. The rule scanner considers of an indented rule as a child rule of previous rule in a rule text.
If you need a commercial or coustomised version of Nadia engine, then please contact on '[email protected]'.
There is a number of key components as follows;
- Rule reader : reads a rule/policy file, stream source, string source
- Rule scanner : scans what 'Rule reader' reads
- Rule parser : parses what 'Rule scanner' scans into a rule/policy graph
- TopoSort : sorts the graph parsed by 'Rule parser'
- Inferece Engine : checking all truth or calculated value within forward-chaining, and retrieving next rule/policy within backward-chaining to check in order to complete rule set logic
Suppose there are following rules:
- IF either
'statement B' is true; or
'statement C' is true
THEN
'statement A' is true. - IF both
'statement D' is true; and
'statement E' is true
THEN
'statement C' is true. - IF
'statement F' is true
THEN
'statement D' is false. - IF
'statement G' is false
THEN
'statement E' is true.
An inference engine when using backward chaining searches the inference rules until it finds one which has a consequent (Then clause) that matches a desired goal. For instance, if we want to know whether or not the rule of 'statement A' is 'true' or 'not true(false)', an engine finds out which rule has to be checked to conclude. In this case, the engine needs information about the rule of 'statement B' is 'true' or 'not true(false)', or 'statement F' and 'statement G' are 'true' or 'not true(false)' respectively.
An inference engine using forward chaining searches the inference rules until it finds one where the antecedent (If clause) is known to be true. For instance, if we do have facts that 'statement G' is true and 'statement F' is true then the engine concludes as follows;
- 'statement G' is true
- 'statement F' is true
- 'statement E' is false due to that 'statement G' is not false
- 'statement D' is false due to that 'statement F' is true
- 'statement C' is false due to that 'statement D' is true and 'statement E' is false
- 'statement B' is unknown due to that there is not given information to infer about 'statement B'
- 'statement A' is false with given information of 'statement B' and 'statement C', however it could be changed based on conclusion of 'statement B' because 'statement B' is unknown.
Copyright (c) 2017-2022 individual contributors. NADIA-CPP is open source project and released under AGPL 3.0 License.