The algorithm for detecting unsafe rules is now located in a dedicated class: RuleValidator. This algorithm is taken from Principles of Database and Knowledgebase Systems, Ullman, page 105:
A rule is considered safe if all variables are limited.
A variable is limited if:
However, rule validation in IRIS can be parameterised to allow the relaxation of two aspects of this algorithm, specifically:
These two relaxations of the definition of a safe rule are configurable (on/off) in the RuleValidator class.
If an unsafe rule is detected during the evaluation of a logic program then a RuleUnsafeException is thrown containing details of why the rule is considered unsafe.