Ejemplo n.º 1
0
 def setUp(self):
     self.KB = NodeSet()
     self.axioms = [
         And(Concept("Man"), All("hasChild", Concept("Human"))),
         And(Concept("Woman"), All("hasChild", Concept("Human"))),
         Concept("Human"),
         Not(Concept("Robot"))
     ]
     self.KB.add_axioms(self.axioms)
Ejemplo n.º 2
0
 def test_all_equality(self):
     self.assertEqual(All("play", Concept("Child")),
                      All("play", Concept("Man")))
Ejemplo n.º 3
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")))
]
Ejemplo n.º 4
0
 def test_all_constructor(self):
     all_role = All("hasParent", Concept("Man"))
     self.assertEqual(all_role.name, "hasParent")
     self.assertEqual(all_role.concept.name, "Man")
Ejemplo n.º 5
0
 def test_simple_all(self):
     axiom=All("hasParent",And(Concept("Engineer"),Concept("Graduate")))
     models=get_models(self.pre_graph,axiom,"Aditya")
Ejemplo n.º 6
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))
Ejemplo n.º 7
0
 def test_nnf_not_all(self):
     axiom1 = Not(All("A", Concept("B")))
     axiom2 = Some("A", Not(Concept("B")))
     self.assertEqual(NNF(axiom1), axiom2)
Ejemplo n.º 8
0
 def test_nnf_all(self):
     axiom1 = All("A", Concept("B"))
     self.assertEqual(NNF(axiom1), axiom1)