Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. We will use the collection of blocks in the MySQL_Tutorial Part 1 package in the MagicDraw model supplied, Syndeia Tutorial Testbed.mdzip (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.

    Figure 1: Contents of MySQL_Tutorial Part 1 package in Syndeia Tutorial Testbed.mdzip

    The same process works if the 12 blocks are instances rather than specializations of the component block. Whether the modeler uses instances or specializations to capture actual parameter values is a methodology question; MagicDraw and Syndeia support both.

    For users unfamiliar with MySQL databases, Appendix 1 describes how to access the databases directly using the MySQL Workbench, where the user can create, modify, and view schemas, tables and table rows directly.

  2. Launch the Syndeia dashboard from the MySQL_Tutorial Part 1 package in the SysML model. Select a Syndeia Cloud project, if necessary.

  3. 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 demo_tutorial in MySQL.

    Image Modified

    Figure 2: Contents of MySQL_Tutorial Part 1 package in Syndeia Tutorial Testbed.mdzip

  4. Confirm table generation, as shown in Figure 3.

    Figure 3: Confirming table generation

  5. When complete, the Connection Manager should show a new table, component, under demo_tutorial, as shown in Figure 4.

    Figure 4: Connection Manager after generation of new table, component

  6. 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.

    Image Modified

    Figure 5: Connection Summary tab shows link between SysML block and MySQL table

  7. 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.

    Image Modified

    Figure 6: Generating a table row from the Atmospheric Sensor block

  8. 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

  9. Before completing the table, we will demonstrate how to compare and synchronize the parameter values between the SysML model and the MySQL database. In MagicDraw, modify the default value of the cost value property of the Atmospheric Sensor block, from 50 to 100. 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.

    Image Modified

    Figure 8: Generating a comparison across the Atmospheric Sensor data map connection

  10. 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.

    Image Modified

    Figure 9: Comparison Result before updating SysML value to MySQL table

  11. The remaining SysML specialized blocks can be dragged over in one step by multiple-selecting the blocks 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.

    Image Modified

    Figure 10: Connection Manager after dragging all components to MySQL table

...

  1. To create a new table, begin by selecting which of the available schemas to create the table in. Right-click on the desired schema in the lower left corner of Figure A 7 and select Set as Default Schema. The selections should now appear in bold font.

    Image Modified

    Figure A 7: Table Editor, available schemas circled in red, Create New Table icon circled in yellow

  2. Click on the Create New Table icon (see yellow highlight in Figure A 7).

  3. Enter the new table's name in the first field. Check that the Schema to the right is correct.

  4. Expand the Window vertically, if necessary, to see several rows of the table headed Column Name…Datatype and enter column header information for the new table, as shown in Figure A 8. Generally, the first column entered will be set as primary key, but this can be changed by checking the PK and NN (Not Null) columns. When finished, click Apply. Respond to windows similar to Figure A 5 and Figure A 6 with Apply and Finish, respectively.

    Image Modified

    Figure A 8:  Table Editor, with column info entered (red highlight)

  5. To display and edit the contents of the table, enter the command shown is Figure A 9 in the Query 1 tab (shown for table Staff in schema test_demo) and click on the Execute icon.

    Image Modified

    Figure A 9: Query 1 tab, display contents of table, red highlight around Execute icon

  6. As shown in Figure A 10, enter the data into the table in the lower pane. In this example, we show a table with two columns (employee and desk) and four rows. When all data has been entered, click Apply, Apply and Finish as before.

    Image Modified

    Figure A 10: Table entry in lower pane

...