By: Hannah Hammond-Scott – Project Engineer
Reqtify is a tool for managing requirements, enabling traceability and impact analysis across the entire development lifecycle of a project. Reqtify links requirements to the development, verification and validation process whatever the requirement source.
Reqtify interfaces with information from a wide variety of tools. One of the most common sources of requirement-related information is Microsoft Word documents. Reqtify can access the requirement information, regardless of the Word document format, due to the user’s ability to customise the Word Type.
What is a Type in Reqtify?
To interface with so many sources of information, Reqtify follows the process illustrated below. Dassault Systèmes provide converters which generate intermediate files, either ASCII text or XML files, from the information source. The customisable Types are then used to extract and analyse the data contained in the intermediate file into the Reqtify environment.
Figure 1: Reqtify process for inputting and using requirement-related information
A list of the tools and information sources that Reqtify can interface with can be found at Reqtify Features – Interfaces to Engineering Tools. Reqtify includes example Types to extract data from all these sources.
For Word documents the intermediate file created is an ASCII text file. The Word Type uses Regular Expressions to search through this intermediate file to identify the information to extract into Reqtify. The example Word Type looks for the formatting styles applied to the text in Word to identify requirements.
For the Word Type to work correctly, the formatting styles used in the Word document need to have the same names as those in the Type. However, you can create a customised version of the Word Type to work with the existing content and formatting of the Word document, rather the other way around.
Figure 2: The Word Type example delivered with Reqtify in the Type Editor
How to Customise the Word Type
To illustrate customising the Word Type, we will look at a project based on the Getting Started example supplied with Reqtify. It contains three Word documents and uses the standard Word Type to identify the information of interest in the files.
Figure 3: Getting Started example containing Word documents
Step 1 – Duplicate the Word Type
Open the Configuration Editor by selecting the Edit Project button in the toolbar.
Navigate to the Types editor where you can see the list of Types available. Expand the Office section, select the Word Type and click the Duplicate button from the toolbar at the bottom. This adds a new folder to the list using your project name, containing the duplicate Type. Rename the Type to something appropriate.
Figure 4: Duplicating the Word Type in the Configuration Editor
Step 2 – Creating an Intermediate File for Testing
Intermediate files are usually automatically deleted after analysis. So to test changes to the Type you must deliberately store the intermediate file.
Go to the Project editor in Configuration Editor, which shows the documents in the project and how they are related. In the Details tab, tick the checkbox in the Intermediate file column for the document of interest. Select the Apply button to generate the file.
Figure 5: Generating intermediate files
This will generate an intermediate folder in your project directory. This will contain the copies of the intermediate file that Reqtify uses, named <document name>.txt or xml.
Step 3 – Modify the Regular Expressions in the New Word Type
To demonstrate customising the Word Type we will focus on how the requirement ID number is identified. The requirement ID is one of a number of elements that can be analysed.
Figure 6: Regular Expression used to identify requirement ID number in the Word Type
The default Regular Expression, shown above, means Reqtify searches the intermediate file for:
- A line starting with Requirement_ID (formatting style applied)
- Followed by any number of tabs
- Followed by any number of characters except separators (i.e. whitespace)
- This is the requirement ID and the part that will be captured in Reqtify as it is within brackets
- Followed by any number of tabs or the end of the line
Below is a comparison of the Word document and intermediate ASCII text file for the Product Specification from the example project. In the intermediate file, the formatting style name is at the start of each line. We can see that the Regular Expression described above corresponds to the content in the requirement ID lines in the intermediate file.
Figure 7: Comparison of Word document (left) and the intermediate file (right)
The Regular Expression could be altered to search for the specific structure of the requirement ID rather than the formatting. This would be useful if you do not have control of the specific formatting styles that are used in the document.
When modifying the Regular Expression, you can test it on the intermediate file before reanalysing the entire project. Go to the Regular Expression Tester in the Configuration Editor. Open the intermediate file by going to File > Import Intermediate file… and selecting the correct file. After writing the new expression in the Regular Expression field and pressing Test, the data matching the search will be listed in the table beneath.
Figure 8: Testing Regular Expressions in Reqtify
The image above shows an example Regular Expression that could be used to identify the requirement ID without using the document format. This expression searches for:
- A line starting with any number of digits, letters or _
- Followed by any number of separators
- Followed by PS, then any number of digits/letters/_, then _REQ and then any number of digits
- This is the requirement ID and the part that will be captured in Reqtify. As shown in the column Group 1 in the image above.
For more on Regular Expressions see the References or Cheatsheet areas of http://regexr.com/.
Once a new Regular Expression has been shown to work correctly it can be copied to the new Type and applied.
Step 4 – Apply the New Word Type to the Word Document
To use the new Type, go to the Project editor of the Configuration Editor. Change the entry in Type of Analysis column to select the new Type from the dropdown list. Then Apply to reanalyse the project using the new Type. You can then close the Configuration Editor to view the effect of this change to the project.
Figure 9: Applying a new Type to a document
More Information on Reqtify Customisation
There is a guide on Reqtify customisation, covering further customisation of the Types and also the reports generated. This is available within Reqtify by going to Help > Documentation > Customization Guide. There are detailed notes on the different interfaces available, which can be found by going to Help > Coupling Notes.