Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Following Links through many levels
Topic Summary:
Created On: 27-Jul-2005 22:43
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 27-Jul-2005 22:43
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

I have a script to extract data from DOORS to a text file with information about the current requirement and then follow links and get information about each linked object. Problem is I need to follow the links sometime 7-8 levels deep. Currently I am doing sothing like this: This takes me two levels deep, is there another follow the links until there are no more links to follow without endless nested loops. Seems like there must be an easier way, but I have yet to find it.

Edited: 27-Jul-2005 at 22:44 by Leonard Becraft
Report this to a Moderator Report this to a Moderator
 28-Jul-2005 10:44
User is offline View Users Profile Print this message


Roy Bond

Posts: 39
Joined: 25-Mar-2003

The attached loops around itself until there are no more paths to follow, following all incoming links. You can use this as a starting point for your own script.

Regards,

Roy Bond
MTU Aero Engines
Munich



impact_rep.dxl
impact_rep.dxl  (6 KB)

Report this to a Moderator Report this to a Moderator
 28-Jul-2005 16:53
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Recursive is the way to go.

If your links are recursive (a links to b links to c links to a) then these loops will fail since making an inner loop from the same object will screw up any outer loop for that same object. Also, it will make your function run into infinity. Such a recursive function should probably have a non-recursive wrapper function that creates a Skip list of all traversed objects. The inner (recursive) function checks the Skip to make sure it hasn't already dealt with this object. If so it returns. If not it puts the object in the Skip and then loops through it. The outter function (callable from user programs) deletes the Skip when done.

- Louie
Report this to a Moderator Report this to a Moderator
 28-Jul-2005 16:53
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Recursive is the way to go.

If your links are recursive (a links to b links to c links to a) then these loops will fail since making an inner loop from the same object will screw up any outer loop for that same object. Also, it will make your function run into infinity. Such a recursive function should probably have a non-recursive wrapper function that creates a Skip list of all traversed objects. The inner (recursive) function checks the Skip to make sure it hasn't already dealt with this object. If so it returns. If not it puts the object in the Skip and then loops through it. The outter function (callable from user programs) deletes the Skip when done.

- Louie
Report this to a Moderator Report this to a Moderator
 28-Jul-2005 17:20
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

Roy, Thanks for you reply. I tried your script and it runs without errors, but the report is empty. Any ideas?
Report this to a Moderator Report this to a Moderator
 28-Jul-2005 17:52
User is offline View Users Profile Print this message


Leonard Becraft

Posts: 8
Joined: 10-Jun-2005

Louie, Can you show me a small example? I am a novice at DXL scripts. Thank you!
Report this to a Moderator Report this to a Moderator
 29-Jul-2005 12:02
User is offline View Users Profile Print this message


Roy Bond

Posts: 39
Joined: 25-Mar-2003

First - I am surprised you did not get an error when running the script as I simply copied it from our library without modification, and I am sure it makes reference to a Link Module Attribute which will not exist in your database!

See line 116 of the script .. lm1."Reverse Link Name"

You could simply replace this with a string which gives the current Link Module name, or simply delete it!

This may be why you get no output (but I more expected you to get a DXL error).

If this doesn't work - email me directly at:

roy-david.bond@muc.mtu.de


Roy.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.