Creating SysML – Teamcenter Mappings.

The new learning objective of this exercise is to create new SysML_Teamcenter mappings for Data Map and Model Transform connections. This is intended for an advanced user who will create new mappings that will be used by other members of the organization.

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.2 installed as a plugin for Rhapsody with a valid license for use
  • Syndeia Teamcenter interface, correctly installed with a valid license for user
  • Syndeia Mappings license, to modify syndeia.mappings file from the Syndeia dashboard

We will use the provided Rhapsody project Syndeia_Teamcenter_Mapping_Tutorial.rpy. The user can use any Teamcenter repository they have available with the ability to create and edit items within a Teamcenter Bill-of-Materials.  It is generally advisable to carry out these exercises in a non-production repository, a “sandbox”, set up for training and practice purposes.

Using mapping in Syndeia requires two new elements which are provided with these tutorials

  • A mappings file, syndeiaTutorial_Rh.mappings, which contains the specific starting mappings used in this and the following exercises. To install this,
  1. Close Rhapsody, if it is open
  2. Rename the existing syndeia.mappings file in the .syndeia folder to something like syndeiaOld.mappings
  3. Copy syndeiaTutorial_Rh.mappings into the .syndeia folder
  4. Rename syndeiaTutorial_Rh.mappings as syndeia.mappings
  5. When you have completed the mapping tutorial exercises, you may want to reverse this process to restore the original mappings file.
  • A mappings profile, SyndeiaTutorialMapping.sbs, which is loaded into a TutorialMappingProfile folder in the profiles folder of Syndeia installation:
    C:\Users\<account>\<Rhapsody installation> \Share\Profiles\Syndeia\profiles\.

Any Syndeia user can use or view the mapping specifications, but Syndeia requires a special license in addition to the regular Syndeia license in order to create, modify or delete mapping information. It is good practice to confine this duty to a very limited number of experienced users or system administrators, who will provide mappings for the general users. Some mappings require a special SysML stereotype to correctly transform attributes to or from a SysML element, so each mappings file should be paired with a SysML profile that holds the required stereotypes, as we have done here.

Many organizations customize their Teamcenter installation, creating new artifact and relationship types for their purposes. This tutorial exercise uses common artifact types in a standard Teamcenter installation, but you may need to adapt the instructions if these artifact types are not available to you. Prior to your doing this exercise, a user with the mapping license described above will need to register new artifact types for mapping (as described in Exercise 11.8).

Caution: Rhapsody has, by default, restrictions on the naming of SysML elements, which can create problems when Syndeia tries to create Rhapsody model elements that violate these restriction, e.g. beginning a SysML block name with a number.  We recommend modifying any Rhapsody models you create to relax these restrictions. Modify the properties of the top-level package of the model under General::Model::NamesRegExp with the following string and save.

^(([a-zA-Z0-9_][a-zA-Z0-9_ ():-]*)|(operator.+))$

