Package org.drools.analytics.components

Examples of org.drools.analytics.components.LiteralRestriction


    Field f = new Field();
    testData.add(f);

    // > 10 covered
    LiteralRestriction lower = new LiteralRestriction();
    lower.setRuleName("> 10 covered");
    lower.setFieldId(f.getId());
    lower.setEvaluator(">");
    lower.setValue("10");
    testData.add(lower);

    // == 50 covered
    LiteralRestriction r1 = new LiteralRestriction();
    r1.setRuleName("== 50 covered");
    r1.setFieldId(f.getId());
    r1.setEvaluator("==");
    r1.setValue("50");
    testData.add(r1);

    // > 50 gap
    Gap g1 = new Gap(f, ">", r1);
    g1.setFiredRuleName("above");
    testData.add(g1);

    // < 50 gap
    Gap g2 = new Gap(f, "<", r1);
    g2.setFiredRuleName("below");
    testData.add(g2);
   
    // > 70 covered
    LiteralRestriction r2 = new LiteralRestriction();
    r2.setRuleName("> 70 covered");
    r2.setFieldId(f.getId());
    r2.setEvaluator(">");
    r2.setValue("70");
    testData.add(r2);

    // <= 70 gap
    Gap g3 = new Gap(f, "<=", r2);
    g3.setFiredRuleName("70gap");
    testData.add(g3);
   
    // < 100 covered
    LiteralRestriction higher = new LiteralRestriction();
    higher.setRuleName("< 100 covered");
    higher.setFieldId(f.getId());
    higher.setEvaluator("<");
    higher.setValue("100");
    testData.add(higher);

    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
    session.setGlobal("data", data);
View Full Code Here


   
    Field f = new Field();
    testData.add(f);
   
    // > 10 covered
    LiteralRestriction lower = new LiteralRestriction();
    lower.setRuleName("> 10 covered");
    lower.setFieldId(f.getId());
    lower.setEvaluator(">");
    lower.setValue("10");
    testData.add(lower);
   
    // == 50 covered
    LiteralRestriction r1 = new LiteralRestriction();
    r1.setRuleName("== 50 covered");
    r1.setFieldId(f.getId());
    r1.setEvaluator("==");
    r1.setValue("50");
    testData.add(r1);
   
    // > 50 gap
    Gap g1 = new Gap(f, ">", r1);
    g1.setFiredRuleName("above");
    testData.add(g1);
   
    // < 50 gap
    Gap g2 = new Gap(f, "<", r1);
    g2.setFiredRuleName("below");
    testData.add(g2);
   
    // < 70 covered
    LiteralRestriction r2 = new LiteralRestriction();
    r2.setRuleName("< 70 covered");
    r2.setFieldId(f.getId());
    r2.setEvaluator("<");
    r2.setValue("70");
    testData.add(r2);
   
    // >= 70 gap
    Gap g3 = new Gap(f, ">=", r2);
    g3.setFiredRuleName("70gap");
    testData.add(g3);
   
    // < 100 covered
    LiteralRestriction higher = new LiteralRestriction();
    higher.setRuleName("< 100 covered");
    higher.setFieldId(f.getId());
    higher.setEvaluator("<");
    higher.setValue("100");
    testData.add(higher);
   
    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
    session.setGlobal("data", data);
   
View Full Code Here

   
    Field f = new Field();
    testData.add(f);
   
    // > 10.0 covered
    LiteralRestriction lower = new LiteralRestriction();
    lower.setRuleName("> 10.0 covered");
    lower.setFieldId(f.getId());
    lower.setEvaluator(">");
    lower.setValue("10.0");
    testData.add(lower);
   
    // == 50.0 covered
    LiteralRestriction r1 = new LiteralRestriction();
    r1.setRuleName("== 50.0 covered");
    r1.setFieldId(f.getId());
    r1.setEvaluator("==");
    r1.setValue("50.0");
    testData.add(r1);
   
    // > 50.0 gap
    Gap g1 = new Gap(f, ">", r1);
    g1.setFiredRuleName("above");
    testData.add(g1);
   
    // < 50.0 gap
    Gap g2 = new Gap(f, "<", r1);
    g2.setFiredRuleName("below");
    testData.add(g2);
   
    // > 70.0 covered
    LiteralRestriction r2 = new LiteralRestriction();
    r2.setRuleName("> 70.0 covered");
    r2.setFieldId(f.getId());
    r2.setEvaluator(">");
    r2.setValue("70.0");
    testData.add(r2);
   
    // <= 70.0 gap
    Gap g3 = new Gap(f, "<=", r2);
    g3.setFiredRuleName("70gap");
    testData.add(g3);
   
    // < 100.0 covered
    LiteralRestriction higher = new LiteralRestriction();
    higher.setRuleName("< 100.0 covered");
    higher.setFieldId(f.getId());
    higher.setEvaluator("<");
    higher.setValue("100.0");
    testData.add(higher);
   
    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
    session.setGlobal("data", data);
   
