All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.verifier.incompatibility.Patterns.drl Maven / Gradle / Ivy

There is a newer version: 9.44.0.Final
Show newest version
/*
 * 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: 2.6.2008
package org.drools.verifier.incompatibility

//list any import classes here.
import org.drools.verifier.components.Restriction;
import org.drools.verifier.components.SubPattern;

import org.drools.verifier.report.components.Incompatibility;

import org.drools.verifier.data.VerifierReport;

global VerifierReport result;

//
// Pattern possibilities are incompatible if any of the restrictions are incompatible.
//
// Dependencies:
//    Needs at least one of the following packages or rules to fire:
//         package org.drools.verifier.incompatibility;
//            rule "Incompatible LiteralRestrictions with ranges in pattern possibility, impossible equality less or equal"
//            rule "Incompatible LiteralRestrictions with ranges in pattern possibility, impossible equality greater"
//            rule "Incompatible LiteralRestrictions with ranges in pattern possibility, impossible range"
//            rule "Incoherent VariableRestrictions in pattern possibility, impossible range"
//
// Example:
//        Pattern( a < b )
//        Pattern( a > b )
//
rule "Incompatible Patterns"
    when
        $incompatibility :Incompatibility()

        $pp1 :SubPattern(
            items contains $incompatibility.left
        )

        $pp2 :SubPattern(
            items contains $incompatibility.right
        )

        # Check that these facts do not already exist
        not Incompatibility( left == $pp1, right == $pp2)
        not Incompatibility( left == $pp2, right == $pp1)
    then
        insert( new Incompatibility( $pp1, $pp2 ));
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy