Hauptinhalt

slreq.import

R2026b

Import requirements from external documents

Description

Requirement Files

[refCount,filePath,reqSetObj] = slreq.import(filePath) imports requirements from the requirement file specified by filePath. The requirements import as referenced requirements in a new requirement set that has the same name as the file.

example

[refCount,filePath,reqSetObj] = slreq.import(docInterfaceName) imports requirements from the currently open document in the third-party tool specified by docInterfaceName.

example

[refCount,filePath,reqSetObj] = slreq.import(___,Name=Value) imports requirements using options specified by one or more name-value arguments in addition to the input arguments in previous syntaxes.

example

IBM DOORS Next

[refCount,filePath,reqSetObj] = slreq.import("dng",Module=moduleName) imports requirements from the IBM® DOORS® Next module specified by moduleName.

Note

Before importing from IBM DOORS Next, configure the session before importing by using slreq.dngConfigure.

example

[refCount,filePath,reqSetObj] = slreq.import("dng",Query=queryString) imports requirements from the IBM DOORS Next project that match the query specified by queryString.

example

Examples

collapse all

Import the referenced requirements from a Microsoft® Word document called myRequirementSpec.docx. The function returns the number of imported requirements, the path to the requirement set file, and the requirement set object.

[count,filePath,reqSet] = slreq.import("myRequirementSpec.docx");

Import rows 3 to 150 of the spreadsheet MyExcelDoc.xlsx as rich text. Map the second column of the spreadsheet to the ID property of the requirements and the third column to the Description property of the requirements.

[count,filePath,reqSet] = slreq.import("MyExcelDoc.xlsx",rows=[3 150],...
idColumn=2,descriptionColumn=3,RichText=true);

Import the currently open IBM DOORS module.

[count,filePath,reqSet] = slreq.import("linktype_rmi_doors");

This example shows how to import requirements from an IBM DOORS Next module into a local requirement set.

First, store your IBM DOORS Next credentials using setSecret.

setSecret("dngUsername")
setSecret("dngPassword")

Set the server address, name of the requirements management root, and username by using rmiprefa.

rmipref("OslcServerAddress","https://your-dng-server.example.com:9443");
rmipref("OslcServerRMRoot","rm");
rmipref("OslcServerUser",char(getSecret("dngUsername")));

Configure the DNG session by specifying the project name, configuration context, and password.

slreq.dngConfigure("My Project","My Project Initial Stream",false,getSecret("dngPassword"))

Import the requirements from the System Requirements module.

[count,filePath,reqSet] = slreq.import("dng",Module="System Requirements");

Check the number of requirements that imported, then save the requirement set.

count
count =

   124
save(reqSet)

Input Arguments

collapse all

Path to the requirement file, specified as a string scalar or character vector. You can specify the path to Microsoft Word, Microsoft Excel®, and ReqIF™ files.

Name of the registered document interface to use to integrate with third-party applications, specified as one of these options:

"linktype_rmi_doors"

Import from IBM DOORS

"linktype_rmi_word"

Import from Microsoft Word

"linktype_rmi_excel"

Import from Microsoft Excel

string scalar or character vector that specifies a custom document interface nameImport from a third-party application that Requirements Toolbox™ does not provide built-in support for. For more information, see Define Custom Document Interface for Importing Requirements.

Example: slreq.import("linktype_rmi_doors")

IBM DOORS Next module name, specified as a string scalar or character vector.

Example: Module="System Requirements"

Query to use to filter the requirements from the IBM DOORS Next project, specified as a string scalar or character vector. Define the query using an oslc.where clause with properties from the dcterms or oslc_rm namespaces. For more information, see OSLC Query 3.0 on the OASIS Open website.

Example: Query="dcterms:title='Enabling cruise control'"

Name-Value Arguments

expand all

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.

Example: slreq.import(filePath,AsReference=true) imports the requirements in the file located at filePath as reference requirements.