View Full Code Here

   
    Field f = new Field();
    testData.add(f);
   
    // > 10.0 covered
    LiteralRestriction lower = new LiteralRestriction();
    lower.setRuleName("> 10.0 covered");
    lower.setFieldId(f.getId());
    lower.setEvaluator(">");
    lower.setValue("10.0");
    testData.add(lower);
   
    // == 50.0 covered
    LiteralRestriction r1 = new LiteralRestriction();
    r1.setRuleName("== 50.0 covered");
    r1.setFieldId(f.getId());
    r1.setEvaluator("==");
    r1.setValue("50.0");
    testData.add(r1);
   
    // > 50.0 gap
    Gap g1 = new Gap(f, ">", r1);
    g1.setFiredRuleName("above");
    testData.add(g1);
   
    // < 50.0 gap
    Gap g2 = new Gap(f, "<", r1);
    g2.setFiredRuleName("below");
    testData.add(g2);
   
    // < 70.0 covered
    LiteralRestriction r2 = new LiteralRestriction();
    r2.setRuleName("< 70.0 covered");
    r2.setFieldId(f.getId());
    r2.setEvaluator("<");
    r2.setValue("70.0");
    testData.add(r2);
   
    // >= 70.0 gap
    Gap g3 = new Gap(f, ">=", r2);
    g3.setFiredRuleName("70gap");
    testData.add(g3);
   
    // < 100.0 covered
    LiteralRestriction higher = new LiteralRestriction();
    higher.setRuleName("< 100.0 covered");
    higher.setFieldId(f.getId());
    higher.setEvaluator("<");
    higher.setValue("100.0");
    testData.add(higher);
   
    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
    session.setGlobal("data", data);
   
View Full Code Here

   
    Field f = new Field();
    testData.add(f);
   
    // > "01-Oct-2007" covered
    LiteralRestriction lower = new LiteralRestriction();
    lower.setRuleName("> 01-Oct-2007 covered");
    lower.setFieldId(f.getId());
    lower.setEvaluator(">");
    lower.setValue("01-Oct-2007");
    testData.add(lower);
   
    // == "10-Oct-2007" covered
    LiteralRestriction r1 = new LiteralRestriction();
    r1.setRuleName("== 10-Oct-2007 covered");
    r1.setFieldId(f.getId());
    r1.setEvaluator("==");
    r1.setValue("10-Oct-2007");
    testData.add(r1);
   
    // > "10-Oct-2007" gap
    Gap g1 = new Gap(f, ">", r1);
    g1.setFiredRuleName("above");
    testData.add(g1);
   
    // < "10-Oct-2007" gap
    Gap g2 = new Gap(f, "<", r1);
    g2.setFiredRuleName("below");
    testData.add(g2);
   
    // > "15-Oct-2007" covered
    LiteralRestriction r2 = new LiteralRestriction();
    r2.setRuleName("> 15-Oct-2007 covered");
    r2.setFieldId(f.getId());
    r2.setEvaluator(">");
    r2.setValue("15-Oct-2007");
    testData.add(r2);
   
    // <= "15-Oct-2007" gap
    Gap g3 = new Gap(f, "<=", r2);
    g3.setFiredRuleName("15-Oct-2007gap");
    testData.add(g3);
   
    // < "20-Oct-2007" covered
    LiteralRestriction higher = new LiteralRestriction();
    higher.setRuleName("< 20-Oct-2007 covered");
    higher.setFieldId(f.getId());
    higher.setEvaluator("<");
    higher.setValue("20-Oct-2007");
    testData.add(higher);
   
    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
    session.setGlobal("data", data);
   
