src.dackar.utils.mbse.LMLparser =============================== .. py:module:: src.dackar.utils.mbse.LMLparser .. autoapi-nested-parse:: Created on February, 2024 @author: mandd Classes ------- .. autoapisummary:: src.dackar.utils.mbse.LMLparser.LMLobject Functions --------- .. autoapisummary:: src.dackar.utils.mbse.LMLparser.parseEntityDescription Module Contents --------------- .. py:class:: LMLobject(filename) Bases: :py:obj:`object` Class designed to process the MBSE model developed in Lifecycle Modeling Language (LML) using Innoslate. .. py:attribute:: filename .. py:attribute:: entities .. py:attribute:: linkEntities :value: [] .. py:attribute:: embEntities .. py:attribute:: LMLgraph :value: None .. py:attribute:: acronyms .. py:attribute:: listIDs :value: [] .. py:attribute:: linkToMBSEmodels .. py:method:: LMLparser(diagramName) This method is designed to parse the xml file containing the MBSE model, to create its corresponding graph and to populate: * the set of entities: dictionary of assets in the form of 'LML_ID': ('asset name', 'asset ID') * the set of links: list containing the LML-IDs of all links between assets * the set of embedded entities: dictionary of the components that have been specified in the description text of the LML asset or link (e.g., [comp1,comp2,comp3]) in the form of 'LML_ID': [comp1,comp2,comp3] :param diagramName: string, original name of the diagram; it is used to remove the correposing node in the graph .. py:method:: connetGraph() This method is designed to actually link the asset entities identified in the OPLparser method .. py:method:: parseLinkEntity(linkNode) This method extracts all required information of the link from the provided xml node. It populates the self.linkEntities and the self.embEntities variables. :param linkNode: xml node, xml node containing containing all the information of a single link generated :param in LML using Innoslate: :returns: None .. py:method:: parseAssetEntity(entityNode) This method extracts all required information of the asset from the provided xml node. It populates the self.entities and the self.embEntities variables. :param linkNode: xml node, xml node containing containing all the information of a single link generated :param in LML using Innoslate: :returns: None .. py:method:: returnGraph() This method returns the networkx graph :param None: :returns: networkx object, graph containing entities specified in the LML model :rtype: self.LMLgraph .. py:method:: returnEntities() This method returns the the dictionaries of entities and embedded entities specified in the MBSE model :param None: :returns: dict, dict of entities self.embEntities : dict, dict of embedded entities :rtype: self.entities .. py:method:: returnListIDs() This method returns the list of asset IDs :param None: :returns: list, list of asset IDs specified in the LML MBSE model :rtype: self.listIDs .. py:method:: cleanedGraph() This method is designed to clean the complete MBSE graph by removing the links which are represented as nodes :param None: :returns: networkx object, cleaned graph containing only asset entities specified in the LML MBSE model :rtype: g .. py:method:: printOnFile(name, csv=True) This method is designed to print on file the graph from networkx. This is to test a method to import a graph into neo4j as indicated in: https://stackoverflow.com/questions/52210619/how-to-import-a-networkx-graph-to-neo4j :param None: :returns: None .. py:method:: dumpNodesEdgesFiles(name) This method is designed to save the graph structure into gds entity See Example 3.2 in https://neo4j.com/docs/graph-data-science-client/current/graph-object/ :param None: :returns: None .. py:function:: parseEntityDescription(text) This method is designed to extract the elements specified in square brackets that are specified in the description node of the MBSE model of a link or entity :param text: str, text contained in the description node of the MBSE model :returns: tuple, tuple containing the list of elements specified in square brackets and separated by commas (e.g., ['FV304,'305']) and the link to an external MBSE model (e.g., ('centrifugalPumpFull', 'body')) :rtype: out