diff --git a/pyKADMOS/MDOproblem.py b/pyKADMOS/MDOproblem.py index 584577ae9c22b4bbfe798d946c172d2157d30a0e..822c1e904e5e0ebefa4301a01fa2b17091a2cb20 100644 --- a/pyKADMOS/MDOproblem.py +++ b/pyKADMOS/MDOproblem.py @@ -47,13 +47,14 @@ class MDOproblem: # Get input and output files, save in instance self._get_In_Out_Files(KB_files) - # Get Read-Write File, save in instance - self._get_base_file(KB_files) + if self.knowledge_base == "KB_CPACS": + # Get Read-Write File, save in instance + self._get_base_file(KB_files) - ignoreNodes = ['toolspecific'] - self._check_base_against_schema(ignoreNodes) + ignoreNodes = ['toolspecific'] + self._check_base_against_schema(ignoreNodes) - self._validate_InOutXmls() + self._validate_InOutXmls() self._get_function_data() @@ -537,6 +538,28 @@ class MDOproblem: idx += 1 return common_nodes + def _get_function_graph(self, functionName): + """ + This function builds a graph for the indicated function. + :param: functionName + :return: functionGraph + """ + assert isinstance(functionName, basestring), 'Provided function name must be a string!' + # TODO: ensure that function name exists in KB + + DG = nx.DiGraph() + for i in len(self.functionData): + # get function name + # loop through input child nodes + # build tuple of tool and child node, add attributes + # repreat for output + + + + pass + + return + def get_function_graph(self, function_name): """ Function to automatically create the digraph of the function element. @@ -551,9 +574,7 @@ class MDOproblem: function_input_analysis = self.analyze_function_xml(xml_file_input) function_output_analysis = self.analyze_function_xml(xml_file_output) - input_edges = [(function_input_analysis['valued_nodes'][i]['xpath'], - function_input_analysis['properties'][0]['attributes']['tool_name']) - for i in range(len(function_input_analysis['valued_nodes']))] + input_edges = [(function_input_analysis['valued_nodes'][i]['xpath'], function_input_analysis['properties'][0]['attributes']['tool_name']) for i in range(len(function_input_analysis['valued_nodes']))] output_edges = [(function_output_analysis['properties'][0]['attributes']['tool_name'], function_output_analysis['valued_nodes'][i]['xpath']) for i in range(len(function_output_analysis['valued_nodes']))]