class TestDiscriminateCompleteDialog(unittest.TestCase):
    """Tests the differents features of the Dialog module.
    This must be tested with oro-server using the testsuite.oro.owl ontology.
    """

    def setUp(self):
        self.dialog = Dialog()
        self.dialog.start()

        self.oro = ResourcePool().ontology_server

        try:
            self.oro.reload()
            self.oro.add(['shelf1 rdf:type Shelf',
                          'table1 rdf:type Table',
                          'table2 rdf:type Table', 'table2 hasColor blue',
                          'Banana rdfs:subClassOf Plant',
                          'y_banana rdf:type Banana', 'y_banana hasColor yellow', 'y_banana isOn shelf1',
                          'green_banana rdf:type Banana', 'green_banana hasColor green', 'green_banana isOn table2',
                          'ACCESSKIT rdf:type Gamebox', 'ACCESSKIT hasColor white', 'ACCESSKIT hasSize big',
                          'ACCESSKIT isOn table1',
                          'ORANGEBOX rdf:type Gamebox', 'ORANGEBOX hasColor orange', 'ORANGEBOX hasSize big',
                          'ORANGEBOX isOn ACCESSKIT',
                          'MYBOX rdf:type Gamebox', 'MYBOX hasColor orange', 'MYBOX hasSize small',
                          'MYBOX isOn ACCESSKIT',
                          'SPACENAVBOX rdf:type Gamebox', 'SPACENAVBOX hasColor white', 'SPACENAVBOX hasSize big',
                          'SPACENAVBOX isOn ACCESSKIT',
                          'y_bottle rdf:type Bottle', 'y_bottle isLocated RIGHT',
                          'r_bottle rdf:type Bottle', 'r_bottle isLocated FRONT',
                          'b_bottle rdf:type Bottle', 'b_bottle isLocated BACK'
            ])
        except AttributeError: #the ontology server is not started of doesn't know the method
            pass

    def test_discriminate1(self):
        """ Color discriminant should be found"""

        logger.info("\n##################### test_discriminate1 ########################\n")
        ####
        stmt = "the banana is good"
        answer = "the green one"
        ####
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        expected_result = ['green_banana hasFeature good']
        self.assertTrue(check_results(res[0], expected_result))

        """ Color discriminant should be found"""

        logger.info("\n##################### test_discriminate2 ########################\n")
        ####
        stmt = "the banana is good"
        answer = "the yellow one"
        ####
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        expected_result = ['y_banana hasFeature good']
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate3(self):
        """ Color discriminant should be found"""

        logger.info("\n##################### test_discriminate3 ########################\n")
        ####
        stmt = "give me the banana"
        answer = "the green one"
        ####
        expected_result = ['myself desires *',
                           '* rdf:type Give',
                           '* performedBy myself',
                           '* actsOnObject green_banana',
                           '* receivedBy myself']
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))


    def test_discriminate4(self):
        """No ambiguity."""

        logger.info("\n##################### test_discriminate4 ########################\n")
        ####
        stmt = "get the gamebox which is on the table"
        answer = None
        ####
        expected_result = ['myself desires *',
                           '* rdf:type Get',
                           '* performedBy myself',
                           '* actsOnObject ACCESSKIT']
        ###
        res = self.dialog.test('myself', stmt)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate5(self):
        """ Size discriminant should be found """

        logger.info("\n##################### test_discriminate5 ########################\n")
        ####
        stmt = "get the orange gamebox"
        answer = "the big one"
        ####
        expected_result = ['myself desires *',
                           '* rdf:type Get',
                           '* performedBy myself',
                           '* actsOnObject ORANGEBOX']
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate6(self):
        """No complete discriminant found. More info required"""

        logger.info("\n##################### test_discriminate6 ########################\n")
        ####
        stmt = "get the big gamebox"
        answer = "the orange one"
        ####
        expected_result = ['myself desires *',
                           '* rdf:type Get',
                           '* performedBy myself',
                           '* actsOnObject ORANGEBOX']
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))


    def test_discriminate7(self):
        """ Location discriminant should be found """

        logger.info("\n##################### test_discriminate7 ########################\n")
        ####
        stmt = "get the white gamebox"
        answer = "the one which is on the table1"
        ####
        expected_result = ['myself desires *',
                           '* rdf:type Get',
                           '* performedBy myself',
                           '* actsOnObject ACCESSKIT']
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate8(self):
        """ Location wrt robot discriminant should be found """

        logger.info("\n##################### test_discriminate8 ########################\n")
        ####
        stmt = "get the bottle"
        answer = "the one which is in front of you"
        ####
        expected_result = ['myself desires *',
                           '* rdf:type Get',
                           '* performedBy myself',
                           '* actsOnObject r_bottle']
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate9(self):
        logger.info("\n##################### Class grounding ########################\n")
        ####
        stmt = "a fruit is a plant"
        answer = "a kind of thing"
        ####
        expected_result = ['Plant rdfs:subClassOf Thing', 'Fruit rdfs:subClassOf Plant']
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def tearDown(self):
        self.dialog.stop()
        self.dialog.join()
