Importing from the command-line interface is useful when you want to import files automatically, e.g., once a day at midnight.

 

To import a ReqIF file from the command-line interface


  1. Open the Command Prompt window
  2. Go to the <model editor installation directory>/plugins/com.nomagic.requirements directory containing the reqifimport.exe file.
  3. At the command prompt, type the following command and specify the values of the required arguments:
    reqifimport project_descriptor=<project URL> reqif_file=<path to ReqIF file> owner=<element hyperlink or qualified name>

    Where:

    • project_descriptor is the URL of a project.

      1. Start your modeling tool and open the required project.
      2. In the main menu, go to File > Project Properties and select the General tab.
      3. Find the project descriptor specified in the Project Descriptor box at the bottom of the Project Properties dialog and copy it to the clipboard.
    • reqif_file is the path to the ReqIF file you want to import.

      If there is a space in a path, surround the argument and its value with escaped quote (\").

    • owner is the hyperlink or qualified name of the owner element. If newly imported elements are not contained by the Specification element, they are placed under the specified owner. Note that the owner argument is optional.

      1. Start your modeling tool and open the required project.
      2. In the Containment tree, right-click an element and select Copy Element Hyperlink.

      The hyperlink of the element is now copied to the clipboard.

  4. Press Enter.

Now after opening the project you have imported the ReqIF file into, the imported data is already present in the Containment tree of the project.
 

Using a properties file

To make importing from the command-line interface quicker you can specify arguments in a properties file, which can be easily edited or reused.

 

To import a ReqIF file from the command-line interface using a properties file


  1. Create a properties file and specify the values of the following arguments:
    • project_descriptor
    • reqif_file
    • owner
       

    See the example of a properties file below.

    project_descriptor=file:/C:/Users/johnsmith/Downloads/MagicDraw_185/samples/requirements/MagicLibrary%20requirements.mdzip
    #
    # Specify the project URL.
    # To get a project descriptor, open a project and in the main menu go to File > Project Properties > General.
    #
    reqif_file=C:/Users/johnsmith/Documents/project_requirements.reqif
    #
    # Specify the path to the ReqIF file.
    # NOTE: If there is a space in a path, surround the argument and its value with escaped quote (\").
    #
    owner=mdel://eee_1045467100313_135436_1
    #
    # Specify the hyperlink or qualified name of the owner element. 
    # To get the hyperlink of an element, open a project, right-click the element in the Containment tree and select "Copy Element Hyperlink".
    # NOTE: This argument is optional.
    #

    When creating a properties file on Windows OS, use only / or \\ as a path separator, otherwise the command will fail.

  2. Open the Command Prompt window.
  3. Go to the <model editor installation directory>/plugins/com.nomagic.requirements directory containing the reqifimport.exe file.
  4. At the command prompt, type the following command and specify the value of the properties_file argument.

    reqifimport properties_file=<path to properties file>

    Where properties_file is the path to the properties file to be used.

  5. Press Enter.

Now after opening the project you have imported the ReqIF file into, the imported data is already present in the Containment tree of the project.