Main Content

slreq.import

Import requirements from external documents

Description

slreq.import(docPath) imports requirements content as referenced requirements from an external document located at docPath. The imported requirements are saved in a new requirement set with the same name as the external document. Use this import method to import requirements content from Microsoft® Office documents and from files in the Requirements Interchange Format (.reqif and .reqifz).

[refCount, reqSetFilePath, reqSetObj] = slreq.import(docPath) imports requirements content as referenced requirements from an external document located at docPath and returns the number of references imported refCount. The imported requirements are saved in the requirement set reqSetObj located at reqSetFilePath with the same name as the external document.

slreq.import(docType) imports requirements content as referenced requirements from an external document that is of a registered document type docType. The imported requirements are saved in a new requirement set with the same name as the external document.

slreq.import(docPath,Name,Value) imports requirements content as referenced requirements from an external document located at docPath with options specified by one or more Name, Value pair arguments.

slreq.import(reqifFile) imports requirement content from the ReqIF file reqifFile using a pre-configured attribute mapping.

slreq.import(reqifFile, 'mappingFile', mapFilePath) imports requirement content from the ReqIF file reqifFile using the attribute mapping specified by mapFilePath.

slreq.import('clearcache') cleans up temporary HTML files that are created when importing rich text requirements.

Examples

Import Referenced Requirements

% Import referenced requirements from Microsoft Office documents
slreq.import('Specification002.docx');
slreq.import('D:/Projects/Requirements/Safety321.xlsx');

% Import referenced requirements from an IBM DOORS Module
slreq.import('linktype_rmi_doors');

For more information on importing referenced requirements from third-party applications, see Import Requirements from Third-Party Applications.

Input Arguments

collapse all

The file path of the external requirements document, specified as a character vector.

The document type of the external requirements document, specified as a character vector.

Example: 'linktype_rmi_doors'

The file path of the ReqIF file, specified as a character vector.

The file path of the attribute mapping file, specified as a character vector.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'ReqSet','design_specs.slreqx'

Option to import requirements as referenced requirements, specified as a Boolean value.

To continue to manage the requirements in a third-party tool, import the requirements as referenced requirements by setting the value to true or using the default value. To migrate the requirements to Requirements Toolbox™, import the requirements as slreq.Requirement objects by setting the value to false. For more information, see Select an Import Mode.

Import from ReqIF format, specifying the attribute mapping as a comma-separated pair consisting of 'attr2reqprop' and a containers.Map object. For example:

attrMap = containers.Map('KeyType','char','ValueType','char')
attrMap('SourceID') = 'Custom ID'; % Built-in attribute
attrMap('ReqIF.ChapterName') = 'Summary'; % Built-in attribute
attrMap('Data Class') = 'MyDataClass'; % Custom attribute

slreq.import('myfile.reqif','attr2reqprop',attrMap);

Example: slreq.import('myfile.reqif','attr2reqprop',attrMap);

Column in the Microsoft Excel® spreadsheet that you want to map as custom attributes of the requirements in your requirement set, specified as a double array.

Example: 'attributeColumn',[4 6]

Attribute names for custom attribute columns, specified as a cell array of character vectors.

Note

When importing requirements from a Microsoft Excel spreadsheet, the length of this cell array must match the number of columns specified for import using the attributeColumn argument.

Example: 'attributes',{'Test Status','Test Procedure'}

Option to import requirements content using user-defined bookmarks, specified as a 1 or 0 of data type logical.

By default, Requirements Toolbox sets the value to 1 for Microsoft Word documents and 0 for Microsoft Excel spreadsheets.

Example: 'bookmarks',false

Range of columns to import from Microsoft Excel spreadsheet, specified as a double array.

Example: 'columns',[1 6]

Column in the Microsoft Excel spreadsheet that you want to map to the CreatedBy property of the requirements in your requirement set, specified as a double.

Example: 'createdByColumn',5