Esempio n. 2
0
class TestMovingToLondonScenario(unittest.TestCase):
    """
    Scenario
    --------
    ACHILLE and JULIE are moving from Toulouse to London, and they must
    pack everything before leaving. ACHILLE is sorting its video tapes, and he 
    throws away the oldest ones. Jido is watching him.

    Setup:
      One trashbin, one cardboard box, 2 tapes on the table [TAPE1 = Lord of 
      the Robots (lotr) and TAPE2 = JIDO-E].
    
    Complete scenario here:
    http://homepages.laas.fr/slemaign/wiki/doku.php?id=scenario_demo_roman
    """
    def setUp(self):
        self.dialog = Dialog()
        self.dialog.start()

        self.oro = ResourcePool().ontology_server

        try:

            self.oro.add([
                'ACHILLE rdf:type Human',
                'ACHILLE rdfs:label Achille',
                'JULIE rdf:type Human',
                'JULIE rdfs:label Julie',
                'TABLE rdf:type Table',
                'Trashbin rdfs:subClassOf Box',
                'CardBoardBox rdfs:subClassOf Box',
                'CardBoardBox rdfs:label "cardboard box"',
                'TRASHBIN rdf:type Trashbin',
                'CARDBOARD_BOX rdf:type CardBoardBox',
                'CARDBOARD_BOX isOn TABLE',
                'TAPE1 rdf:type VideoTape',
                'TAPE1 rdfs:label "The Lords of the robots"',
                'TAPE1 isOn TABLE',
                'TAPE2 rdf:type VideoTape',
                'TAPE2 rdfs:label "Jido-E"',
                'TAPE2 isOn TABLE',
                'VideoTape owl:equivalentClass Tape',
                'TAPE1 owl:differentFrom TAPE2',
            ])
            """           
            self.oro.addForAgent('ACHILLE',
                        ['BLUE_TRASHBIN rdf:type Trashbin',
                        'PINK_TRASHBIN rdf:type Trashbin',
                        'BLACK_TAPE rdf:type VideoTape', 'BLACK_TAPE isIn PINK_TRASHBIN',
                        'GREY_TAPE rdf:type VideoTape', 'GREY_TAPE isOn HRP2TABLE'])
            """
        except AttributeError:  #the ontology server is not started of doesn't know the method
            print(
                "Couldn't connect to the ontology server. Aborting the test.")
            raise

        try:
            self.oro.addForAgent('ACHILLE', [
                'ACHILLE rdf:type Human',
                'ACHILLE rdfs:label Achille',
                'JULIE rdf:type Human',
                'JULIE rdfs:label Julie',
                'TABLE rdf:type Table',
                'Trashbin rdfs:subClassOf Box',
                'CardBoardBox rdfs:subClassOf Box',
                'CardBoardBox rdfs:label "cardboard box"',
                'TRASHBIN rdf:type Trashbin',
                'CARDBOARD_BOX rdf:type CardBoardBox',
                'CARDBOARD_BOX isOn TABLE',
                'TAPE1 rdf:type VideoTape',
                'TAPE1 rdfs:label "The Lords of the robots"',
                'TAPE1 isOn TABLE',
                'TAPE2 rdf:type VideoTape',
                'TAPE2 rdfs:label "Jido-E"',
                'TAPE2 isOn TABLE',
                'VideoTape owl:equivalentClass Tape',
                'TAPE1 owl:differentFrom TAPE2',
            ])
        except AttributeError:  #the ontology server is not started of doesn't know the method
            print(
                "Couldn't connect to the ontology server. Aborting the test.")
            raise

        try:
            self.oro.addForAgent('JULIE', [
                'ACHILLE rdf:type Human',
                'ACHILLE rdfs:label Achille',
                'JULIE rdf:type Human',
                'JULIE rdfs:label Julie',
                'TABLE rdf:type Table',
                'Trashbin rdfs:subClassOf Box',
                'CardBoardBox rdfs:subClassOf Box',
                'CardBoardBox rdfs:label "cardboard box"',
                'TRASHBIN rdf:type Trashbin',
                'CARDBOARD_BOX rdf:type CardBoardBox',
                'CARDBOARD_BOX isOn TABLE',
                'TAPE1 rdf:type VideoTape',
                'TAPE1 rdfs:label "The Lords of the robots"',
                'TAPE1 isOn TABLE',
                'TAPE2 rdf:type VideoTape',
                'TAPE2 rdfs:label "Jido-E"',
                'TAPE2 isOn TABLE',
                'VideoTape owl:equivalentClass Tape',
                'TAPE1 owl:differentFrom TAPE2',
            ])
        except AttributeError:  #the ontology server is not started of doesn't know the method
            print(
                "Couldn't connect to the ontology server. Aborting the test.")
            raise

    def runTest(self):
        """ MOVING TO LONDON SCENARIO
        
        ACHILLE puts TAPE1 in CARDBOARDBOX"""

        print()
        self.oro.add(['TAPE1 isIn CARDBOARD_BOX'])
        self.oro.addForAgent('ACHILLE', ['ACHILLE pointsAt CARDBOARD_BOX'])

        stmt = "Jido, what is in the box?"
        answer = "This box"
        ####
        res = self.dialog.test('ACHILLE', stmt, answer)
        self.assertEquals(res[1][1], "The Lords of the robots.")

        self.oro.removeForAgent('ACHILLE', ['ACHILLE pointsAt CARDBOARD_BOX'])

        stmt = "Ok. And where is the other tape?"
        ####
        self.assertEquals(
            self.dialog.test('ACHILLE', stmt)[1][1],
            "The other tape is on the table.")

        stmt = "Ok. Thanks."
        self.assertEquals(
            self.dialog.test('ACHILLE', stmt)[1][1], "You're welcome.")
        """Julie arrives, and gives two big boxes to ACHILLE. He can not take anything!"""

        self.oro.update(['TAPE2 isReachable false'])

        stmt = "Jido, can you take Jido-E?"
        ####
        res = self.dialog.test('ACHILLE', stmt)

        expected_result = [
            'ACHILLE desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject TAPE2'
        ]

        self.assertTrue(check_results(res[0], expected_result))
        """Julie pushes a bit the TAPE2, which is now close enough, but still 
        unreachable because of an obstacle.
        """
        self.oro.addForAgent('ACHILLE', ['ACHILLE pointsAt TAPE2'])
        stmt = "And now, can you reach this tape?"
        ####
        ### Check ['myself reaches TAPE2']
        self.assertEquals(
            self.dialog.test('ACHILLE', stmt)[1][1],
            "I don't know, if I can reach this tape now.")
        self.oro.removeForAgent('ACHILLE', ['ACHILLE pointsAt TAPE2'])
        """Julie pushes again the tape. It is now reachable.
        """
        self.oro.update(['TAPE2 isReachable true'])

        stmt = "Jido, can you take it?"
        ####
        ### Do you mean Jido-E
        answer = "I mean Jido-E"
        ###
        res = self.dialog.test('JULIE', stmt, answer)
        expected_result = [
            'JULIE desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject TAPE2'
        ]

        self.assertTrue(check_results(res[0], expected_result))
        """Achille puts JIDO-E in the trashbin. Jido still observes. Achille 
        leaves. Julie finds JIDO-E in the trashbin, and takes it away. ACHILLE 
        comes back to the table.
        """

        print()
        self.oro.remove(['TAPE2 isOn TABLE'])
        self.oro.add(['TAPE2 isAt JULIE'])
        self.oro.addForAgent('ACHILLE', ['TAPE2 isIn TRASHBIN'])

        stmt = "Can you give me the tape in the trashbin?"
        #Expected intermediate question: "You mean, the JIDO-E tape?"
        #NOT FOR ROMAN demo!
        #answer = "Yes"
        ####
        res = self.dialog.test('ACHILLE', stmt)

        expected_result = [
            'ACHILLE desires *', '* rdf:type Give', '* performedBy myself',
            '* actsOnObject TAPE2', '* receivedBy ACHILLE'
        ]

        self.assertTrue(check_results(res[0], expected_result))

    def tearDown(self):
        self.dialog.stop()
        self.dialog.join()