View Full Code Here

   
    Field f = new Field();
    testData.add(f);
   
    // > "01-Oct-2007" covered
    LiteralRestriction lower = new LiteralRestriction();
    lower.setRuleName("> 01-Oct-2007 covered");
    lower.setFieldId(f.getId());
    lower.setEvaluator(">");
    lower.setValue("01-Oct-2007");
    testData.add(lower);
   
    // == "10-Oct-2007" covered
    LiteralRestriction r1 = new LiteralRestriction();
    r1.setRuleName("== 10-Oct-2007 covered");
    r1.setFieldId(f.getId());
    r1.setEvaluator("==");
    r1.setValue("10-Oct-2007");
    testData.add(r1);
   
    // > "10-Oct-2007" gap
    Gap g1 = new Gap(f, ">", r1);
    g1.setFiredRuleName("above");
    testData.add(g1);
   
    // < "10-Oct-2007" gap
    Gap g2 = new Gap(f, "<", r1);
    g2.setFiredRuleName("below");
    testData.add(g2);
   
    // < "15-Oct-2007" covered
    LiteralRestriction r2 = new LiteralRestriction();
    r2.setRuleName("< 15-Oct-2007 covered");
    r2.setFieldId(f.getId());
    r2.setEvaluator("<");
    r2.setValue("15-Oct-2007");
    testData.add(r2);
   
    // >= "15-Oct-2007" gap
    Gap g3 = new Gap(f, ">=", r2);
    g3.setFiredRuleName("15-Oct-2007gap");
    testData.add(g3);
   
    // < "20-Oct-2007" covered
    LiteralRestriction higher = new LiteralRestriction();
    higher.setRuleName("< 20-Oct-2007 covered");
    higher.setFieldId(f.getId());
    higher.setEvaluator("<");
    higher.setValue("20-Oct-2007");
    testData.add(higher);
   
    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();
    session.setGlobal("data", data);
   
View Full Code Here

  private Collection<Object> createSubsumptantPatternData(String ruleName1,
      String ruleName2) {

    Collection<Object> data = new ArrayList<Object>();

    LiteralRestriction lr1 = new LiteralRestriction();
    lr1.setRuleName(ruleName1);
    LiteralRestriction lr2 = new LiteralRestriction();
    lr2.setRuleName(ruleName1);

    PatternPossibility pp1 = new PatternPossibility();
    pp1.setRuleName(ruleName1);
    pp1.add(lr1);
    pp1.add(lr2);

    LiteralRestriction lr3 = new LiteralRestriction();
    lr3.setRuleName(ruleName2);

    PatternPossibility pp2 = new PatternPossibility();
    pp2.setRuleName(ruleName2);
    pp2.add(lr3);
View Full Code Here

   * @param descr
   */
  private void flatten(LiteralRestrictionDescr descr) {
    AnalyticsData data = AnalyticsDataFactory.getAnalyticsData();

    LiteralRestriction restriction = new LiteralRestriction();

    restriction.setRuleId(currentRule.getId());
    restriction.setRuleName(currentRule.getRuleName());
    restriction.setRuleId(currentRule.getId());
    restriction.setPatternId(currentPattern.getId());
    restriction.setPatternIsNot(currentPattern.isPatternNot());
    restriction.setConstraintId(currentConstraint.getId());
    restriction.setFieldId(currentConstraint.getFieldId());
    restriction.setEvaluator(descr.getEvaluator());
    restriction.setValue(descr.getText());

    // Set field value, if it is unset.
    currentField.setFieldType(restriction.getValueType());

    data.save(restriction);
    solvers.addRestriction(restriction);
  }
View Full Code Here

    }

    for (Restriction r : restrictions) {
      if (r instanceof LiteralRestriction) {
        try {
          LiteralRestriction restriction = (LiteralRestriction) r;

          map.put(restriction.getValueAsObject(), restriction
              .getEvaluator()
              + " "
              + restriction.getValueAsString()
              + " "
              + UrlFactory.getRuleUrl(sourceFolder, restriction
                  .getRuleId(), restriction.getRuleName()));
        } catch (Exception e) {
          System.out.println(map);
          System.out.println(r);
        }
      }
View Full Code Here

   */
  public void testNotAnd() {
    AnalyticsRule rule = new AnalyticsRule();
    Pattern pattern = new Pattern();

    Restriction r = new LiteralRestriction();
    Restriction r2 = new LiteralRestriction();
    Restriction r3 = new LiteralRestriction();
    Restriction r4 = new LiteralRestriction();

    OperatorDescr andDescr = OperatorDescr.valueOf(OperatorDescr.Type.AND);
    Solvers solvers = new Solvers();

    solvers.startRuleSolver(rule);
View Full Code Here

TOP

Related Classes of org.drools.analytics.components.LiteralRestriction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.