Hi All,
I tried to use Drools Verifier to validate the available rules. I got all
the warning types like MISSING_EQUALITY, ALWAYS_FALSE. But I couldn t get
the redundancy warning, eventhough i have given the duplicate rules
explicitly.
I am using Drools Verifier 5.4.0.Final.
Herewith given the following details,
1. Sample rule file
rule "rule 1"
when
$server : Server(processors==2, memory==1024)
then
System.out.println("rule 1")
end
rule "rule 2"
when
$server : Server(processors==2, processors!=2)
then
System.out.println("rule")
end
rule "rule 3"
when
$server : Server(processors==2, memory==1024)
then
System.out.println("rule 3")
end
2. Code which verifies the validity of the rule.
VerifierBuilder vBuilder = VerifierBuilderFactory.newVerifierBuilder();
Verifier verifier = vBuilder.newVerifier();
verifier.addResourcesToVerify(new
ClassPathResource("sample.drl",
DroolsVerifierCheck.class),
ResourceType.DRL);
verifier.fireAnalysis();
VerifierReport result = verifier.getResult();
// To display the warnings in verifier.
Collection warningMessages =
result.getBySeverity(Severity.WARNING);
for (VerifierMessageBase msg : warningMessages) {
System.out.println("Note: " + msg.getMessage() +
" type: " + msg.getMessageType() +
" on: " + msg.getFaulty());
}
Problem
In the sample rule, you can find rule 1 and rule 3 are same. But I didn t
get the warning for redundancy.
Research done
When i debug the code, i found like the rule "Find redundant pattern
possibilities from rule possibilities" and "Find redundant restrictions from
pattern possibilities" are loaded into the Knowledge base created and tagged
with Agenda group as Main, but those are not present in the Knowledge
session created (I mean after inserting the objects into the Knowledge
session in the code : VerifierImpl.java).
Also can anybody explain when a rule will be present in the knowledge base
but not selected by the agenda. I haven t modified anything in the
AgendaFilter and its given the default value ScopeAgendaFilter.
Kindly let me know why the redundancy warning is not given in my case ?
P.S : I have gone through the post below,
http://http://drools.46999.n3.nabble.com/Drools-verifier-td2681002.html
http://drools.46999.n3.nabble.com/Drools-verifier-td2681002.html
and at the bottom they have asked the same question, but there is no answer
available for it.
Thanks,
Prasanna.
--
View this message in context:
http://drools.46999.n3.nabble.com/Redundancy-check-option-not-working-in-Drools-Verifier-5-4-tp3938055p3938055.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users