Exemplo n.º 1
0
 def setUp(self):
     self.KB = KnowledgeBase()
     self.axioms = [
         ClassAssertion(And(Concept("Man"), Concept("Human")),
                        Instance("Aditya")),
         ClassAssertion(Some("owns", Concept("Conputer")),
                        Instance("Aditya"))
     ]
Exemplo n.º 2
0
            Instance("Aditya"))),
    ABoxAxiom(
        ClassAssertion(And(Concept("Man"), Concept("Machine")),
                       Instance("Arnold")))
]

inconsistent_complex_abox = [
    ABoxAxiom(
        ClassAssertion(
            Or(And(Concept("Man"), Not(Concept("Machine"))),
               And(Concept("Machine"), Not(Concept("Man")))),
            Instance("Aditya"))),
    ABoxAxiom(
        ClassAssertion(And(Concept("Man"), Not(Concept("Man"))),
                       Instance("Arnold")))
]

consistent_abox = [
    ABoxAxiom(ClassAssertion(Concept("Man"), Instance("Aditya"))),
    ABoxAxiom(
        ClassAssertion(And(Concept("Machine"), Not(Concept("Man"))),
                       Instance("HAL"))),
    ABoxAxiom(
        ClassAssertion(Some("hasComputer", Concept("Laptop")),
                       Instance("Aditya"))),
    ABoxAxiom(
        ClassAssertion(All("hasComputer", Not(Concept("Man"))),
                       Instance("Aditya"))),
    TBoxAxiom(Subsumption(Concept("Man"), Concept("Biological")))
]
Exemplo n.º 3
0
 def test_some_equality(self):
     self.assertEqual(Some("hasParent", Concept("Man")),
                      Some("hasParent", Concept("Woman")))
Exemplo n.º 4
0
 def test_simple_some(self):
     axiom=Some("hasParent",And(Concept("Man"),Concept("Human")))
     models=get_models({},axiom,"Aditya")
     self.assertTrue(is_model_consistent(models))
Exemplo n.º 5
0
 def test_some_role_constructor(self):
     some_role = Some("hasParent", Concept("Man"))
     self.assertEqual(some_role.name, "hasParent")
     self.assertEqual(some_role.concept.name, "Man")
Exemplo n.º 6
0
 def setUp(self):
     _axiom=Some("hasParent",And(Concept("Man"),Concept("Human")))
     self.pre_graph=get_models({},_axiom,"Aditya")[0]
Exemplo n.º 7
0
 def test_nnf_complex_statement(self):
     axiom1 = Not(And(Some("A", Concept("B")), Not(Concept("C"))))
     axiom2 = Or(All("A", Not(Concept("B"))), Concept("C"))
     self.assertEqual(axiom2, NNF(axiom1))
Exemplo n.º 8
0
 def test_nnf_not_all(self):
     axiom1 = Not(All("A", Concept("B")))
     axiom2 = Some("A", Not(Concept("B")))
     self.assertEqual(NNF(axiom1), axiom2)
Exemplo n.º 9
0
 def test_nnf_some(self):
     axiom1 = Some("A", Concept("B"))
     self.assertEqual(axiom1, NNF(axiom1))
Exemplo n.º 10
0
 def test_and_constructor(self):
     axiom = And(Concept("Man"), Some("hasChild", Concept("Human")))
     self.assertIsInstance(axiom, And)