Main Content

Import Requirements from IBM Rational DOORS by using the API

This example shows you how to import requirements from an IBM® Rational® DOORS® module by using the Requirements Toolbox™ API.

Configure IBM Rational DOORS

To interface with IBM Rational DOORS, configure MATLAB®. At the MATLAB command prompt, enter:

rmi setup doors

For more information, see Configure IBM Rational DOORS Session.

Open the DOORS Project

In this example, you will use the DemoRMI.dpa project in IBM Rational DOORS, which contains requirements modules that describe a fault-tolerant control system.

In IBM Rational DOORS, create a new project:

  1. Select File > New > Project.

  2. In the New Project dialog, enter ExampleProject in the Name field.

  3. In the Description field, enter Example MATLAB/Simulink project.

  4. Select Use a project archive.

  5. Click Browse and select DemoRMI.dpa.

Import a Requirements Module

In this example, you will import all of the requirements from the FuelSys Requirements Specification module.

In IBM Rational DOORS, open the FuelSys Requirements Specification module and find the module ID. For more information, see How to identify the unique ID for an item in DOORS database explorer on the IBM website.

Use slreq.import to import the module. Enter the name of the requirement set file, specify that the requirements are referenced requirements and should use Rich Text Formatting, name the requirement set fuelSysReqSpec, and enter the module ID. The function returns the number of imported referenced requirements, the requirement set file path, and the requirement set object.

[refCount1,reqSetFilePath1,myReqSet1] = slreq.import("linktype_rmi_doors", ...
    AsReference=true,RichText=true,ReqSet="fuelSysReqSpec",DocID="000001c1")
Importing from 000001c1 of type linktype_rmi_doors ..
.. done.
refCount1 = 59
reqSetFilePath1 = 
'C:\Users\jdoe\MATLAB\Examples\ImportRequirementsFromIBMRationalDOORSByUsingTheAPIExample\fuelSysReqSpec.slreqx'
myReqSet1 = 
  ReqSet with properties:

             Description: ''
                    Name: 'fuelSysReqSpec'
                Filename: 'C:\Users\jdoe\MATLAB\Examples\ImportRequirementsFromIBMRationalDOORSByUsingTheAPIExample\fuelSysReqSpec.slreqx'
                Revision: 1
                   Dirty: 1
    CustomAttributeNames: {}
               CreatedBy: 'ahoward'
               CreatedOn: NaT
              ModifiedBy: 'ahoward'
              ModifiedOn: 08-Sep-2021 09:18:37

Import a Subset of Requirements from a Module

You can import a subset of requirements from the FuelSys Design Description module by appling a filter. Open the FuelSys Design Description module in IBM Rational DOORS.

Filter the Requirements Module

Apply a filter to the module. For more information on applying a filter to a requirements module, see Defining filters on the IBM website. In the Filtering dialog:

  1. Set Attribute to Absolute Number.

  2. Set Condition to is less than or equal to.

  3. Next to Value, enter 10.

The module displays only requirements that match the filter.

When you apply a filter to your DOORS module and import the module to Requirements Toolbox, the process imports only the requirements that match the filter. When you import requirements by using the API, Requirements Toolbox does not store the filter for future use.

Import the Filtered Requirements Module

To import the filtered requirements module, use slreq.import. Enter the name of the requirement set file, specify that the requirements are referenced requirements and should use Rich Text Formatting, name the requirement set fuelSysDesignSpec, but don't enter the module ID. If you don't specify the module ID, the slreq.import function imports the active requirements module.

The module contains a requirements attribute called Created Thru. Import the attribute along with the requirements as a custom attribute. The function returns the number of imported referenced requirements, the requirement set file path, and the requirement set object.

[refCount2,reqSetFilePath2,myReqSet2] = slreq.import("linktype_rmi_doors",ReqSet="fuelSysDesignSpec",attributes={'Created Thru'})
Importing from FuelSys Design Description of type linktype_rmi_doors ..
 done.
refCount2 = 10
reqSetFilePath2 = 
'C:\Users\jdoe\MATLAB\Examples\ImportRequirementsFromIBMRationalDOORSByUsingTheAPIExample\fuelSysDesignSpec.slreqx'
myReqSet2 = 
  ReqSet with properties:

             Description: ''
                    Name: 'fuelSysDesignSpec'
                Filename: 'C:\Users\jdoe\MATLAB\Examples\ImportRequirementsFromIBMRationalDOORSByUsingTheAPIExample\fuelSysDesignSpec.slreqx'
                Revision: 1
                   Dirty: 1
    CustomAttributeNames: {'Created Thru'}
               CreatedBy: 'ahoward'
               CreatedOn: NaT
              ModifiedBy: 'ahoward'
              ModifiedOn: 08-Sep-2021 09:20:30

Requirements Toolbox imports only the first 10 requirements from the module and maps the Created Thru attribute to a new custom attribute in the requirement set.

If you have custom attributes that you want to import as the built-in requirement properties Rationale or Keywords, you can use:

slreq.import("linktype_rmi_doors",keywords="Keyword DOORS Attribute",rationale="Rationale DOORS Attribute")

For more information about custom attributes, see Add Custom Attributes to Requirements.

Update the Filtered Requirement Set

After you import the requirement set, you can update it. For more information, see Update Imported Requirements.

In DOORS, change the applied filter in the FuelSys Design Description module.

In the Filtering dialog:

  1. Set Attribute to Absolute Number.

  2. Set Condition to is less than or equal to.

  3. Next to Value, enter 15.

Find the Import node from the requirement set myReqSet2. Update the requirement set.

importNode = find(myReqSet2,Index="Import1");
status = updateFromDocument(importNode)
Importing from FuelSys Design Description of type linktype_rmi_doors ..
 done.
status = 
'Update completed. Refer to Comments on Import1.'

Requirements Toolbox amends the requirement set to contain the first 15 requirements.

In your DOORS requirements module, update the filter again. For Value, enter 5. Find the Import node from the requirement set myReqSet2. Update the requirement set.

importNode = find(myReqSet2,Index="Import1");
status = updateFromDocument(importNode)
Importing from FuelSys Design Description of type linktype_rmi_doors ..
 done.
status = 
'Update completed. Refer to Comments on Import1.'

Requirements Toolbox truncates the requirement set to only contain the first 5 requirements.

Cleanup

Clear the open requirement sets.

slreq.clear;

See Also

|

Related Topics