• No se han encontrado resultados

Brunch in Madrid is taken with the glamour of a hotel, with extra sugar or betting on the classics

The XMI model transformation that follows specific rules defined in XSLT files is necessary for the complete retrieval of data included in ADs (input-system modelling step). For the proposed methodology, the XMI model transformation concept, carried out in Java, refers to the process where an XMI file (source model), obtained from the Activity Diagram, is transformed into two XMI/XML files (target models). Two

134

XSLT files have been developed in order to obtain one XMI with the elements that are nested to the nodes of the initial XMI file and one XML with the nodes and edges included in the initial XMI file. The two XSLT documents provide the rules so that all the necessary information that exists in the initial XMI file is properly structured into two output files (XMI and XML). The structure of these two output files is formed so that all the necessary information for the sequence of AD elements is properly loaded into the MySQL database enabling the automated generation of PN models, without missing any data.

It is noted that XMI is a specific application of XML, meaning that XMI documents can only be used for XMI purposes, whereas XML documents can be used for all XML applications, including XMI. In other words, all XMI files are XML, but not all XML files are XMI. Additionally, the XSLT that belongs to the XML family is used to perform XML transformations allowing the user to specify the desired structure and content of the output file. XSLT documents can reorder XML elements, add new elements and decide which elements should be displayed or omitted. The XSL transformation process is based on specific template rules defined by the user.

In the two following subsections, the model transformation of the XMI file obtained form an AD to two models, in XMI and XML format respectively, using XSLT files, is described.

6.3.3.1 First XMI Model Transformation using XSLT

For the first XMI model transformation, the rules of the developed XSLT file are applied to the XMI root nodes and edges and the elements presented as nested within the XMI nodes (XMI file obtained from the input AD). The structure of the XSLT document used for the first XMI model transformation starts with a template that contains processing instructions and commands for the XMI nodes and edges that match the specified XPath, a query language for selecting nodes from an XMI/XML document, expression. In this model transformation, the template defined in the XSLT file matches any child element of the XMI root packaged Element and then selects all the attributes of these elements as well as any existing immediate children of these elements. The packaged Element is used in XMI to group all the elements included in the AD, providing a hierarchical organisation of elements such as nodes, edges, etc.

135

The first XSLT document including explanatory comment is found in Appendix G, part B.

The XSLT, discussed in this section, generates an XMI file (with different structure from the initial XMI file) from which the elements found as nested within XMI nodes can be properly loaded to the MySQL database. This new developed XMI file consists of the root edges (<edge…/>) and nodes (<node…/>) from the initial XMI file, as well as the elements appeared as nested within XMI nodes (in the initial XMI file) such as <inputValue…/>, omitting any further nested elements, such as <upperBound…/>. Although the developed XMI file contains the data for edges and nodes, these elements cannot always ensure their proper loading to the MySQL database since in the case of a node holds a nested element, only the values of the nested element are loaded to database tables, omitting the values of the root element (node).

The attributes of the XMI elements, such as “xmi:type”, “xmi:id”, etc., and their corresponding values which are required to be retrieved, during the first XMI model transformation, to enable the automated PN model generation, are identified. For each element presented as nested within an XMI node, the attributes that need to be loaded to the MySQL database from the developed XMI file, are:

For the inputValue nested elements in the XMI file created from an input pin node in an AD and for the target nested elements, attached to accept event action nodes, the retrieved attributes required are: “xmi:type”; “xmi:id”; “name” (if available); and “incoming”.

For the outputValue nested elements created from an output pin node in an AD and for the result nested elements, attached to send signal action nodes, the retrieved attributes required are as above including the “outgoing”.

For the handler nested elements, created from the handler exception edges in an AD, the retrieved attributes required are: “xmi:type”; “xmi:id”; “exceptionInput”; and “handlerBody”.

The first XMI transformation was carried out in Java using the javax.xml.transform package. This package defines the generic APIs for processing transformation instructions and performs a transformation from source to result. For this first XMI model transformation, the target XML file (new_xmi_file.xml) is generated by taking

136

as source file the XMI file (Activity_Diagram.uml), obtained from AD, and applying the first XSLT file (xmi2xmi.xsl), presented in this section. The Java code, used for this transformation, including explanatory comments is presented in Appendix G, part C.

The developed XMI document, generated from the application of the XSLT discussed in this section, includes all the XMI nodes and edges, except for the upperBound elements as well as the “name” values from the inputValue and outputValue elements, as they are presented in an AD. None of the attributes of upperBound element is necessary for the generation of the mathematical representation of PN and hence, they are not retrieved to the XMI file generated from the model transformation. Similarly, the text values of the “name” attributes from the XMI inputValue and outputValue elements are also omitted to be retrieved into the developed XMI file. This is done so that later SQL code to be able to load to the MySQL database the “name” values from the root nodes (rather than the “name” values of the inputValue and outputValue elements) that are necessary to achieve the sequence of nodes and edges. Therefore, this transformation generates an XMI file from which the elements presented as nested within the XMI nodes such as inputValue, outputValue, handler, etc. will be retrieved in the MySQL database for the automated generation of PN.

6.3.3.2 Second XMI Model Transformation using XSLT

For the second XMI model transformation, the rules of thesecond XSLT file are only applied to the XMI root nodes and edges (XMI file obtained from the input AD). Applying this second XSLT, an XML file is generated that contains the attribute values of all the XMI root nodes and edges. These attribute values can then be properly loaded into the MySQL database.

The structure of this second XSLT file starts with a template that matches any child element of the XMI root element such as packagedElement, nodes, edges, etc. and then selects all the attributes and the corresponding values of these child elements. Then two templates are introduced for the edges and nodes respectively. Each template selects the attributes and the corresponding values of the edge/node element and transforms the attributes to elements. The attributes for each root element that need to be loaded to the MySQL database from this developed XML file, are:

137

For the nodes that exist in an AD, the retrieved attributes required are: “xmi:type”; “xmi:id”; “name” (if available ); “incoming” (if available); and “outgoing” (if available).

For the edges that exist in an AD, the retrieved attributes required are: “xmi:type”; “xmi:id”; “name” (if available); “target” (if available); and “source” (if available).

The node/edge attributes in the XML file are followed by the corresponding values according to the initial XMI document. The second XSLT document including explanatory comment is found in Appendix G, part B

As the first XMI model transformation, the second transformation, discussed in this section, is performed in Java using again the javax.xml.transform package, takes as input the XMI file of the AD (Activity_Diagram.uml) and applying the XSLT file discussed in this section (xmi2xml.xsl), it develops the target XML document (new_xml_file.xml). The Java code, used for this transformation found in Appendix G, part C, applies the same steps as followed by the Java code described in section 6.3.3.1 for the first XML transformation.

The XML file developed from the second XMI model transformation includes all the data for the nodes and edges as presented in an AD that would be used in the next step of the methodology for the automated generation of PN.

6.3.4 Application of the XMI Model Transformations to a Simple AD

Documento similar