Exercise

  1. Open the SysML project Syndeia_Teamcenter_Mapping_Tutorial.mrpy, right-click the Teamcenter package, and launch the Syndeia dashboard
  2. Go to the Mappings tab. The first task will be to create a new mapping using existing artifacts.
    1. Right-click SysML-Teamcenter under Mapping Groups in the left column and select Add Mapping.
    2. Initially, the window should appear similar to Figure 1.



    3. Modify the Mapping
      1. Change Name to Activity – Item (no attributes)
      2. Change Description to SysML Activity – Teamcenter Item with no attributes
      3. Change Source Artifact Type to Activity, using pull-down menu
      4. Set Target Artifact Type to Item, using pull-down menu
      5. Set Structure Level to CHILDREN_RECURSIVE, using pull-down menu
      6. Set Include Attributes to Exclude Attributes, using pull-down menu
      7. The window should look similar to Figure 2.



      8. Click Save Mapping at bottom of right side (scroll down if necessary).
  3. Use the new Mapping you just created
    1. Go to the Connection Manager tab. Open a Teamcenter repository in the right column.
    2. Drag the T2::Feature_Auto activity in the SysML model into an empty folder in Teamcenter (Demo 4 in this example).
    3. A small pull-down menu will appear on the Syndeia dashboard, as Figure 3, showing the possible mappings available for an activity dragged into Teamcenter.



    4. Select Activity – Item (no attributes) and click OK.
    5. Expand the Demo 4 folder on the right side of the Connection Manager. Check that a new set of items has been created with default attribute values assigned by Teamcenter.
  4. The second task is to create another new mapping, this one with attributes shared between the SysML and Teamcenter elements. We will use the Clone Mapping command rather Add Mapping. Clone Mapping saves time when not all features of the new mapping need to be modified.
    1. Right-click Activity – Item (no attributes) under Mapping Groups/SysML - Teamcenter in the left column and select Clone Mapping
    2. Initially, the window should appear similar to Figure 4.



    3. Modify the Mapping
      1. Change Name to Activity – Item (attributes)
      2. Change Description to SysML Activity – Teamcenter Item with attributes
      3. Keep Source Artifact Type as Activity and Target Artifact Type as Item
      4. Set Structure Level to NO_CHILDREN, using pull-down menu
      5. Set Include Attributes to Include Attributes, using pull-down menu
      6. At the bottom of the right side, click the + sign box under the Stereotypes table.
      7. A Select stereotype window will open. The window should look similar to Figure 5.



      8. Select TC_Feature. This choice will appear in the Stereotype box on the right.
      9. Scroll up to Attribute Definition Mappings
      10. Click Retrieve Available Attribute Definitions
      11. Click the + box below the Attribute Definition Mappings box.
      12. In the new row, select item_id on the right (Target) side of the table, using the pull-down menu
      13. In the new row, select id [owner: Stereotype (TC_Feature)] on the left (Source) side of the table.
      14. Repeat steps xi through xiii for object_type to type and Gov Classification to info. The final table should look like Figure 6.



      15. Click Save Mapping at bottom of right side (scroll down if necessary).
  5. Use the cloned Mapping you just created
    1. Go to the Connection Manager tab. Open the Teamcenter repository you used above in the right column.
    2. Drag the Feature_AutoInit Teamcenter item created earlier into the empty SysML T4
    3. A small pull-down menu will appear on the Syndeia dashboard, as in Figure 7, showing the possible mappings available for an item dragged into SysML.



    4. Select Activity – Item (attributes) and click OK.
  6. A new activity (named Feature_AutoInit) should appear under T4 on the SysML side. It will have the <<Intercax_artifact>> stereotype in addition to Activity and all the tag values associated with that stereotype. However, only the id and type attributes mapped in the Activity – New Item (attributes) mapping have been populated in the SysML element from the Teamcenter item (see Figure 8).


    Note that SysML activities do not normally have any place to receive the Teamcenter attributes. Because the <<TC_Feature>> stereotype (which is applicable to Activity Diagrams in Rhapsody) was chosen in the new mapping definition, the new activity was created with that additional stereotype and tag values ready to receive the desired Teamcenter attributes.

  7. Modify the new SysML activity to demonstrate compare and sync features of mapped attributes.
    1. In SysML, add a value (e.g. USA) to the info tag using the Features window.
    2. In the Syndeia dashboard, Connection Browser tab, find the connection from T4::Feature_AutoInit to Teamcenter (Figure 9). Right-click this row and select Compare Source & Target.



    3. The Comparison Result tab will show the differences between the SysML and Teamcenter models (Figure 10). The difference table shows that the SysML model has a value for the info attribute and the Teamcenter item does not.



    4. Return to the Syndeia dashboard, Connection Browser tab, and the connection from T4::Feature_AutoInit to Teamcenter (Figure 9). Right-click this row and select Sync Source to Target.



    5. Repeat the comparison and see that all differences have been resolved by updating the govClass attribute in the Teamcenter item.