CSV Import Plugin 18.4 Documentation

Skip to end of metadata
Go to start of metadata

The CSV Import plugin is designed to convert textual data into model elements and attributes. The correctness of your MagicDraw project depends on how accurately the elements have been mapped to their properties. Incorrect mapping might not result in errors but will always result in incorrect content. Successful mappings can be attributed to how you map the following elements correctly.

Key Property

The Key property specifies the unique key and ensures data uniqueness. Mostly this is mapped to name attribute. Thus, instead of creating duplicate elements, the existing element will get updated when you import data.

Owner Attribute

The Owner attribute can be mapped like any other attribute. If you do not map it, then the package you have selected to import into becomes the owner of the element you are creating. If you do map it, then the owner attribute specifies the owner and not the selected package. 

Find owner by the "Id" tag  

CSV Import, by default, uses the name of an element to find its owner. 

However, this version onwards, the owner can also be referred to by its Id property, so users can now form a hierarchy of elements by referring to the Id of the parent element instead of its name. 

This functionality is enabled when importing SysML objects or any element type with an Id tag, like a requirement, for example, and the Find owner by the "Id" tag checkbox will be automatically displayed on the CSV import wizard's mapping step. 

If the Find owner by the "Id" tag checkbox is checked, CSV Import plugin will find the owner of an element using its Id property. If the Find owner by the "Id" tag checkbox is unchecked, CSV Import plugin will find the owner of an element using its name property. This is the default. 

Let us take a sample scenario. Take the following CSV file as an example. We will import requirements and their respective owners in a two stage process.

 

Sample CSV file used in this example  

 

 

 

 

The first stage: How to Import SysML requirements from this CSV file do the following 


  1. From MagicDraw main menu, choose File > New Project, and then choose SysML project.
  2. Next, go to File > Import From > Import CSV. The CSV Import plugin wizard will open as shown below.

    CSV Import Plugin wizard interface - the setup screen

    Figure 1: CSV Import Plugin wizard interface - the setup screen
  3. Click Choose File to browse and locate your CSV file. Choose Model as the Target PackageClass as Target Element Type, and Requirement as Target Stereotype. Click Next.

    The CSV Import Plugin wizard interface - the mapping screen
    Figure 2: The CSV Import Plugin wizard interface - the mapping screen.
  4. Map the OwnerName column to the name property. Similarly, map the OwnerID to the id property. Set the Id property to be the Key Property by clicking the Add button on bottom right.
  5. Click Finish. The imported requirements are shown below in the Containment tree. 
 
Figure 3: Imported objects in the containment tree.

The second stage: How to Import SysML requirements to their respective owners, do the following 


  1. Click File > Import From > Import CSV. The CSV Import plugin wizard will open.
  2. Click Choose File to browse and locate your CSV file. Choose Model as the Target PackageClass as Target Element Type, and Requirement as Target Stereotype. Click Next.
  3. This step can be accomplished in two ways, either by checking the Find owner by the "Id" tag or by leaving it unchecked. Both ways will yield the same result.
    Either,
    (i)  Map the Requirement column from the CSV file to the name property and map the OwnerName column to the owner property and leave the Find owner by the "Id" tag checkbox, unchecked.
    Or,        
    (ii) Map the Requirement column from the CSV file to the name property and map the OwnerID column to the id property, and OwnerName column to the owner property, and check the Find owner by the "Id" checkbox.
  4. Click Finish. The result of the import operation is shown below. A hierarchy of requirement elements have been imported into their respective owners.

    The imported hierarchy of elements
    Figure 4: The imported hierarchy of elements

Creating Relationships

When creating Relationships, the plugin will expect you to provide the source and target. This is expected, since relationships usually have two ends. To handle this the UI is slightly enhanced while importing Relationships, see the Mappings screen in subsequent sections. In addition to the regular Key Property option, there is an additional Identifier Key for Relation Ends option. Identifier key for Relation Ends has two radio buttons to let you choose either Name or Other property to apply to the ends of the relationship.

Identifier Key for Relation Ends options will appear on the Mappings screen only when you select any relation type as the target element type from the setup screen of the CSV Import wizard.

On this page

  • No labels