Search in sources :

Example 1 with ViewItem

use of org.drools.model.view.ViewItem in project drools by kiegroup.

the class ViewFlowBuilder method viewItems2Condition.

private static CompositePatterns viewItems2Condition(BuildContext ctx, Condition.Type type, boolean topLevel) {
    List<Condition> conditions = new ArrayList<>();
    Map<Variable<?>, Condition> conditionMap = new HashMap<>();
    Map<String, Consequence> consequences = topLevel ? new LinkedHashMap<>() : null;
    Iterator<RuleItem> ruleItemIterator = ctx.ruleItems.iterator();
    while (ruleItemIterator.hasNext()) {
        Map<Variable<?>, InputViewItemImpl<?>> scopedInputs = type.createsScope() ? new LinkedHashMap<>(ctx.inputs) : ctx.inputs;
        RuleItem ruleItem = ruleItemIterator.next();
        if (ruleItem instanceof FixedValueItem) {
            conditions.add(new EvalImpl(((FixedValueItem) ruleItem).isValue()));
            continue;
        }
        if (ruleItem instanceof Consequence) {
            if (!topLevel) {
                throw new IllegalStateException("A consequence can be only a top level item");
            }
            Consequence consequence = (Consequence) ruleItem;
            String name = ruleItemIterator.hasNext() ? generateName("consequence") : RuleImpl.DEFAULT_CONSEQUENCE_NAME;
            consequences.put(name, consequence);
            conditions.add(new NamedConsequenceImpl(name, consequence.isBreaking()));
            continue;
        }
        if (ruleItem instanceof ConditionalConsequence) {
            if (!topLevel) {
                throw new IllegalStateException("A consequence can be only a top level item");
            }
            conditions.add(createConditionalNamedConsequence(consequences, (ConditionalConsequence) ruleItem));
            continue;
        }
        ViewItem viewItem = (ViewItem) ruleItem;
        if (viewItem instanceof CombinedExprViewItem) {
            CombinedExprViewItem combined = (CombinedExprViewItem) viewItem;
            conditions.add(viewItems2Condition(new BuildContext(ctx, combined.getExpressions(), scopedInputs), combined.getType(), false));
            continue;
        }
        if (viewItem instanceof QueryCallViewItem) {
            QueryCallViewItem query = ((QueryCallViewItem) viewItem);
            for (Argument arg : query.getArguments()) {
                if (arg instanceof Variable) {
                    ctx.usedVars.add(((Variable) arg));
                }
            }
            conditions.add(new QueryCallPattern(query));
            continue;
        }
        if (viewItem instanceof Binding) {
            Binding bindViewItem = (Binding) viewItem;
            PatternImpl pattern = (PatternImpl) conditionMap.get(bindViewItem.getInputVariable());
            if (pattern == null) {
                // This should probably be the bindViewItem.getBoundVariable() instead of the input
                // as the input variables can be many
                pattern = new PatternImpl(bindViewItem.getInputVariable());
                pattern.addWatchedProps(bindViewItem.getWatchedProps());
                ctx.usedVars.add(bindViewItem.getInputVariable());
                conditions.add(pattern);
                conditionMap.put(bindViewItem.getInputVariable(), pattern);
            }
            pattern.addBinding(bindViewItem);
            ctx.usedVars.add(viewItem.getFirstVariable());
            ctx.addBinding(bindViewItem);
            scopedInputs.putIfAbsent(viewItem.getFirstVariable(), (InputViewItemImpl) input(viewItem.getFirstVariable()));
            continue;
        }
        Variable<?> patterVariable = findPatterVariable(viewItem, scopedInputs.keySet());
        if (viewItem instanceof InputViewItemImpl) {
            scopedInputs.put(patterVariable, (InputViewItemImpl) viewItem);
            PatternImpl condition = new PatternImpl(patterVariable);
            condition.addWatchedProps(((InputViewItemImpl) viewItem).getWatchedProps());
            conditions.add(condition);
            conditionMap.put(patterVariable, condition);
            ctx.usedVars.add(patterVariable);
            continue;
        }
        if (viewItem instanceof ExistentialExprViewItem) {
            ExistentialExprViewItem existential = ((ExistentialExprViewItem) viewItem);
            if (patterVariable != null && !existential.isQueryExpression()) {
                registerInputsFromViewItem(existential.getExpression(), conditionMap, scopedInputs, patterVariable);
            }
            Condition condition = new PatternImpl(patterVariable, SingleConstraint.TRUE, ctx.bindings.get(patterVariable));
            conditions.add(new ExistentialPatternImpl(viewItem2Condition(existential.getExpression(), condition, new BuildContext(ctx, new LinkedHashMap<>())), existential.getType()));
            continue;
        }
        if (ruleItem instanceof ExprViewItem && ctx.boundVars.contains(patterVariable)) {
            conditions.add(new EvalImpl(createConstraint((ExprViewItem) ruleItem)));
            continue;
        }
        ctx.usedVars.add(patterVariable);
        Condition condition;
        if (type == Type.AND) {
            condition = conditionMap.get(patterVariable);
            if (condition == null) {
                condition = new PatternImpl(patterVariable, SingleConstraint.TRUE, ctx.bindings.get(patterVariable));
                conditions.add(condition);
                if (!(viewItem instanceof AccumulateExprViewItem)) {
                    conditionMap.put(patterVariable, condition);
                }
                scopedInputs.putIfAbsent(patterVariable, (InputViewItemImpl) input(patterVariable));
            }
        } else {
            condition = new PatternImpl(patterVariable);
            conditions.add(condition);
        }
        addInputFromVariableSource(scopedInputs, patterVariable);
        registerInputsFromViewItem(viewItem, conditionMap, scopedInputs, null);
        Condition modifiedPattern = viewItem2Condition(viewItem, condition, new BuildContext(ctx, scopedInputs));
        conditions.set(conditions.indexOf(condition), modifiedPattern);
        if (type == Type.AND && !(viewItem instanceof AccumulateExprViewItem)) {
            conditionMap.put(patterVariable, modifiedPattern);
        }
    }
    return new CompositePatterns(type, conditions, ctx.usedVars, consequences);
}
Also used : AccumulateExprViewItem(org.drools.model.view.AccumulateExprViewItem) ExistentialExprViewItem(org.drools.model.view.ExistentialExprViewItem) CombinedExprViewItem(org.drools.model.view.CombinedExprViewItem) TemporalExprViewItem(org.drools.model.view.TemporalExprViewItem) AbstractExprViewItem(org.drools.model.view.AbstractExprViewItem) ExprViewItem(org.drools.model.view.ExprViewItem) Variable(org.drools.model.Variable) InputViewItemImpl(org.drools.model.view.InputViewItemImpl) Argument(org.drools.model.Argument) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) CombinedExprViewItem(org.drools.model.view.CombinedExprViewItem) ExistentialPatternImpl(org.drools.model.patterns.ExistentialPatternImpl) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) CompositePatterns(org.drools.model.patterns.CompositePatterns) NamedConsequenceImpl(org.drools.model.consequences.NamedConsequenceImpl) ConditionalNamedConsequenceImpl(org.drools.model.consequences.ConditionalNamedConsequenceImpl) PatternImpl(org.drools.model.patterns.PatternImpl) ExistentialPatternImpl(org.drools.model.patterns.ExistentialPatternImpl) AccumulatePatternImpl(org.drools.model.patterns.AccumulatePatternImpl) EvalImpl(org.drools.model.patterns.EvalImpl) QueryCallViewItem(org.drools.model.view.QueryCallViewItem) QueryCallPattern(org.drools.model.patterns.QueryCallPattern) RuleItem(org.drools.model.RuleItem) ExistentialExprViewItem(org.drools.model.view.ExistentialExprViewItem) Condition(org.drools.model.Condition) Binding(org.drools.model.Binding) ConditionalConsequence(org.drools.model.ConditionalConsequence) ExprNViewItem(org.drools.model.view.ExprNViewItem) AccumulateExprViewItem(org.drools.model.view.AccumulateExprViewItem) ExistentialExprViewItem(org.drools.model.view.ExistentialExprViewItem) InputViewItem(org.drools.model.view.InputViewItem) QueryCallViewItem(org.drools.model.view.QueryCallViewItem) ViewItem(org.drools.model.view.ViewItem) CombinedExprViewItem(org.drools.model.view.CombinedExprViewItem) TemporalExprViewItem(org.drools.model.view.TemporalExprViewItem) AbstractExprViewItem(org.drools.model.view.AbstractExprViewItem) ExprViewItem(org.drools.model.view.ExprViewItem) Consequence(org.drools.model.Consequence) ConditionalConsequence(org.drools.model.ConditionalConsequence) FixedValueItem(org.drools.model.view.FixedValueItem) AccumulateExprViewItem(org.drools.model.view.AccumulateExprViewItem)

