DOORS LINKS is a feature of IBM Rational DOORS, a requirements management software tool. DOORS LINKS allows users to establish traceability between requirements, which enables the tracking of the relationships and dependencies between them.
With DOORS LINKS, users can create links between individual requirements or groups of requirements, as well as link requirements to other artefacts, such as design documents or test cases. This allows users to manage requirements throughout the entire software development lifecycle, from initial conception to final testing.
The links created using DOORS LINKS can be visualized in a variety of ways, such as graphs, matrices, and reports, which can help users to analyse and understand the relationships between requirements. This can aid in decision-making, risk management, and compliance with industry standards and regulations.
How to create links in DOORS manually?
In this section, we will see how to create a link from a source module to an object in target module.
Open Source Module -> Right click on the selected object (FirstObject in this case) -> Link -> Start Link
The object is now selected for creating the link in the source module –
Now, open the Target module.
Open Target Module -> Right click on the selected object (FirstObject in this case) -> Link -> make Link from Start
Now, a out-link has been created in source module –
An in-link has been created in Target module –
Likewise, we have created links for other objects and here is the source and target module –
Here is an example code to demonstrate how to navigate the out-going links. The code need to be run on the source module (the source module in the example has out-links) to count the number of out-going links.
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: lnk1.dxl * $DESCRIPTION: DOORS Links example * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DOORS Links example // Run this script in the module where out-links are present Module m = current Link lnk = null Object o = null int num_of_links = 0 // for all obj in module for o in m do { for lnk in o-> "*" do { // * indicates any link module num_of_links++ } } print "Number of outgoing links in the current module is = " num_of_links "\n"
Here is the output –
As expected, the output of the code is 5 i.e. there are 5 out-going links in the source module.
Now, let’s run the same code on Target module which does not have any out-going link and here is the output –
Access Target Attribute using Out-Link
We can access the target’s module attributes via out-links from source module. But, before that, let’s create an object level attribute ‘Req_Status’ in Target module –
Once the attribute is created in target module, add the newly created attribute in current view and update the values as follows –
Here is an example on how to access target attribute –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: lnk2.dxl * $DESCRIPTION: DOORS Links example * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DOORS Links example // Access Target module's attribute using out-link from source module Module m = current Link lnk = null Object o_src = null int num_of_links = 0 // for all obj in module for o_src in entire m do { for lnk in o_src-> "*" do { // * indicates any link module string trg = fullName target (lnk) //get taregt module full name if (!open module trg) { // check if target module is already open read(trg, false) // open the target module in background if not open already } Object o_trg = target (lnk) // get the handle of target object print "Target Object Text = "o_trg."Object Text" ", Target Req Status = " o_trg."Req_Status" "\n" } } print "Done!"
As you can see, the above code could pull-in the ‘Req-Status’ value from the Target module using the out-link from the respective objects in the source module.
Now, let’s use the same target module (as used in the previous example) and navigate the in-coming links.
Here is the target module –
Let’s run the following dxl code on Target module –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: lnk3.dxl * $DESCRIPTION: DOORS Links example - incoming links * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DOORS Links example // Run this script in the module where in-links are present Module m = current Link lnk = null Object o = null int num_of_links = 0 // for all obj in module for o in m do { // Determine name of all source modules and open them so that the incoming links are visible LinkRef lnkRef for lnkRef in o<- "*" do { string srcMod = fullName source (lnkRef) //get source module full name if (!open module srcMod) { // check if source module is already open read(srcMod, false) // open the source module in background if not open already } } for lnk in o<- "*" do { num_of_links++ } } print "Number of incoming links in the current module is = " num_of_links "\n"
Here is the output –
As expected, the output of the code is 5 i.e. there are 5 in-coming links in the Target module.
Access Source Attribute using In-Link
We can access the source module’s attributes via in-coming links from target module. But, before that, let’s create an object level attribute ‘Stakeholder_Req_Status’ in Source module –
Now, add the newly created attribute in source module’s current view and update the status as follows –
Here is the Target module –
Now, run the following code on target module where the in-links are present –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: lnk4.dxl * $DESCRIPTION: DOORS Links example - Access source module's attribute * using incoming links * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DOORS Links example // Run this script in the module where in-links are present Module m = current Link lnk = null Object o = null int num_of_links = 0 // for all obj in module for o in m do { // Determine name of all source modules and open them so that the incoming links are visible LinkRef lnkRef for lnkRef in o<- "*" do { string srcMod = fullName source (lnkRef) //get source module full name if (!open module srcMod) { // check if source module is already open read(srcMod, false) // open the source module in background if not open already } } // Now links are visible for lnk in o<- "*" do { string srcMod = fullName source (lnk) //get source module full name Object o_src = source (lnk) print "Source Object Text = "o_src."Object Text" ", Stakeholder Req Status = " o_src."Stakeholder_Req_Status" "\n" } } print "Done!"
The code access the ‘Stakeholder_Req_Status’ attribute in Source module via in-coming links in target module –
Create Link
In the following example, we will see how to create an out-link from the last object of the source module to last object of target module. Here are the snapshot of both the modules before creating this link using dxl code –
Now, run the following dxl code on the source module –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: lnk5.dxl * $DESCRIPTION: DOORS Links example - create link * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DOORS Links example - create link Module m = current Link lnkOut = null // Creates a link between source object and target object string lnk_mod = "sampleLinkMod" // user must have write access to source object Module mSrc = edit ("Source", true) // open source module in edit mode Module mTrg = read ("Target", true) // open target module in read mode Object oSrc = last (mSrc) // get source object i.e. last object in source module Object oTrg = last (mTrg) // get target object i.e. last object in target module lnkOut = oSrc -> lnk_mod -> oTrg print "Done!"
Here are the snapshots of both the module after executing the above code –
The out-link has been created in the source module and in-link has been created in the target module using the ‘SampleLinkMod’ link module.
Delete Link
DXL provides a way to delete the existing link with delete() function. In this example, we will see how to delete an existing link. here are the snapshots of both the modules before deleting the links-
With the following DXL code, we will delete the links between last object of source module and last object of target module –
// www.TheCloudStrap.Com /************************************************************************ * $FILENAME: lnk6.dxl * $DESCRIPTION: DOORS Links example - Delete link * * NOTICE: Copyright www.TheCloudStrap.Com. All rights reserved. * Software comes without any warranties and guarantees, is provided * as is and is not supported. Use this software at your own risk. * Authors resume no liabilities. * * Contact: admin {at} TheCloudStrap.com ************************************************************************/ // DOORS Links example - Delete link Module m = current Link lnkOut = null string lnk_mod = "sampleLinkMod" // user must have write access to source object Module mSrc = edit ("Source", true) // open source module in edit mode //Module mTrg = read ("Target", true) // open target module in read mode Object oSrc = last (mSrc) // get source object i.e. last object in source module //Object oTrg = last (mTrg) // get target object i.e. last object in target module for lnkOut in oSrc->lnk_mod do { delete (lnkOut) } print "Done!"
Here are the snapshots of both the modules after executing the above code –
As we can see, the out-link from the last object in source is now deleted.
Conclusion
In this article, we have discussed DOORS Links operations using DXL i.e. – how to create and delete links and how to navigate outgoing and incoming links.
This post was published by Admin.
Email: admin@TheCloudStrap.Com