Esempio n. 3
0
class TestDiscriminateCompleteDialog(unittest.TestCase):
    """Tests the differents features of the Dialog module.
    This must be tested with oro-server using the testsuite.oro.owl ontology.
    """
    def setUp(self):
        self.dialog = Dialog()
        self.dialog.start()

        self.oro = ResourcePool().ontology_server

        try:
            self.oro.reload()
            self.oro.add([
                'shelf1 rdf:type Shelf', 'table1 rdf:type Table',
                'table2 rdf:type Table', 'table2 hasColor blue',
                'Banana rdfs:subClassOf Plant', 'y_banana rdf:type Banana',
                'y_banana hasColor yellow', 'y_banana isOn shelf1',
                'green_banana rdf:type Banana', 'green_banana hasColor green',
                'green_banana isOn table2', 'ACCESSKIT rdf:type Gamebox',
                'ACCESSKIT hasColor white', 'ACCESSKIT hasSize big',
                'ACCESSKIT isOn table1', 'ORANGEBOX rdf:type Gamebox',
                'ORANGEBOX hasColor orange', 'ORANGEBOX hasSize big',
                'ORANGEBOX isOn ACCESSKIT', 'MYBOX rdf:type Gamebox',
                'MYBOX hasColor orange', 'MYBOX hasSize small',
                'MYBOX isOn ACCESSKIT', 'SPACENAVBOX rdf:type Gamebox',
                'SPACENAVBOX hasColor white', 'SPACENAVBOX hasSize big',
                'SPACENAVBOX isOn ACCESSKIT', 'y_bottle rdf:type Bottle',
                'y_bottle isLocated RIGHT', 'r_bottle rdf:type Bottle',
                'r_bottle isLocated FRONT', 'b_bottle rdf:type Bottle',
                'b_bottle isLocated BACK'
            ])
        except AttributeError:  #the ontology server is not started of doesn't know the method
            pass

    def test_discriminate1(self):
        """ Color discriminant should be found"""

        logger.info(
            "\n##################### test_discriminate1 ########################\n"
        )
        ####
        stmt = "the banana is good"
        answer = "the green one"
        ####
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        expected_result = ['green_banana hasFeature good']
        self.assertTrue(check_results(res[0], expected_result))
        """ Color discriminant should be found"""

        logger.info(
            "\n##################### test_discriminate2 ########################\n"
        )
        ####
        stmt = "the banana is good"
        answer = "the yellow one"
        ####
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        expected_result = ['y_banana hasFeature good']
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate3(self):
        """ Color discriminant should be found"""

        logger.info(
            "\n##################### test_discriminate3 ########################\n"
        )
        ####
        stmt = "give me the banana"
        answer = "the green one"
        ####
        expected_result = [
            'myself desires *', '* rdf:type Give', '* performedBy myself',
            '* actsOnObject green_banana', '* receivedBy myself'
        ]
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate4(self):
        """No ambiguity."""

        logger.info(
            "\n##################### test_discriminate4 ########################\n"
        )
        ####
        stmt = "get the gamebox which is on the table"
        answer = None
        ####
        expected_result = [
            'myself desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject ACCESSKIT'
        ]
        ###
        res = self.dialog.test('myself', stmt)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate5(self):
        """ Size discriminant should be found """

        logger.info(
            "\n##################### test_discriminate5 ########################\n"
        )
        ####
        stmt = "get the orange gamebox"
        answer = "the big one"
        ####
        expected_result = [
            'myself desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject ORANGEBOX'
        ]
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate6(self):
        """No complete discriminant found. More info required"""

        logger.info(
            "\n##################### test_discriminate6 ########################\n"
        )
        ####
        stmt = "get the big gamebox"
        answer = "the orange one"
        ####
        expected_result = [
            'myself desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject ORANGEBOX'
        ]
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate7(self):
        """ Location discriminant should be found """

        logger.info(
            "\n##################### test_discriminate7 ########################\n"
        )
        ####
        stmt = "get the white gamebox"
        answer = "the one which is on the table1"
        ####
        expected_result = [
            'myself desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject ACCESSKIT'
        ]
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate8(self):
        """ Location wrt robot discriminant should be found """

        logger.info(
            "\n##################### test_discriminate8 ########################\n"
        )
        ####
        stmt = "get the bottle"
        answer = "the one which is in front of you"
        ####
        expected_result = [
            'myself desires *', '* rdf:type Get', '* performedBy myself',
            '* actsOnObject r_bottle'
        ]
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def test_discriminate9(self):
        logger.info(
            "\n##################### Class grounding ########################\n"
        )
        ####
        stmt = "a fruit is a plant"
        answer = "a kind of thing"
        ####
        expected_result = [
            'Plant rdfs:subClassOf Thing', 'Fruit rdfs:subClassOf Plant'
        ]
        ###
        res = self.dialog.test('myself', stmt, answer)
        logger.info(res)
        self.assertTrue(check_results(res[0], expected_result))

    def tearDown(self):
        self.dialog.stop()
        self.dialog.join()
