Main Content

slreq.callback.ReqIFImportOptions Class

Namespace: slreq.callback

ReqIF import options

Since R2022a

Description

Use objects of the slreq.callback.ReqIFImportOptions class to adjust the options to use when import requirements. When you import requirements from a ReqIF™ file, slreq.getCurrentImportOptions generates an slreq.callback.ReqIFImportOptions object that you can use to adjust the options to use during import. You can only access this object in the PreImportFcn callback.

The slreq.callback.ReqIFImportOptions class is a handle class.

Creation

options = slreq.getCurrentImportOptions returns an slreq.callback.ReqIFImportOptions object if you are importing requirements from a ReqIF file.

Properties

expand all

Attribute mapping file to use during import, specified as a string scalar or character vector. Specify the full file path for the file.

Attributes:

GetAccess
public
SetAccess
public

Attribute mapping from ReqIF attributes to Requirements Toolbox™ properties, specified as a containers.Map object. For example, this code creates a containers.Map object that maps:

attrMap = containers.Map(ReqSum="Summary");
attrMap("Desc") = "Description";
attrMap("ID") = "Custom ID";

Example: myImportOptions.Attr2ReqProp = attrMap;

Attributes:

GetAccess
public
SetAccess
public

Name of the single specification to import from the ReqIF file, specified as a string scalar or character vector. If the ReqIF file has multiple specifications, only this specification is imported.

Attributes:

GetAccess
public
SetAccess
public

Option to import each specification into separate requirement sets, specified as a 1 or 0 of data type logical.

If your ReqIF file has multiple specifications and you set this property to 0, the specifications are combined into one requirement set.

Attributes:

GetAccess
public
SetAccess
public

Option to import the links from the ReqIF file, specified as a 1 or 0 of data type logical.

Attributes:

GetAccess
public
SetAccess
public

Option to allow Requirements Toolbox to automatically detect the attribute mapping to use based on the contents of the ReqIF file, specified as a 1 or 0 of data type logical.

Attributes:

GetAccess
public
SetAccess
public

Option to import as slreq.Reference objects, specified as a 1 or 0 of data type logical. If 0, requirements import as slreq.Requirement objects.

Attributes:

GetAccess
public
SetAccess
public

Option to import requirements with rich text, specified as a 1 or 0 of data type logical.

Attributes:

GetAccess
public
SetAccess
public

Resource identifier for external requirements document, specified as a string scalar or character vector.

Attributes:

GetAccess
public
SetAccess
public

Requirements document custom link type, returned as a string scalar or character vector.

Attributes:

GetAccess
public
SetAccess
private

Requirement set name, returned as a character vector.

Attributes:

GetAccess
public
SetAccess
private

Contents of the PreImportFcn callback for the current Import node, specified as a string scalar or a character vector.

Attributes:

GetAccess
public
SetAccess
public

Contents of the PostImportFcn callback for the current Import node, specified as a string scalar or a character vector.

Attributes:

GetAccess
public
SetAccess
public

Examples

collapse all

This example shows how to customize ReqIF™ import options by using the PreImportFcn callback.

Use slreq.import to import the ReqIF™ file mySpec.reqif into Requirements Toolbox™. Name the imported requirement set myReqSet and register the script myPreImportScript as the PreImportFcn callback to use during import. Return a handle to the requirement set.

[~,~,rs] = slreq.import("mySpec.reqif",ReqSet="myReqSet",preImportFcn="myPreImportScript");

The script myPreImportScript uses slreq.getCurrentImportOptions to get the import options, then specifies the attribute mapping file to use during import.

type myPreImportScript.m
importOptions = slreq.getCurrentImportOptions;
importOptions.MappingFile = "myMappingFile.xml";

Return the importOptions object.

importOptions
importOptions = 
  ReqIFImportOptions with properties:

          MappingFile: "myMappingFile.xml"
         Attr2ReqProp: []
           SingleSpec: ''
    AsMultipleReqSets: 0
          ImportLinks: 1
    AutoDetectMapping: 1
          AsReference: 1
             RichText: 0
               DocUri: 'C:\Users\jdoe\MATLAB\Examples\CustomizeReqIFImportOptionsExample\mySpec.reqif'
              DocType: 'REQIF'
               ReqSet: 'myReqSet'
         PreImportFcn: 'myPreImportScript'
        PostImportFcn: ''

Version History

Introduced in R2022a