I am trying to construct a rule-based system for interpreting data. However, I am having issues deciding on a way to construct the logic for storing and interpreting rules.
Currently, there is a database structure that quite complex, but will deal with all aspects of storing the rule data. The idea is that the system will be able to mimic the way that MS Outlook allows a user to add rules.
My problems are as follows:
- What pattern should I be using to store these rules inside objects?
- Should I use eval() or proper object orientation to execute the rules?
And example rule might be:
Dog must have collar in area park
Where each element (dog, must have, collar, in area, park) is a separate piece of logic to be interpreted.
Any general advice to the above questions is much appreciated!