Example #1
0
  @Test
  public void atomErasingFilterTest() {
    LinkedList<Rule> rules = new LinkedList<Rule>();
    rules.add(RuleFactory.instance().create(TestUtils.sX, TestUtils.rX));
    rules.add(RuleFactory.instance().create(TestUtils.rX, TestUtils.sX));
    rules.add(RuleFactory.instance().create(TestUtils.rX, TestUtils.pXY));

    GraphOfRuleDependencies grd = new GraphOfRuleDependencies(rules, true, new AtomErasingFilter());
    Assert.assertFalse(grd.existUnifier(rules.get(0), rules.get(1)));
    Assert.assertFalse(grd.existUnifier(rules.get(1), rules.get(0)));
    Assert.assertTrue(grd.existUnifier(rules.get(0), rules.get(2)));
  }
 @Override
 public void endsConjunction(OBJECT_TYPE objectType) {
   switch (objectType) {
     case QUERY:
       this.createQuery(
           ConjunctiveQueryFactory.instance().create(this.label, this.atomSet, this.answerVars));
       break;
     case NEG_CONSTRAINT:
       this.createNegConstraint(new DefaultNegativeConstraint(this.label, this.atomSet));
       break;
     case RULE:
       if (this.atomSet2 == null) {
         this.atomSet2 = this.atomSet;
         this.atomSet = new LinkedListAtomSet();
       } else {
         this.createRule(RuleFactory.instance().create(this.label, this.atomSet, this.atomSet2));
       }
       break;
     case FACT:
       this.createAtomSet(this.atomSet);
       break;
     default:
       break;
   }
 }