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'])
Ejemplo n.º 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'])
Ejemplo n.º 3
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.
        """
        # User ID
        empty_string_check(self._config_dict['@id'])

        # Query Generator
        empty_string_check(self._config_dict['queryGenerator']['@class'])
        check_attributes(self._config_dict['queryGenerator'])

        # Snippet Classifier
        empty_string_check(self._config_dict['textClassifiers']
                           ['snippetClassifier']['@class'])
        check_attributes(
            self._config_dict['textClassifiers']['snippetClassifier'])

        # Document Classifier
        empty_string_check(self._config_dict['textClassifiers']
                           ['documentClassifier']['@class'])
        check_attributes(
            self._config_dict['textClassifiers']['documentClassifier'])

        # Stopping Decision Maker
        empty_string_check(
            self._config_dict['stoppingDecisionMaker']['@class'])
        check_attributes(self._config_dict['stoppingDecisionMaker'])

        # Logger
        empty_string_check(self._config_dict['logger']['@class'])
        check_attributes(self._config_dict['logger'])

        # Search Context
        empty_string_check(self._config_dict['searchContext']['@class'])
        check_attributes(self._config_dict['searchContext'])

        # SERP Impression
        empty_string_check(self._config_dict['serpImpression']['@class'])
        check_attributes(self._config_dict['serpImpression'])
Ejemplo n.º 4
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.
     """
     # User ID
     empty_string_check(self._config_dict['@id'])
     
     # Query Generator
     empty_string_check(self._config_dict['queryGenerator']['@class'])
     check_attributes(self._config_dict['queryGenerator'])
     
     # Snippet Classifier
     empty_string_check(self._config_dict['textClassifiers']['snippetClassifier']['@class'])
     check_attributes(self._config_dict['textClassifiers']['snippetClassifier'])
     
     # Document Classifier
     empty_string_check(self._config_dict['textClassifiers']['documentClassifier']['@class'])
     check_attributes(self._config_dict['textClassifiers']['documentClassifier'])
     
     # Stopping Decision Maker
     empty_string_check(self._config_dict['stoppingDecisionMaker']['@class'])
     check_attributes(self._config_dict['stoppingDecisionMaker'])
     
     # Logger
     empty_string_check(self._config_dict['logger']['@class'])
     check_attributes(self._config_dict['logger'])
     
     # Search Context
     empty_string_check(self._config_dict['searchContext']['@class'])
     check_attributes(self._config_dict['searchContext'])