org.deri.iris.rules
Class RuleValidator
java.lang.Object
org.deri.iris.rules.RuleValidator
public class RuleValidator
- extends Object
We use the definition of a safe rule as described by Ullman, page 105.
A rule is safe if all variables are limited.
A variable is limited if:
1) It appears in a positive ordinary predicate
2) It appears in a positive equality with a constant, e.g. ?X = 'a'
3) It appears in a positive equality with another variable known to be limited, e.g. ?X = ?Y, ?Y = 'a'
However, variables that ONLY appear in a negated ordinary predicate (and nowhere else) can
still make for a safe rule, as such a rule can be re-written to move the negated sub-goal
to a separate rule, see the example in Ullman, page 129-130
Furthermore, variables that appear in arithmetic predicates can also be considered limited if
all the remaining variables are limited, e.g.
X + Y = Z, X = 3, Z = 4, implies that Y is also limited
These two relaxations of the definition of a safe rule are configurable (on/off).
|
Constructor Summary |
RuleValidator(IRule rule,
boolean allowNotLimitedVariablesInNegatedSubGoals,
boolean allowArithmeticPredicatesToImplyLimited)
Constructor. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RuleValidator
public RuleValidator(IRule rule,
boolean allowNotLimitedVariablesInNegatedSubGoals,
boolean allowArithmeticPredicatesToImplyLimited)
- Constructor. Each instance of this rule can process exactly one rule, after which it must be
discarded.
- Parameters:
allowNotLimitedVariablesInNegatedSubGoals - false, if the strict Ullman definition
should be enforced for variables in negated sub-goals.limitedTernaryOperandsImplyLimitedResult - false, if the strict Ullman definition
should be enforced for variables in that are in arithmetic predicates.
getAllUnlimitedVariables
public List<IVariable> getAllUnlimitedVariables()