org.drools.verifier.subsumption.SubRules.drl Maven / Gradle / Ivy
/*
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//created on: 1.12.2009
package org.drools.verifier.subsumption.patterns
import org.drools.verifier.components.Restriction;
import org.drools.verifier.components.Pattern;
import org.drools.verifier.components.PatternComponent;
import org.drools.verifier.components.SubPattern;
import org.drools.verifier.components.SubRule;
import org.drools.verifier.components.Consequence;
import org.drools.verifier.report.components.Redundancy;
import org.drools.verifier.report.components.Subsumption;
import org.drools.verifier.data.VerifierReport;
import java.util.ArrayList
global VerifierReport result;
//
//
rule "Find subsumptant sub rules"
when
$subRule1 :SubRule()
$subRule2 :SubRule(
path != $subRule1.path,
attributes["ruleflow-group"] == $subRule1.attributes["ruleflow-group"],
attributes["agenda-group"] == $subRule1.attributes["agenda-group"],
attributes["xor-group"] == $subRule1.attributes["xor-group"]
)
// For every restriction in $subRule1 there is a subsumption to a restriction in $subRule2.
forall (
$subPattern :SubPattern(
) from $subRule1.items
Subsumption(
left == $subPattern,
right memberOf $subRule2.items
)
)
$causes : ArrayList()
from collect(
Subsumption(
left memberOf $subRule1.items,
right memberOf $subRule2.items
)
)
then
insert(
new Subsumption(
$subRule1,
$subRule2,
$causes
)
);
end
© 2015 - 2025 Weber Informatics LLC | Privacy Policy