Column in the Microsoft Excel spreadsheet that you want to map to the Description property of the requirements in your requirement set, specified as a double.

Example: 'descriptionColumn',2

Column in the Microsoft Excel spreadsheet that you want to map to the ID property of the requirements in your requirement set, specified as a double.

Example: 'idColumn',1

Option to import links when importing requirements from ReqIF files, specified as a Boolean value.

Example: importLinks=true

Name of the attribute from the external document that you want to map to the Keywords property for the imported requirements.

Use this argument when you import from IBM® DOORS® or custom document types.

Example: "keywords","Requirement Keywords"

Column in the Microsoft Excel spreadsheet that you want to map to the Keywords property of the requirements in your requirement set, specified as a double.

Example: 'keywordsColumn',3

Regular expression pattern for ID search in Microsoft Office documents.

Example: 'match','^REQ\d+'

Column in the Microsoft Excel spreadsheet that you want to map to the ModifiedBy property of the requirements in your requirement set, specified as a double.

Example: 'modifiedByColumn',6

Custom post-import callback script name to use during import, specified as a string scalar or character vector.

The script that you assign to this callback executes after you import or update requirements.

Example: "postImportFcn","myPostImportScript"

Custom pre-import callback script name to use during import, specified as a string scalar or character vector.

The script that you assign to this callback executes before you import or update requirements.

Example: "preImportFcn","myPreImportScript"

Name of profile to use when importing requirements and links from ReqIF files, specified as a string scalar or character vector.

If a profile with this name does not exist, the software creates it and assigns it to the imported requirement set and link set. If a profile with this name exists, the software assigns it to the imported requirement set and link set.

Example: profile="myProfile"

Name of the profile mapping file to use when importing requirements and links from ReqIF files, specified as a string scalar or character vector.

The profile mapping XML file specifies how ReqIF requirement and link types and attributes map to Requirements Toolbox stereotypes and stereotype properties. To use this argument, you must also specify the profile to assign to the imported requirement set and link set by using the profile argument.

Tip

You can create a profile mapping file from a requirement set that has a profile mapping by using the saveProfileMapping method.

Example: profileMapping="myMapping.xml"

Name of the attribute from the external document that you want to map to the Rationale property for the imported requirements.

Use this argument when you import from IBM DOORS or custom document types.

Example: "rationale","Requirement Rationale"

Column in the Microsoft Excel spreadsheet that you want to map to the Rationale property of the requirements in your requirement set, specified as a double.

Example: 'rationaleColumn',5

The name for the requirement set that you import requirements into, specified as a character vector.

If the requirement set exists, the requirements import under a new Import node. If the requirement set does not exist, Requirements Toolbox creates it.

Example: 'ReqSet','My_Requirements_Set'

Option to import requirements as rich text, specified as a Boolean value.

Example: 'RichText',true

Range of rows to import from Microsoft Excel spreadsheet, specified as a double array.

Example: 'rows',[3 35]

Worksheet name from Microsoft Excel workbook, specified as a character vector.

Example: 'sheet','Sheet1'

Column in the Microsoft Excel spreadsheet that you want to map to the Summary property of the requirements in your requirement set, specified as a double.

Example: 'summaryColumn',4

Import from Microsoft Excel spreadsheets specified in the USDM (Universal Specification Describing Manner) standard format. Specify values as a character vector with the ID prefix optionally followed by a separator character.

Example: 'RQ -' will match entries with IDs similar to RQ01, RQ01-2, RQ01-2-1 etc.

Output Arguments

collapse all

Number of referenced requirements imported, returned as a double.

The file path of the requirement set to which you import requirements to, returned as a character vector.

Handle to the requirement set to which you import requirements to, returned as an slreq.ReqSet object.

Limitations

  • MATLAB® Online™ does not support importing requirements from Microsoft Word, Microsoft Excel, or IBM DOORS documents.

Tips

Version History

Introduced in R2018a

expand all