Exercise 3.2 - MySQL to SysML.
Objectives
The new learning objectives of this exercise are to generate Rhapsody SysML blocks and instances from a MySQL database.
Preparation
This exercise assumes the student has
IBM Rational Rhapsody 8.2 installed correctly on his or her machine with a valid license for use, and
Syndeia 3.3 installed as a plugin for Rhapsody with a valid license for use
Syndeia MySQL interface, correctly installed with a valid license for user.
A MySQL repository network connection in the Syndeia Repository Manager, where you have write privileges to MySQL
MySQL Workbench, a direct interface to the user's MySQL database
Exercise
In this exercise, we will use the MySQL table created in Exercise 3.1 and import this information back into an empty package in Rhapsody. If not still open, launch Rhapsody with the Syndeia_Tutorial_Testbed.rpy project (alternatively, create a new Rhapsody SysML project with the Syndeia profile).
Create an empty package in the SysML model named MySQL_Tutorial Part 2. Right-click it and open the Syndeia dashboard. If Syndeia was still open from the previous exercise, right-click MySQL_Tutorial Part 1 in the Connection Manager tab and use Go to… to navigate to the new package.
Expand the component table in the Connection Manager tab to show the table contents within the database, as shown in Figure 1. Set the Connection Type to Model Transform.
Figure 1Â Syndeia Dashboard, Connection Manager tab, showing the repository MySQL @ Intercax
Drag the table component (see red arrow in Figure 1) into the MySQL_Tutorial Part 2 package in the SysML model. Click Yes on the dialog box (Figure 2). When complete, component appears as a block in the SysML model panel as in Figure 3. Note that while the component block contains the structure of the component table (this can be seen in Rhapsody), it does not contain any of the data about specific components. This is the object of the next step.
Figure 2Â Dialog box
Figure 3 Syndeia Dashboard, Connection Manager tab, showing MySQl table component and the SysML block component
Set the Connection Type to Data Map. Select several of the individual records under the component table in the right-hand panel. Drag them into the MySQL_Tutorial Part 2 package in the left panel. A dialog box as in Figure 4 will appear. Check the "As Specialization" checkbox (Syndeia for Rhapsody does not support instances) and click Yes. The new SysML specializations are shown in Figure 5.
Figure 4 Instance generation dialog box
Figure 5 Syndeia Dashboard, Connection Manager tab, showing new SysML specializations created
In the next part of the exercise, we will make change to the data in the database and update the SysML model from MySQL.Go to the MySQL Workbench and modify some details of the connected rows. For example, see Figure 6 where the left side shows the component table before making changes and the right side show the changes. The cost of the Communication Controller was reduced from 30 to 25 and the mass of the GPS was reduced from 7 to 6.
Figure 6Â Modify contents of database in MySQL Workbench
Refresh the Connection Search tab by clicking Get All and multiple-select (using Ctrl key) connections DZSB04-R103 and R104 that correspond to the 2 modified rows. Right-click and select Sync Target → Source, as shown in Figure 7.
Figure 7 Multiple-select connections, right click, and select Sync Target → Source
The Comparison results should appear as shown in Figure 8.
Figure 8Â Results of Compare Source and Target
Right-click the two rows again and select Sync Target -> Source. Check that the values of AV_Tutorial_component_GPS.mass and AV_Tutorial_component_Communications_ Controller.cost are updated in the Rhapsody model.