note description: "This class will provide the initial xml with the placeholders for the validation, algorithm type and all others." author: "Nikolay Kazmin" date: "$Date$" revision: "$Revision$" class RM_SEED_XML_GENERATOR inherit RM_CONSTANTS create make feature{NONE} -- Creation make (a_algorithm_name: STRING; a_validation_code: INTEGER) -- `a_algorithm_name' is the algorithm name representing the type of algorithm to be performed by rapid miner. -- `a_validation_code' is the validation which will be performed by rapid miner.L do algorithm_name := a_algorithm_name validation_code := a_validation_code end feature -- Interface xml: STRING -- seed xml for rapidminer with the appropriate placeholders for validation and algorithms generate_xml -- generates the seed xml depending on the algorithm type and the validation type. -- It puts the required placeholders. do if validation_code = no_validation then xml := no_validation_xml else xml := x_validation_xml end ensure has_placeholder: xml.has_substring(placeholder_data_file) has_placeholder: xml.has_substring(placeholder_label_name) has_placeholder: xml.has_substring(placeholder_selected_attributes) has_placeholder: xml.has_substring(placeholder_algorithm_name) has_placeholder: xml.has_substring(placeholder_algorithm_parameters) has_placeholder: xml.has_substring(rm_environment.model_file_path) has_placeholder: validation_code /= no_validation implies xml.has_substring(rm_environment.performance_file_path) has_placeholder: validation_code /= no_validation implies xml.has_substring(placeholder_validation_name) has_placeholder: validation_code /= no_validation implies xml.has_substring(placeholder_validation_parameters) end feature{NONE} -- Internal data holders algorithm_name: STRING -- The name of the algorithm to be used by rapidminer. validation_code: INTEGER -- The code for validation which will be used by rapidminer. feature{NONE} -- Actual xml skeleton generation. no_validation_xml: STRING -- The initial xml if the validation code is 'no_validation' do Result := "" Result.append ( "[ ]") Result.append (placeholder_algorithm_parameters) Result.append ("[ ]") ensure has_placeholder: Result.has_substring (placeholder_data_file) has_placeholder: Result.has_substring (placeholder_label_name) has_placeholder: Result.has_substring (placeholder_selected_attributes) has_placeholder: Result.has_substring (placeholder_algorithm_name) has_placeholder: Result.has_substring (placeholder_algorithm_parameters) has_placeholder: Result.has_substring (rm_environment.model_file_path) end x_validation_xml: STRING -- The xml seed if the required validation is x_validation. do Result := "[ ") Result.append (placeholder_validation_parameters) Result.append ("[ ]") Result.append (placeholder_algorithm_parameters) Result.append ("[ ]") ensure has_placeholder: Result.has_substring (placeholder_data_file) has_placeholder: Result.has_substring (placeholder_label_name) has_placeholder: Result.has_substring (placeholder_selected_attributes) has_placeholder: Result.has_substring (placeholder_algorithm_name) has_placeholder: Result.has_substring (placeholder_algorithm_parameters) has_placeholder: Result.has_substring (rm_environment.model_file_path) has_placeholder: Result.has_substring (rm_environment.performance_file_path) has_placeholder: Result.has_substring (placeholder_validation_name) has_placeholder: Result.has_substring (placeholder_validation_parameters) end invariant algorithm_name_valid: is_valid_algorithm_name (algorithm_name) validation_valid: is_valid_validation_code (validation_code) end