示例#1
0
    def test_1(self):
        rules = [
            HornClause({'A', 'B'}, 'r'),
        ]

        test = ATMS(rules)
        test.processRules()

        self.assertEqual(test.nodes['r'].label, {frozenset({'A', 'B'})})
示例#2
0
    def test_5(self):
        rules = [
            HornClause({'D'}, 'l'),
            HornClause({'E'}, 'k'),
            HornClause({'D'}, 'k'),
            HornClause({'l', 'k'}, 'i')
        ]

        test = ATMS(rules)
        test.processRules()

        self.assertEqual(test.nodes['i'].label, {frozenset({'D'})})
示例#3
0
    def test_6(self):
        rules = [
            HornClause({'A'}, 'r'),
            HornClause({'B'}, 'r'),
            HornClause({'r'}, 'g'),
            HornClause({'D'}, 'l'),
            HornClause({'E'}, 'k'),
            HornClause({'D'}, 'k'),
            HornClause({'l'}, 'i'),
            HornClause({'g', 'i'}, 'h')
        ]

        test = ATMS(rules)
        test.processRules()

        self.assertEqual(test.nodes['h'].label,
                         {frozenset({'A', 'D'}),
                          frozenset({'B', 'D'})})
示例#4
0
    def test_9(self):
        rules = [
            HornClause({'B', 'b'}, 'e'),
            HornClause({'C', 'a'}, 'f'),
            HornClause({'a', 'e'}, NoGood),
            HornClause({'D'}, 'e'),
            HornClause({'A'}, 'a'),
            HornClause({'E'}, 'e'),
            HornClause({'C', 'e'}, 'g'),
            HornClause({'g', 'f'}, NoGood),
            HornClause({'E'}, 'b'),
        ]

        test = ATMS(rules)
        test.processRules()

        self.assertEqual(test.nodes['b'].label, {frozenset('E')})
        self.assertEqual(
            test.nodes[NoGood].label, {
                frozenset({'A', 'D'}),
                frozenset({'E', 'A'}),
                frozenset({'E', 'A', 'C'}),
                frozenset({'C', 'A', 'D'})
            })