Example 2 with ViewItem

use of org.drools.model.view.ViewItem in project drools by kiegroup.

the class PatternDSLTest method testTwoAccumulatesWithVarBindingModel.

@Test
public void testTwoAccumulatesWithVarBindingModel() {
    Variable<Person> a = PatternDSL.declarationOf(Person.class);
    Variable<Pair> accSource = PatternDSL.declarationOf(Pair.class);
    Variable<Collection> accResult = PatternDSL.declarationOf(Collection.class);
    Variable<Collection> accResult2 = PatternDSL.declarationOf(Collection.class);
    Variable<Pair> wrapped = PatternDSL.declarationOf(Pair.class, PatternDSL.from(accResult));
    Variable<Object> unwrapped1 = PatternDSL.declarationOf(Object.class);
    PatternDSL.PatternDef aPattern = PatternDSL.pattern(a).bind(accSource, v -> Pair.create(v.getName(), v.getAge()));
    ViewItem accumulate = PatternDSL.accumulate(aPattern, DSL.accFunction(CollectSetAccumulateFunction::new, accSource).as(accResult));
    PatternDSL.PatternDef secondPattern = PatternDSL.pattern(accResult);
    PatternDSL.PatternDef thirdPattern = // If binding removed, test will pass.
    PatternDSL.pattern(wrapped).bind(unwrapped1, Pair::getKey);
    ViewItem accumulate2 = PatternDSL.accumulate(PatternDSL.and(secondPattern, thirdPattern), DSL.accFunction(CollectSetAccumulateFunction::new, wrapped).as(accResult2));
    Rule rule = PatternDSL.rule("R").build(accumulate, accumulate2, PatternDSL.on(accResult2).execute(obj -> {
        boolean works = obj.contains(Pair.create("Lukas", 35));
        if (!works) {
            throw new IllegalStateException("Why is " + obj + " not Set<" + Pair.class + ">?");
        }
    }));
    Model model = new ModelImpl().addRule(rule);
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession session = kieBase.newKieSession();
    session.insert(new Person("Lukas", 35));
    session.fireAllRules();
}
Also used : Arrays(java.util.Arrays) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) Man(org.drools.modelcompiler.domain.Man) Global(org.drools.model.Global) Toy(org.drools.modelcompiler.domain.Toy) PatternDSL.reactOn(org.drools.model.PatternDSL.reactOn) DSL(org.drools.model.DSL) Relationship(org.drools.modelcompiler.domain.Relationship) BaseModelTest.getObjectsIntoList(org.drools.modelcompiler.BaseModelTest.getObjectsIntoList) Query2Def(org.drools.model.Query2Def) PatternDSL.declarationOf(org.drools.model.PatternDSL.declarationOf) Child(org.drools.modelcompiler.domain.Child) ClassObjectFilter(org.kie.api.runtime.ClassObjectFilter) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) QueryResults(org.kie.api.runtime.rule.QueryResults) Assertions(org.assertj.core.api.Assertions) KieSession(org.kie.api.runtime.KieSession) QueryImpl(org.drools.core.rule.QueryImpl) LambdaConstraint(org.drools.modelcompiler.constraints.LambdaConstraint) PatternDSL.rule(org.drools.model.PatternDSL.rule) EventProcessingOption(org.kie.api.conf.EventProcessingOption) Collection(java.util.Collection) Activation(org.drools.core.spi.Activation) Index(org.drools.model.Index) Predicate1(org.drools.model.functions.Predicate1) PatternDSL.on(org.drools.model.PatternDSL.on) PatternDSL.pattern(org.drools.model.PatternDSL.pattern) List(java.util.List) Query(org.drools.model.Query) PatternDSL.or(org.drools.model.PatternDSL.or) RuleImpl(org.drools.core.definitions.rule.impl.RuleImpl) PatternDSL.globalOf(org.drools.model.PatternDSL.globalOf) Person(org.drools.modelcompiler.domain.Person) PatternDSL.valueOf(org.drools.model.PatternDSL.valueOf) ModelImpl(org.drools.model.impl.ModelImpl) ClassObjectType(org.drools.core.base.ClassObjectType) PatternDSL.execute(org.drools.model.PatternDSL.execute) StockTick(org.drools.modelcompiler.domain.StockTick) Pattern(org.drools.core.rule.Pattern) PatternDSL(org.drools.model.PatternDSL) PatternDSL.after(org.drools.model.PatternDSL.after) ClockType(org.drools.core.ClockType) ArrayList(java.util.ArrayList) Result(org.drools.modelcompiler.domain.Result) KieSessionConfiguration(org.kie.api.runtime.KieSessionConfiguration) Assert.assertSame(org.junit.Assert.assertSame) Adult(org.drools.modelcompiler.domain.Adult) PatternDSL.alphaIndexedBy(org.drools.model.PatternDSL.alphaIndexedBy) PatternDSL.query(org.drools.model.PatternDSL.query) PatternDSL.reactiveFrom(org.drools.model.PatternDSL.reactiveFrom) KieServices(org.kie.api.KieServices) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Woman(org.drools.modelcompiler.domain.Woman) KieBase(org.kie.api.KieBase) Model(org.drools.model.Model) PatternDSL.and(org.drools.model.PatternDSL.and) ViewItem(org.drools.model.view.ViewItem) Pair(org.apache.commons.math3.util.Pair) Variable(org.drools.model.Variable) D(org.drools.modelcompiler.dsl.pattern.D) IOException(java.io.IOException) Test(org.junit.Test) PatternDSL.accumulate(org.drools.model.PatternDSL.accumulate) PatternDSL.not(org.drools.model.PatternDSL.not) PatternDSL.when(org.drools.model.PatternDSL.when) SessionPseudoClock(org.kie.api.time.SessionPseudoClock) FactHandle(org.kie.api.runtime.rule.FactHandle) PatternDSL.accFunction(org.drools.model.PatternDSL.accFunction) TimeUnit(java.util.concurrent.TimeUnit) KieBaseBuilder(org.drools.modelcompiler.builder.KieBaseBuilder) ClockTypeOption(org.kie.api.runtime.conf.ClockTypeOption) Assert.assertNull(org.junit.Assert.assertNull) Rule(org.drools.model.Rule) CollectSetAccumulateFunction(org.drools.core.base.accumulators.CollectSetAccumulateFunction) PatternDSL.betaIndexedBy(org.drools.model.PatternDSL.betaIndexedBy) Accumulate(org.drools.core.rule.Accumulate) DSL.supply(org.drools.model.DSL.supply) Assert.assertEquals(org.junit.Assert.assertEquals) PatternDSL(org.drools.model.PatternDSL) ViewItem(org.drools.model.view.ViewItem) CollectSetAccumulateFunction(org.drools.core.base.accumulators.CollectSetAccumulateFunction) KieBase(org.kie.api.KieBase) Model(org.drools.model.Model) Collection(java.util.Collection) KieSession(org.kie.api.runtime.KieSession) Rule(org.drools.model.Rule) ModelImpl(org.drools.model.impl.ModelImpl) Person(org.drools.modelcompiler.domain.Person) Pair(org.apache.commons.math3.util.Pair) Test(org.junit.Test)

