def _validate_config(self):
        """
        Validates the contents of the configuration file - under the assumption that it is well formed and conforms to the DTD.
        Checks aspects such as the types of attributes, for example.
        """
        # Simulation ID
        empty_string_check(self._config_dict['@id'])

        # Output
        empty_string_check(self._config_dict['output']['@baseDirectory'])
        self._config_dict['output']['@saveInteractionLog'] = parse_boolean(
            self._config_dict['output']['@saveInteractionLog'])
        self._config_dict['output']['@saveRelevanceJudgments'] = parse_boolean(
            self._config_dict['output']['@saveRelevanceJudgments'])
        self._config_dict['output']['@trec_eval'] = parse_boolean(
            self._config_dict['output']['@trec_eval'])

        # Topics
        def check_topic(t):
            """
            Checks a given topic, t. Looks for a topic ID and a valid topic description file.
            """
            empty_string_check(t['@id'])
            filesystem_exists_check(t['@filename'])
            filesystem_exists_check(t['@qrelsFilename'])

            if '@backgroundFilename' in t:  # A background file was specified.
                filesystem_exists_check(t['@backgroundFilename'])
            else:
                t['@backgroundFilename'] = None  # No background file was specified.

        topics = self._config_dict['topics']['topic']

        if type(topics) == list:
            for topic in topics:
                check_topic(topic)
        else:
            check_topic(topics)

        # Users
        users = self._config_dict['users']['user']

        if type(users) == list:
            for user in users:
                filesystem_exists_check(user['@configurationFile'])
        else:
            filesystem_exists_check(users['@configurationFile'])

        # Search Interface
        empty_string_check(self._config_dict['searchInterface']['@class'])
        check_attributes(self._config_dict['searchInterface'])
예제 #2
0
 def _validate_config(self):
     """
     Validates the contents of the configuration file - under the assumption that it is well formed and conforms to the DTD.
     Checks aspects such as the types of attributes, for example.
     """
     # Simulation ID
     empty_string_check(self._config_dict['@id'])
     
     # Output
     empty_string_check(self._config_dict['output']['@baseDirectory'])
     self._config_dict['output']['@saveInteractionLog'] = parse_boolean(self._config_dict['output']['@saveInteractionLog'])
     self._config_dict['output']['@saveRelevanceJudgments'] = parse_boolean(self._config_dict['output']['@saveRelevanceJudgments'])
     self._config_dict['output']['@trec_eval'] = parse_boolean(self._config_dict['output']['@trec_eval'])
     
     # Topics
     def check_topic(t):
         """
         Checks a given topic, t. Looks for a topic ID and a valid topic description file.
         """
         empty_string_check(t['@id'])
         filesystem_exists_check(t['@filename'])
         filesystem_exists_check(t['@qrelsFilename'])
         
         if '@backgroundFilename' in t:  # A background file was specified.
             filesystem_exists_check(t['@backgroundFilename'])
         else:
             t['@backgroundFilename'] = None  # No background file was specified.
         
     topics = self._config_dict['topics']['topic']
     
     if type(topics) == list:
         for topic in topics:
             check_topic(topic)
     else:
         check_topic(topics)
     
     # Users
     users = self._config_dict['users']['user']
     
     if type(users) == list:
         for user in users:
             filesystem_exists_check(user['@configurationFile'])
     else:
         filesystem_exists_check(users['@configurationFile'])
     
     # Search Interface
     empty_string_check(self._config_dict['searchInterface']['@class'])
     check_attributes(self._config_dict['searchInterface'])
예제 #3
0
 def check_topic(t):
     """
     Checks a given topic, t. Looks for a topic ID and a valid topic description file.
     """
     empty_string_check(t['@id'])
     filesystem_exists_check(t['@filename'])
     filesystem_exists_check(t['@qrelsFilename'])
     
     if '@backgroundFilename' in t:  # A background file was specified.
         filesystem_exists_check(t['@backgroundFilename'])
     else:
         t['@backgroundFilename'] = None  # No background file was specified.
        def check_topic(t):
            """
            Checks a given topic, t. Looks for a topic ID and a valid topic description file.
            """
            empty_string_check(t['@id'])
            filesystem_exists_check(t['@filename'])
            filesystem_exists_check(t['@qrelsFilename'])

            if '@backgroundFilename' in t:  # A background file was specified.
                filesystem_exists_check(t['@backgroundFilename'])
            else:
                t['@backgroundFilename'] = None  # No background file was specified.