Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Objectives

The new learning objectives of this exercise are to generate MagicDraw SysML blocks and instances from a MySQL database.

Preparation

This exercise assumes the student has

  • Cameo System Modeler 18.0 - 19.0 (or MagicDraw with SysML plug-in) installed correctly on his or her machine with a valid license for use, and

  • Syndeia 3.3 installed as a plugin for Cameo/MagicDraw 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

  1. In this exercise, we will use the MySQL table created in Exercise 3.1 and import this information back into an empty package in MagicDraw. If not still open, launch MagicDraw with the Syndeia Tutorial Testbed.mdzip (get it here - SysML Models, Profiles and Mappings) project (alternatively, create a new MagicDraw SysML project with the Syndeia profile).

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

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

  4. 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 MagicDraw), 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

  5. 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. Leave the "As Specialization" checkbox unchecked and click Yes. The new SysML instances are shown in Figure 5.

    Figure 4:  Instance generation dialog box

    Figure 5: Syndeia Dashboard, Connection Manager tab, showing new SysML instances created

  6. Explore other options for creating transferring MySQL records to the SysML model

    1. Drag more records from the component table into the MySQL_Tutorial Part 2 package in SysML, but check the "As Specialization" checkbox on the Syndeia dialog box. This will create a series of blocks that are specializations of the component block, but with the default values of the value properties showing the information from the individual records.

    2. Create a new package in the SysML project and drag some MySQL records into it. They will still be treated as instances (or specializations) of the component block even if they are not in the same package.

    3. In the Search Repository query box (upper right corner) of the Connection Manager, enter a valid MySQL syntax query, for example, search demo_tutorial.component where Mass < 3. Only those records satisfying the query will be displayed at the bottom of the search box and these can be dragged directly into the SysML model.

    4. Erase the current contents of the MySQL_Tutorial Part 2 package in MagicDraw. Drag some MySQL records into it. Note that a component block is created automatically, along with the instances (or specializations) corresponding to the individual records.

  7. 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 50 to 25 and the mass of the Payload Controller was reduced from 2.5 to 1.5.

    Figure 6:  Modify contents of database in MySQL Workbench

  8. Refresh the Connection Search tab by clicking Get All and multiple-select (using Ctrl key) connections DZSB01-R68 and R75 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

  9. In the Containment Tree in the SysML model, you can see that the appropriate values have been updated, as shown in Figure 8.

    Figure 8: Updated values from MySQL

  10. Similarly, you can change the SysML instance slot value or block (default) value in MagicDraw and sync to MySQL by right-clicking the appropriate connection and selecting Sync Source → Target.

  • No labels