con.commit();
// now we remove the rule2 (symmetric rule) from the program, update the program in the database and then
// inform the reasoning engine about the removed rule
Program p = rcon.loadProgram("simple");
Rule removed = null;
Iterator<Rule> it = p.getRules().iterator();
while(it.hasNext()) {
Rule r = it.next();
if(r.getName().equals("rule2")) {
it.remove();
removed = r;
}
}
Assert.assertNotNull("rule 2 not found in program", removed);
rcon.updateProgram(p);
rcon.commit();
engine.notifyRemoveRules();
// after removing, the inferred symmetric triple should be gone, but the others should still exist
con.begin();
Assert.assertTrue("expected inferred triple not found", con.hasStatement(a,t,c,true));
Assert.assertTrue("expected inferred triple not found", con.hasStatement(b, t, d, true));
Assert.assertFalse("unexpected inferred triple found", con.hasStatement(b, s, a, true));
con.commit();
// let's add the rule again to the program, update the database, and inform the engine
p.getRules().add(removed);
rcon.updateProgram(p);
rcon.commit();
engine.notifyAddRule(removed);