Syndeia 3.3 (Plugin for Rhapsody)
Tutorial Exercise 3.2
Generating SysML Blocks/Instances from a MySQL Table
| 47 Perimeter Ctr E, Suite 410 |
...
Objectives
The new learning objectives of this exercise are to generate Rhapsody SysML blocks and instances from a MySQL database.
...
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.
Anchor _Ref377039308 _Ref377039308 _Ref388606407Anchor _Ref388606407 Figure 1 Syndeia Dashboard, Connection Manager tab, showing the repository MySQL @ IntercaxAnchor _Ref377039358 _Ref377039358 Figure 2 Dialog boxDrag 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.
Anchor _Ref377039398 _Ref377039398Figure 3 Syndeia Dashboard, Connection Manager tab, showing MySQl table component and the SysML block componentAnchor _Ref377039432 _Ref377039432 Figure 4 Instance generation dialog boxSet 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.Anchor _Ref377039545 _Ref377039545 Figure 5
Syndeia Dashboard, Connection Manager tab, showing new SysML specializations createdAnchor _Ref367106067 _Ref367106067 Step 5 above could have been left out. If an MySQL record was dragged into the empty package initially, the component block is created automatically, along with the specialization corresponding to the individual record. If you wish to try this, first delete the existing Syndeia connections between the table and SysML and erase the current contents of the MySQL_Tutorial Part 2 package in Rhapsody.
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.Anchor _Ref366950567 _Ref366950567 Anchor _Ref377044756 _Ref377044756 Figure 6 Modify contents of database in MySQL WorkbenchRefresh 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.
Anchor _Ref377039637 _Ref377039637 Anchor _Ref366949940 _Ref366949940
Figure 7 Multiple-select connections, right click, and select Sync Target → Source_Ref41422591 Figure 8 Results of Compare Source and TargetThe Comparison results should appear as shown in Figure 8.
Anchor _Ref41422591 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.