org.drools.verifier.alwaysFalse.Rules.drl Maven / Gradle / Ivy
#
# created on: 5.6.2008
#
# Rules in this package look for patterns and rules that can never be satisfied.
#
#
package org.drools.verifier.alwaysFalse
#list any import classes here.
import org.drools.verifier.components.VerifierRule;
import org.drools.verifier.components.RulePossibility;
import org.drools.verifier.report.components.Severity;
import org.drools.verifier.report.components.MessageType;
import org.drools.verifier.report.components.Incompatibility;
import org.drools.verifier.report.components.VerifierMessage;
import org.drools.verifier.dao.VerifierResult;
global VerifierResult result;
#
# Finds rules that are always false.
#
# Dependencies:
# Needs at least one of the following packages or rules to fire:
# package org.drools.verifier.incompatibility;
# rule "Incompatible Patterns"
#
# Example:
# Pattern( a == b && a != b )
#
rule "Rule that is always false"
when
$r :VerifierRule()
# All the rule possibilities for rule need to be in conflict
forall(
$rp :RulePossibility(
ruleId == $r.id
)
Incompatibility(
left memberOf $rp.items,
right memberOf $rp.items
)
)
then
# Report an error
result.add( new VerifierMessage(
Severity.ERROR,
MessageType.ALWAYS_FALSE,
$r,
$r + " can never be satisfied." ) );
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy