...
We will use the collection of blocks in the MySQL_Tutorial Part 1 package in the MagicDraw model supplied, Syndeia_Tutorial_Testbed.rpy (Get it here - SysML Models, Profiles and Mappings.). In Figure 1, we see a component block with 12 specializations. We will use the parent component block to generate the table structure, using the value properties as column headers, and the specialized blocks to generate the table rows, with the default values as the column entries in each row.
Caution: component.name is given a special stereotype, <<MySQLTable_PrimaryKey>>. This stereotype should be assigned to a parameter that will not have duplicate values within the MySQL table, unlike mass or cost.Figure 1 Contents of MySQL_Tutorial Part 1 package in Syndeia Tutorial Testbed.mdzip
Launch the Syndeia dashboard from the MySQL_Tutorial Part 1 package in the SysML model. Select a Syndeia Cloud project, if necessary.
Figure 2 Contents of MySQL_Tutorial Part 1 package in Syndeia Tutorial Testbed.rpy
The first step is to create the table in MySQL. Go to the Connection Manager tab. Set the Connection Type to Model Transform, as shown in Figure 2. Drag the parent block, component, from SysML to AV_Tutorial in MySQL
Confirm table generation, as shown in Figure 3.
Figure 3 Confirming table generation
When complete, the Connection Manager should show a new table, component, under demoAV_tutorial _RhpTutorial, as shown in Figure 4.
Figure 4 Connection Manager after generation of new table, component
The Connection Search tab, as shown in Figure 5, shows the connection created between the SysML block and the MySQL table after Get All is clicked.
Figure 5 Connection Search tab shows link between SysML block and MySQL table
The next step is to create a row in the table in MySQL. Set the Connection Type to Data Map. Drag the child block, Atmospheric Sensor, from SysML to component in MySQL and a new table row is created, as shown in Figure 6.
Figure 6 Generating a table row from the Atmospheric Sensor block
The table viewed in the MySQL database through the MySQL Workbench appear as in Figure 7.
Figure 7 Generating a table row from the Atmospheric Sensor block
Before completing the table, we will demonstrate how to compare and synchronize the parameter values between the SysML model and the MySQL database. In Rhapsody, modify the default value of the cost value property of the Atmospheric Sensor block, from 100 to 50. In the Connection Browser tab, right click on the connection from the Atmospheric Sensor block and select Compare Source & Target, as shown in Figure 8.
Figure 8 Generating a comparison across the Atmospheric Sensor data map connection
The Comparison Result is shown in Figure 9. The changed value of Atmospheric Sensor.Mass can also be observed directly using the MySQL Workbench. To update the parameter value in MySQL, right-click on the same connection and select Sync Source -> Target and confirm.
Figure 9 Comparison Result before updating SysML value to MySQL table
The remaining SysML specialized blocks can be dragged over in one step by selecting the blocks (singly or multiple-select) on the left side of the Connection Manager tab and dragging them onto the component table on the right. When complete, the Connection Manager will appear as shown in Figure 10. The changed value of Atmospheric Sensor.Mass can also be observed in the right column.
...