diff --git a/examples/scripts/ssbj_mdo.py b/examples/scripts/ssbj_mdo.py index d9f14a9d015167bf762baa95990e9dab570fc924..02ce14331b3db12ccfb08fa3815ccd3df800e778 100644 --- a/examples/scripts/ssbj_mdo.py +++ b/examples/scripts/ssbj_mdo.py @@ -95,7 +95,8 @@ rcg.add_contact_roles('lmuller', roles='integrator') # Create a DSM and a VISTOMS visualization of the RCG rcg.create_dsm('RCG_extended', include_system_vars=True, destination_folder=pdf_dir, function_order=function_order) -rcg.vistoms_create(vistoms_dir, function_order=function_order) +# rcg.vistoms_create(vistoms_dir, function_order=function_order) +rcg.vistoms_start(vistoms_dir) # Save CMDOWS and KDMS file rcg.save('RCG', destination_folder=kdms_dir) diff --git a/kadmos/graph/mixin_vistoms.py b/kadmos/graph/mixin_vistoms.py index 00a8705f1feed9e4d76c8c0f1e003ed914be4d10..8e43b94848053882f86fd52129ae53d4a4b6ee32 100644 --- a/kadmos/graph/mixin_vistoms.py +++ b/kadmos/graph/mixin_vistoms.py @@ -69,7 +69,7 @@ class VistomsMixin(object): vistoms_dir = os.path.abspath(temp_dir) # Save the graph (self) in the folder - self.save('temp_01.kdms', destination_folder=vistoms_dir, mpg=mpg) + self.save('tmp_01.kdms', destination_folder=vistoms_dir, mpg=mpg) # Then run interactive VISTOMS from kadmos.vistoms.vistoms import run_vistoms @@ -281,7 +281,7 @@ class VistomsMixin(object): return - def vistoms_add_json(self, vistoms_dir, mpg=None, function_order=None, reference_file=None, graph_id=None, replacement_id=None, xml_file=None): + def vistoms_add_json(self, vistoms_dir, mpg=None, function_order=None, reference_file=None, graph_id=None, xml_file=None): """Function to add a graph to a existing VISTOMS instance. In one VISTOMS instance different graphs can be shown. For example it is possible to include different @@ -295,57 +295,35 @@ class VistomsMixin(object): :type function_order: list :param reference_file: file from which reference values are extracted (either full path or file in same folder) :type reference_file: str - :param replacement_id: indentifier of the graph to be replaced - :type replacement_id: basestr :param xml_file: Name of the CMDOWS xml-file :type xml_file: file """ # Check inputs self._vistoms_assertions(mpg, function_order, reference_file, None, graph_id) - if replacement_id: - assert isinstance(replacement_id, str), 'The attribute replacement_id should be of type str.' - assert os.path.exists(vistoms_dir), 'There is not VISTOMS instance at %s.' % vistoms_dir - assert os.path.exists(os.path.join(vistoms_dir, VISTOMS_NAME)), VISTOMS_NAME + \ - ' not found in folder %s.' % vistoms_dir + # assert os.path.exists(vistoms_dir), 'There is not VISTOMS instance at %s.' % vistoms_dir + # assert os.path.exists(os.path.join(vistoms_dir, VISTOMS_NAME)), VISTOMS_NAME + \ + # ' not found in folder %s.' % vistoms_dir # Logging logger.info('Adding graph to the VISTOMS instance (this might take a while)...') # Create vistoms file name path - vistoms_file = os.path.join(vistoms_dir, VISTOMS_NAME) + # vistoms_file = os.path.join(vistoms_dir, VISTOMS_NAME) # Get the graph data and line number - data, data_linenumber = _get_the_data(vistoms_file) - - - if data == 'REP__GRAPH_DATA__REP': - # Create dictionary for the data.json file - data = dict(graphs=[], categories=[]) - # Add categories - data['categories'].append({'name': 'schema', 'description': 'schema'}) - data['categories'].append({"name": "catschema_nodeLev", "description": "node levels"}) - data['categories'].append({"name": "catschema_funLev", "description": "function levels"}) - data['categories'].append({"name": "catschema_roleLev", "description": "role levels"}) - data['categories'].append({"name": "catschema_sysLev", "description": "system levels"}) + # data, data_linenumber = _get_the_data(vistoms_file) - if replacement_id is not None: - # Find IDs in the current data.json - graph_ids = [graph['id'] for graph in data['graphs']] - assert replacement_id in graph_ids, 'Could not find replacement_id: %s. Available IDs: %s.' % \ - (replacement_id, graph_ids) - replacement_index = graph_ids.index(replacement_id) - if graph_id is None: - if replacement_id is None: - if data == 'REP__GRAPH_DATA__REP': - graph_id = '01' - else: - graph_id = str(len(data['graphs']) + 1).zfill(2) - assert int(graph_id) < 100, 'graph_id (%d) should be smaller than 100.' % int(graph_id) - else: - graph_id = replacement_id - + # if data == 'REP__GRAPH_DATA__REP': + # Create dictionary for the data.json file + data = dict(graphs=[], categories=[]) + # Add categories + data['categories'].append({'name': 'schema', 'description': 'schema'}) + data['categories'].append({"name": "catschema_nodeLev", "description": "node levels"}) + data['categories'].append({"name": "catschema_funLev", "description": "function levels"}) + data['categories'].append({"name": "catschema_roleLev", "description": "role levels"}) + data['categories'].append({"name": "catschema_sysLev", "description": "system levels"}) # Determine graph data entry @@ -353,10 +331,7 @@ class VistomsMixin(object): reference_file=reference_file, xml_file=xml_file) # Add graph_entry at the right location - if replacement_id is None: - data['graphs'].append(graph_entry) - else: - data['graphs'][replacement_index] = graph_entry + data['graphs'].append(graph_entry) # Replace the graph data data_str = json.dumps(data)