def test_select(self): engine = ComputePlacementEngine() engine.debug_mode() engine.insert('p(x) :- q(x)') engine.insert('q(1)') ans = engine.select('p(x)') self.assertTrue(helper.datalog_equal(ans, 'p(1)'))
def test_theory_in_head(self): engine = ComputePlacementEngine() engine.debug_mode() engine.policy.insert(engine.parse1('p(x) :- nova:q(x)')) engine.policy.insert(engine.parse1('nova:q(1)')) ans = engine.policy.select(engine.parse1('p(x)')) ans = " ".join(str(x) for x in ans) self.assertTrue(helper.datalog_equal(ans, 'p(1)'))
def test_parse(self): engine = ComputePlacementEngine() engine.debug_mode() f = engine.parse1('nova:q(1)') self.assertTrue(f.table, 'nova:q') self.assertIsNone(f.theory) f = engine.parse1('p(x) :- q(x)') self.assertEqual(f.head.table, 'p') self.assertEqual(f.body[0].table, 'q')