Example 3 with ViewItem

use of org.drools.model.view.ViewItem in project drools by kiegroup.

the class GroupByTest method testWithGroupByAfterExists.

@Test
public void testWithGroupByAfterExists() {
    Global<Map> groupResultVar = D.globalOf(Map.class, "defaultPkg", "glob");
    Variable<Integer> patternVar = D.declarationOf(Integer.class);
    Variable<String> existsVar = D.declarationOf(String.class);
    Variable<Integer> keyVar = D.declarationOf(Integer.class);
    Variable<Long> resultVar = D.declarationOf(Long.class);
    D.PatternDef<Integer> pattern = D.pattern(patternVar);
    D.PatternDef<String> exist = D.pattern(existsVar);
    ViewItem patternAndExists = D.and(pattern, D.exists(exist));
    ViewItem groupBy = D.groupBy(patternAndExists, patternVar, keyVar, Math::abs, DSL.accFunction(CountAccumulateFunction::new).as(resultVar));
    ConsequenceBuilder._3 consequence = D.on(keyVar, resultVar, groupResultVar).execute((key, count, result) -> {
        result.put(key, count.intValue());
    });
    Rule rule = D.rule("R").build(groupBy, consequence);
    Model model = new ModelImpl().addRule(rule).addGlobal(groupResultVar);
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession session = kieBase.newKieSession();
    Map<Integer, Integer> global = new HashMap<>();
    session.setGlobal("glob", global);
    session.insert("Something");
    session.insert(-1);
    session.insert(1);
    session.insert(2);
    session.fireAllRules();
    assertEquals(2, global.size());
    // -1 and 1 will map to the same key, and count twice.
    assertEquals(2, (int) global.get(1));
    // 2 maps to a key, and counts once.
    assertEquals(1, (int) global.get(2));
}
Also used : D(org.drools.modelcompiler.dsl.pattern.D) ViewItem(org.drools.model.view.ViewItem) ExprViewItem(org.drools.model.view.ExprViewItem) HashMap(java.util.HashMap) CountAccumulateFunction(org.drools.core.base.accumulators.CountAccumulateFunction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ConsequenceBuilder(org.drools.model.consequences.ConsequenceBuilder) KieBase(org.kie.api.KieBase) Model(org.drools.model.Model) KieSession(org.kie.api.runtime.KieSession) Rule(org.drools.model.Rule) ModelImpl(org.drools.model.impl.ModelImpl) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 4 with ViewItem

use of org.drools.model.view.ViewItem in project drools by kiegroup.

the class GroupByTest method testWithGroupByAfterExistsWithFrom.

@Test
public void testWithGroupByAfterExistsWithFrom() {
    Global<Map> groupResultVar = D.globalOf(Map.class, "defaultPkg", "glob");
    Variable<Integer> patternVar = D.declarationOf(Integer.class);
    Variable<String> existsVar = D.declarationOf(String.class);
    Variable<Integer> keyVar = D.declarationOf(Integer.class);
    Variable<Long> resultVar = D.declarationOf(Long.class);
    Variable<Integer> mappedResultVar = D.declarationOf(Integer.class);
    D.PatternDef<Integer> pattern = D.pattern(patternVar);
    D.PatternDef<String> exist = D.pattern(existsVar);
    ViewItem patternAndExists = D.and(pattern, D.exists(exist));
    ViewItem groupBy = D.groupBy(patternAndExists, patternVar, keyVar, Math::abs, DSL.accFunction(CountAccumulateFunction::new).as(resultVar));
    PatternDSL.PatternDef mappedResult = D.pattern(resultVar).bind(mappedResultVar, Long::intValue);
    ConsequenceBuilder._3 consequence = D.on(keyVar, mappedResultVar, groupResultVar).execute((key, count, result) -> {
        result.put(key, count);
    });
    Rule rule = D.rule("R").build(groupBy, mappedResult, consequence);
    Model model = new ModelImpl().addRule(rule).addGlobal(groupResultVar);
    KieBase kieBase = KieBaseBuilder.createKieBaseFromModel(model);
    KieSession session = kieBase.newKieSession();
    Map<Integer, Integer> global = new HashMap<>();
    session.setGlobal("glob", global);
    session.insert("Something");
    session.insert(-1);
    session.insert(1);
    session.insert(2);
    session.fireAllRules();
    assertEquals(2, global.size());
    // -1 and 1 will map to the same key, and count twice.
    assertEquals(2, (int) global.get(1));
    // 2 maps to a key, and counts once.
    assertEquals(1, (int) global.get(2));
}
Also used : D(org.drools.modelcompiler.dsl.pattern.D) HashMap(java.util.HashMap) CountAccumulateFunction(org.drools.core.base.accumulators.CountAccumulateFunction) ConsequenceBuilder(org.drools.model.consequences.ConsequenceBuilder) KieBase(org.kie.api.KieBase) KieSession(org.kie.api.runtime.KieSession) ModelImpl(org.drools.model.impl.ModelImpl) PatternDSL(org.drools.model.PatternDSL) ViewItem(org.drools.model.view.ViewItem) ExprViewItem(org.drools.model.view.ExprViewItem) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Model(org.drools.model.Model) Rule(org.drools.model.Rule) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 5 with ViewItem

use of org.drools.model.view.ViewItem in project drools by kiegroup.

the class ViewPatternBuilder method ruleItem2Condition.

public static Condition ruleItem2Condition(RuleItem ruleItem) {
    if (ruleItem instanceof PatternDefImpl) {
        PatternDefImpl<?> patternDef = (PatternDefImpl) ruleItem;
        Variable<?> patternVariable = patternDef.getFirstVariable();
        PatternImpl pattern = new PatternImpl(patternVariable, patternVariable instanceof Exchange ? Condition.Type.RECEIVER : Condition.Type.PATTERN);
        for (PatternItem patternItem : patternDef.getItems()) {
            if (patternItem instanceof PatternExprImpl) {
                pattern.addConstraint(((PatternExprImpl) patternItem).asConstraint(patternDef));
            } else if (patternItem instanceof PatternBindingImpl) {
                pattern.addBinding(((PatternBindingImpl) patternItem).asBinding(patternDef));
            } else {
                throw new UnsupportedOperationException("Unknown pattern item type: " + patternItem);
            }
        }
        pattern.addWatchedProps(patternDef.getWatch());
        pattern.setPassive(patternDef.isPassive());
        return pattern;
    }
    if (ruleItem instanceof FixedValueItem) {
        return new EvalImpl(((FixedValueItem) ruleItem).isValue());
    }
    if (ruleItem instanceof QueryCallViewItem) {
        return new QueryCallPattern((QueryCallViewItem) ruleItem);
    }
    if (ruleItem instanceof CombinedExprViewItem) {
        CombinedExprViewItem combined = (CombinedExprViewItem) ruleItem;
        List<Condition> conditions = new ArrayList<>();
        for (ViewItem expr : combined.getExpressions()) {
            conditions.add(ruleItem2Condition(expr));
        }
        return new CompositePatterns(combined.getType(), conditions);
    }
    if (ruleItem instanceof ExistentialExprViewItem) {
        ExistentialExprViewItem existential = (ExistentialExprViewItem) ruleItem;
        return new ExistentialPatternImpl(ruleItem2Condition(existential.getExpression()), existential.getType());
    }
    if (ruleItem instanceof GroupByExprViewItem) {
        GroupByExprViewItem groupBy = (GroupByExprViewItem) ruleItem;
        return new GroupByPatternImpl(ruleItem2Condition(groupBy.getExpr()), groupBy.getVars(), groupBy.getVarKey(), groupBy.getGroupingFunction(), groupBy.getAccumulateFunctions());
    }
    if (ruleItem instanceof AccumulateExprViewItem) {
        AccumulateExprViewItem acc = (AccumulateExprViewItem) ruleItem;
        return new AccumulatePatternImpl(ruleItem2Condition(acc.getExpr()), null, acc.getAccumulateFunctions());
    }
    if (ruleItem instanceof ExprViewItem) {
        return new EvalImpl(createConstraint((ExprViewItem) ruleItem));
    }
    if (ruleItem instanceof ExchangeDefImpl) {
        ExchangeDefImpl<?> exchangeDef = (ExchangeDefImpl) ruleItem;
        return new PatternImpl(exchangeDef.getFirstVariable(), Condition.Type.SENDER);
    }
    throw new UnsupportedOperationException("Unknown " + ruleItem);
}
Also used : AccumulatePatternImpl(org.drools.model.patterns.AccumulatePatternImpl) GroupByExprViewItem(org.drools.model.view.GroupByExprViewItem) AccumulateExprViewItem(org.drools.model.view.AccumulateExprViewItem) ExistentialExprViewItem(org.drools.model.view.ExistentialExprViewItem) CombinedExprViewItem(org.drools.model.view.CombinedExprViewItem) ExprViewItem(org.drools.model.view.ExprViewItem) CombinedExprViewItem(org.drools.model.view.CombinedExprViewItem) ExistentialPatternImpl(org.drools.model.patterns.ExistentialPatternImpl) ExchangeDefImpl(org.drools.model.PatternDSL.ExchangeDefImpl) PatternItem(org.drools.model.PatternDSL.PatternItem) ArrayList(java.util.ArrayList) CompositePatterns(org.drools.model.patterns.CompositePatterns) GroupByExprViewItem(org.drools.model.view.GroupByExprViewItem) GroupByPatternImpl(org.drools.model.patterns.GroupByPatternImpl) PatternImpl(org.drools.model.patterns.PatternImpl) ExistentialPatternImpl(org.drools.model.patterns.ExistentialPatternImpl) AccumulatePatternImpl(org.drools.model.patterns.AccumulatePatternImpl) EvalImpl(org.drools.model.patterns.EvalImpl) QueryCallViewItem(org.drools.model.view.QueryCallViewItem) QueryCallPattern(org.drools.model.patterns.QueryCallPattern) GroupByPatternImpl(org.drools.model.patterns.GroupByPatternImpl) ExistentialExprViewItem(org.drools.model.view.ExistentialExprViewItem) Condition(org.drools.model.Condition) GroupByExprViewItem(org.drools.model.view.GroupByExprViewItem) AccumulateExprViewItem(org.drools.model.view.AccumulateExprViewItem) ExistentialExprViewItem(org.drools.model.view.ExistentialExprViewItem) QueryCallViewItem(org.drools.model.view.QueryCallViewItem) ViewItem(org.drools.model.view.ViewItem) CombinedExprViewItem(org.drools.model.view.CombinedExprViewItem) ExprViewItem(org.drools.model.view.ExprViewItem) FixedValueItem(org.drools.model.view.FixedValueItem) PatternExprImpl(org.drools.model.PatternDSL.PatternExprImpl) AccumulateExprViewItem(org.drools.model.view.AccumulateExprViewItem) PatternBindingImpl(org.drools.model.PatternDSL.PatternBindingImpl) PatternDefImpl(org.drools.model.PatternDSL.PatternDefImpl)

Aggregations

ViewItem (org.drools.model.view.ViewItem)5 ExprViewItem (org.drools.model.view.ExprViewItem)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)3 Model (org.drools.model.Model)3 Rule (org.drools.model.Rule)3 ModelImpl (org.drools.model.impl.ModelImpl)3 D (org.drools.modelcompiler.dsl.pattern.D)3 Test (org.junit.Test)3 KieBase (org.kie.api.KieBase)3 KieSession (org.kie.api.runtime.KieSession)3 Map (java.util.Map)2 CountAccumulateFunction (org.drools.core.base.accumulators.CountAccumulateFunction)2 Condition (org.drools.model.Condition)2 PatternDSL (org.drools.model.PatternDSL)2 Variable (org.drools.model.Variable)2 ConsequenceBuilder (org.drools.model.consequences.ConsequenceBuilder)2 IOException (java.io.IOException)1 Arrays (java.util.Arrays)1