General Options

expand all

Option to import requirements as referenced requirements, specified as a true or false.

To import the requirements as referenced requirements, set the value to true. Use this option if you want to continue to manage the requirements in a third-party tool. To import the requirements as slreq.Requirement objects set the value to false. Use this option to migrate the requirements to Requirements Toolbox. For more information, see Select an Import Mode.

Example: AsReference=true

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 by the attributeColumn argument.

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

External requirements document identifier, specified as a string scalar or character vector.

Tip

When importing from IBM DOORS, use the DocID argument to specify the module ID.

Example: DocID="0000abcd"

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. For more information, see Use Callbacks to Customize Requirement Import Behavior.

Example: preImportFcn="myPreImportScript"

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. For more information, see Use Callbacks to Customize Requirement Import Behavior.

Example: postImportFcn="myPostImportScript"

Name of the requirement set to import requirements into, specified as a string scalar or 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 true or false. To import rich text requirements, set RichText to true.

Example: RichText=true

Options for Microsoft Word

expand all

Option to import requirements content using user-defined bookmarks, specified as numeric or logical 1 (true) or 0 (false).

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

Example: bookmarks=false

Regular expression pattern for ID search in Microsoft Office documents, specified as a string scalar or character vector.

Example: match="^REQ\d+"

Options for Microsoft Excel

expand all

Range of columns in the Microsoft Excel spreadsheet to map as custom attributes of the requirements in your requirement set, specified as a double array.

Example: attributeColumn=[4 6]

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

Example: columns=[1 6]

Column in the Microsoft Excel spreadsheet 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 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 to map to the ID property of the requirements in your requirement set, specified as a double.

Example: idColumn=1

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

Example: keywordsColumn=3

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

Example: modifiedByColumn=6

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

Example: rationaleColumn=5

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

Example: rows=[3 35]

Name of worksheet to import from Microsoft Excel workbook, specified as a string scalar or character vector.

Example: sheet="Sheet1"

Column in the Microsoft Excel spreadsheet 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: USDM="RQ -" will match entries with IDs similar to RQ01, RQ01-2, RQ01-2-1 etc.

Regular expression pattern for ID search in Microsoft Excel spreadsheets, specified as a string scalar or character vector.

Example: match="^REQ\d+"

Options for ReqIF Files

expand all

ReqIF attribute mapping, specified as a containers.Map object.

Example: attr2reqprop=attrMap

Option to import links when importing requirements from ReqIF files, specified as true or false.

Example: importLinks=true

Path of the attribute mapping file, specified as a string scalar or character vector.

Example: mappingFile="D:/reqifmapping/myMapping.xml"

Name of the 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 the profile and assigns the profile to the imported requirement set and link set. If a profile with this name exists, the software assigns the profile to the imported requirement set and link set.

Example: profile="myProfile"

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

The profile mapping file specifies how ReqIF requirement, 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"

Options for IBM DOORS and Custom Document Types

expand all

Name of the attribute from the external document to map to the Keywords property for the imported requirements, specified as a string scalar or character vector.

Example: keywords="Requirement Keywords"

Name of the attribute from the external document to map to the Rationale property for the imported requirements, specified as a string scalar or character vector.

Example: rationale="Requirement Rationale"

Output Arguments

collapse all

Number of imported reference requirements, returned as a double.

Path of the requirement set file that contains imported requirements, returned as a character vector.

Requirement set to which you import requirements, returned as an slreq.ReqSet object.

Limitations

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

Tips

  • You can use callbacks to execute code when you import or update requirements. For more information, see Use Callbacks to Customize Requirement Import Behavior.

  • If slreq.import returns an error when you import a ReqIF file, check that the file meets the ReqIF specification by using the slreq.validateReqIF function. Use a third-party requirements management tool to fix the warnings and errors, create a new ReqIF file, then import the file again.

Version History

Introduced in R2018a

expand all