Load and Resolve Links
When you open or load an artifact that has incoming or outgoing links, Requirements Toolbox™ loads the link sets that contain those links. If the link sets have registered requirement sets, the software also loads those requirement sets. Loading registered requirement sets can further load links if the requirement set has incoming or outgoing links to additional artifacts.
When you load links, the software may identify unresolved links where the source or destination item are not available. You can resolve links by loading the artifact that contains the unloaded item or by repairing the link manually.
Load Artifacts and Associated Link Sets
When you load artifacts such as requirement sets, Simulink® models, or MATLAB® code that have incoming or outgoing links, Requirements Toolbox loads the link sets that contain those links.
For example:
Open the
ShortestPath
project. At the MATLAB command line, enter this command:openExample("slrequirements/ShortestPathExample")
Open the
shortest_path_func_reqs
requirement set. At the MATLAB command line, enter:Theslreq.open("shortest_path_func_reqs");
shortest_path_func_reqs
requirement set has outgoing links to MATLAB code ranges inshortest_path.m
andgraph_unit_tests.m
.View the loaded link sets. In the Requirements Editor, click Show Links. The software loaded the link sets associated with
shortest_path.m
andgraph_unit_tests.m
.
Load Registered Requirement Sets
When you create a link to a requirement, the requirement set that contains the
requirement becomes registered to the link set. You can view the registered requirement
sets for a link set by using the getRegisteredReqSets
method.
When you load a link set that has registered requirements, Requirements Toolbox also loads those requirement sets. If those requirement sets have links to additional artifacts, the software also loads the link sets that contain those links.
For example:
Clear the loaded requirement sets and link sets by entering this command at the MATLAB command line:
slreq.clear
Open the
ShortestPath
project by entering this command at the MATLAB command line:openExample("slrequirements/ShortestPathExample")
Open the
graph_unit_tests.m
MATLAB code file. At the MATLAB command line, enter:Theedit graph_unit_tests.m
graph_unit_tests.m
file has outgoing links to requirements.View the loaded link sets. Open the Requirements Editor.
In the Requirements Editor, click Show Links. The software loadedslreq.editor
graph_unit_tests.slmx
, which is the link set that contains the outgoing links fromgraph_unit_tests.m
.The
graph_unit_tests.m
file has outgoing links to theshortest_path_tests_reqs
andshortest_path_func_reqs
requirement sets, so they are registered to thegraph_unit_tests
link set.View the loaded requirement sets. In the Requirements Editor, click Show Requirements. Because the
shortest_path_tests_reqs
andshortest_path_func_reqs
requirement sets are registered to thegraph_unit_tests
link set, they software also loaded them.The
shortest_path_func_reqs
requirement set also has incoming links fromshortest_path.m
stored inshortest_path.slmx
.View the loaded link sets again. In the Requirements Editor, click Show Links. Because the software loaded the
shortest_path_func_reqs
requirement set, it also loaded the link set that contains its incoming links,shortest_path.slmx
.
Unregister Requirement Sets
To unregister a requirement set from a link set, use the updateRegisteredReqSets
method. You can only unregister a requirement
set from a link set if the requirement set does not have incoming links stored in
the link set.
Unresolved Links
An unresolved link has a source item or destination item that is not available. The source or destination items can be unavailable because:
The artifact that contains the source or destination item is not loaded.
For example, if you load a requirement set that has incoming links from a Simulink model, this also loads the link set that belongs to the model. However, if you do not load the Simulink model, the links are unresolved.
The artifact is loaded, but the specified ID does not exist. Links with invalid IDs are called broken links.
For example, if you delete a linked requirement, the link becomes unresolved because the stored ID no longer corresponds to a valid item.
To see the unresolved links, in the Requirements Editor, click
Show Links. Unresolved links have the unresolved link icon
.
Resolve Links
To resolve a link with an unloaded source or destination, load the artifact that
contains the unloaded source or destination. You might be able to load the artifact
by selecting the link in the Requirements Editor and, in the right pane,
under Properties, click the source or destination item that has
a warning icon .
To resolve a broken link, identify the location of the link source or destination,
then use the setSource
and setDestination
methods to repair the link. Alternatively, delete the
link and re-create it.
Unload Link Information
To unload link sets from memory, close both the source and destination artifacts that contain the linked items. If you close only the source artifact or only the destination artifact, the links remain loaded.
Alternatively, you can unload link sets by using the slreq.clear
function to clear the loaded requirement sets and link sets
and close the Requirements Editor and Traceability Matrix windows.
See Also
Requirements
Editor | getRegisteredReqSets
| updateRegisteredReqSets