Esempio n. 4
0
class TestMovingToLondonScenario(unittest.TestCase):
    """
    Scenario
    --------
    ACHILLE and JULIE are moving from Toulouse to London, and they must
    pack everything before leaving. ACHILLE is sorting its video tapes, and he 
    throws away the oldest ones. Jido is watching him.

    Setup:
      One trashbin, one cardboard box, 2 tapes on the table [TAPE1 = Lord of 
      the Robots (lotr) and TAPE2 = JIDO-E].
    
    Complete scenario here:
    http://homepages.laas.fr/slemaign/wiki/doku.php?id=scenario_demo_roman
    """
    
    def setUp(self):
        self.dialog = Dialog()
        self.dialog.start()
        
        self.oro = ResourcePool().ontology_server
        
        try:
            
            self.oro.add([  'ACHILLE rdf:type Human',
                            'ACHILLE rdfs:label Achille',
                            'JULIE rdf:type Human', 
                            'JULIE rdfs:label Julie',
                            'TABLE rdf:type Table',
                            'Trashbin rdfs:subClassOf Box',
                            'CardBoardBox rdfs:subClassOf Box',
                            'CardBoardBox rdfs:label "cardboard box"',
                            'TRASHBIN rdf:type Trashbin',
                            'CARDBOARD_BOX rdf:type CardBoardBox',
                            'CARDBOARD_BOX isOn TABLE',
                            'TAPE1 rdf:type VideoTape', 
                            'TAPE1 rdfs:label "The Lords of the robots"', 
                            'TAPE1 isOn TABLE',
                            'TAPE2 rdf:type VideoTape', 
                            'TAPE2 rdfs:label "Jido-E"', 
                            'TAPE2 isOn TABLE',
                            'VideoTape owl:equivalentClass Tape',
                            'TAPE1 owl:differentFrom TAPE2',
                            ])
            """           
            self.oro.addForAgent('ACHILLE',
                        ['BLUE_TRASHBIN rdf:type Trashbin',
                        'PINK_TRASHBIN rdf:type Trashbin',
                        'BLACK_TAPE rdf:type VideoTape', 'BLACK_TAPE isIn PINK_TRASHBIN',
                        'GREY_TAPE rdf:type VideoTape', 'GREY_TAPE isOn HRP2TABLE'])
            """        
        except AttributeError: #the ontology server is not started of doesn't know the method
            print("Couldn't connect to the ontology server. Aborting the test.")
            raise
        
        try:
            self.oro.addForAgent('ACHILLE',[
                            'ACHILLE rdf:type Human',
                            'ACHILLE rdfs:label Achille',
                            'JULIE rdf:type Human', 
                            'JULIE rdfs:label Julie',
                            'TABLE rdf:type Table',
                            'Trashbin rdfs:subClassOf Box',
                            'CardBoardBox rdfs:subClassOf Box',
                            'CardBoardBox rdfs:label "cardboard box"',
                            'TRASHBIN rdf:type Trashbin',
                            'CARDBOARD_BOX rdf:type CardBoardBox',
                            'CARDBOARD_BOX isOn TABLE',
                            'TAPE1 rdf:type VideoTape', 
                            'TAPE1 rdfs:label "The Lords of the robots"', 
                            'TAPE1 isOn TABLE',
                            'TAPE2 rdf:type VideoTape', 
                            'TAPE2 rdfs:label "Jido-E"', 
                            'TAPE2 isOn TABLE',
                            
                            'VideoTape owl:equivalentClass Tape',
                            
                            'TAPE1 owl:differentFrom TAPE2',
                            ])
        except AttributeError: #the ontology server is not started of doesn't know the method
            print("Couldn't connect to the ontology server. Aborting the test.")
            raise
        
        
        try:
            self.oro.addForAgent('JULIE',[
                            'ACHILLE rdf:type Human',
                            'ACHILLE rdfs:label Achille',
                            'JULIE rdf:type Human', 
                            'JULIE rdfs:label Julie',
                            'TABLE rdf:type Table',
                            'Trashbin rdfs:subClassOf Box',
                            'CardBoardBox rdfs:subClassOf Box',
                            'CardBoardBox rdfs:label "cardboard box"',
                            'TRASHBIN rdf:type Trashbin',
                            'CARDBOARD_BOX rdf:type CardBoardBox',
                            'CARDBOARD_BOX isOn TABLE',
                            'TAPE1 rdf:type VideoTape', 
                            'TAPE1 rdfs:label "The Lords of the robots"', 
                            'TAPE1 isOn TABLE',
                            'TAPE2 rdf:type VideoTape', 
                            'TAPE2 rdfs:label "Jido-E"', 
                            'TAPE2 isOn TABLE',
                            
                            'VideoTape owl:equivalentClass Tape',
                            
                            'TAPE1 owl:differentFrom TAPE2',
                            ])
        except AttributeError: #the ontology server is not started of doesn't know the method
            print("Couldn't connect to the ontology server. Aborting the test.")
            raise
       
            
    def runTest(self):
        """ MOVING TO LONDON SCENARIO
        
        ACHILLE puts TAPE1 in CARDBOARDBOX"""

        print()
        self.oro.add(['TAPE1 isIn CARDBOARD_BOX'])
        self.oro.addForAgent('ACHILLE',['ACHILLE pointsAt CARDBOARD_BOX'])
        
        stmt = "Jido, what is in the box?"
        answer = "This box"
        ####
        res = self.dialog.test('ACHILLE', stmt, answer)
        self.assertEquals(res[1][1],"The Lords of the robots.")
        
        self.oro.removeForAgent('ACHILLE',['ACHILLE pointsAt CARDBOARD_BOX'])
        
        stmt = "Ok. And where is the other tape?"
        ####
        self.assertEquals(self.dialog.test('ACHILLE', stmt)[1][1],"The other tape is on the table.")
        
        stmt = "Ok. Thanks."
        self.assertEquals(self.dialog.test('ACHILLE', stmt)[1][1],"You're welcome.")
        
        """Julie arrives, and gives two big boxes to ACHILLE. He can not take anything!"""
       
        self.oro.update(['TAPE2 isReachable false'])
                            
        stmt = "Jido, can you take Jido-E?"
        ####
        res = self.dialog.test('ACHILLE', stmt)
        
        expected_result = ['ACHILLE desires *',
                  '* rdf:type Get',
                  '* performedBy myself',
                  '* actsOnObject TAPE2']
        
        self.assertTrue(check_results(res[0], expected_result))
        
        """Julie pushes a bit the TAPE2, which is now close enough, but still 
        unreachable because of an obstacle.
        """
        self.oro.addForAgent('ACHILLE',['ACHILLE pointsAt TAPE2'])
        stmt = "And now, can you reach this tape?"
        ####
        ### Check ['myself reaches TAPE2']
        self.assertEquals(self.dialog.test('ACHILLE', stmt)[1][1],"I don't know, if I can reach this tape now.")
        self.oro.removeForAgent('ACHILLE',['ACHILLE pointsAt TAPE2'])
        
        """Julie pushes again the tape. It is now reachable.
        """
        self.oro.update(['TAPE2 isReachable true'])
        
        stmt = "Jido, can you take it?"
        ####
        ### Do you mean Jido-E
        answer = "I mean Jido-E"
        ###
        res = self.dialog.test('JULIE', stmt, answer)
        expected_result = ['JULIE desires *',
                  '* rdf:type Get',
                  '* performedBy myself',
                  '* actsOnObject TAPE2']
        
        self.assertTrue(check_results(res[0], expected_result))
        
        """Achille puts JIDO-E in the trashbin. Jido still observes. Achille 
        leaves. Julie finds JIDO-E in the trashbin, and takes it away. ACHILLE 
        comes back to the table.
        """

        print()
        self.oro.remove(['TAPE2 isOn TABLE'])
        self.oro.add(['TAPE2 isAt JULIE'])
        self.oro.addForAgent('ACHILLE', ['TAPE2 isIn TRASHBIN'])
                            
        stmt = "Can you give me the tape in the trashbin?"
        #Expected intermediate question: "You mean, the JIDO-E tape?"
        #NOT FOR ROMAN demo!
        #answer = "Yes"
        ####
        res = self.dialog.test('ACHILLE', stmt)
        
        expected_result = ['ACHILLE desires *',
                  '* rdf:type Give',
                  '* performedBy myself',
                  '* actsOnObject TAPE2',
                  '* receivedBy ACHILLE']
        
        self.assertTrue(check_results(res[0], expected_result))

    def tearDown(self):
        self.dialog.stop()
        self.dialog.join()