Automate Creating Traces with DXL...

I have a large SQL database of requirements trace information, which includes only the requirement paragraph number of each document and what paragraph number it traces to in another document.

e.g.
Doc1 (traces to) Doc2
3.1.1 ---------> 3.1.1.a (paragraph numbers only)

I can easily put this information into a text file, 2 columns showing from/to trace relations (as depicted above).

I am importing the requirements documents into DOORS, putting each paragraph number and heading in its own object.

Can I use this text file and DXL to automate the creation of traces inside DOORS? Basically open the text file, read the first line of trace info (from/to) into variables, find the matching paragraph number of the 'from' in DOORS, and let DXL create the trace to the 'to' value.

OK, look forward to a reply !
gkane - Fri Oct 29 15:42:24 EDT 2010

Re: Automate Creating Traces with DXL...
Mathias Mamsch - Sat Oct 30 06:51:12 EDT 2010

Indeed you can do this. First you should open the modules for Doc1 and Doc2 and store all objects in string skip lists, with key = object number and value = object. Then open the file using a "Stream". You can read lines from the stream using the "stringVar <- Stream" operator. You can use regular expressions to extract the trace information from the string.
At this point it seems that with 3.1.1.a they have a different format, then the DOORS heading numbers, so you probably need to do some conversion. You can then use the skip lists to find the objects that correspond to the numbers through the skip and use the "object -> linkmod -> object" operator to create the link.

Hope that helps. Btw.: You can also directly access an SQL database using COM from DXL. This is more complicated of course but also way cooler ;-). If you need examples, just say.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Automate Creating Traces with DXL...
gkane - Tue Nov 02 10:07:05 EDT 2010

Mathias Mamsch - Sat Oct 30 06:51:12 EDT 2010
Indeed you can do this. First you should open the modules for Doc1 and Doc2 and store all objects in string skip lists, with key = object number and value = object. Then open the file using a "Stream". You can read lines from the stream using the "stringVar <- Stream" operator. You can use regular expressions to extract the trace information from the string.
At this point it seems that with 3.1.1.a they have a different format, then the DOORS heading numbers, so you probably need to do some conversion. You can then use the skip lists to find the objects that correspond to the numbers through the skip and use the "object -> linkmod -> object" operator to create the link.

Hope that helps. Btw.: You can also directly access an SQL database using COM from DXL. This is more complicated of course but also way cooler ;-). If you need examples, just say.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

@Mathias

Thanks for the reply!

Are there any other DXL debuggers out there, other than the SODIUS product? Thanks!

GK

Re: Automate Creating Traces with DXL...
gkane - Tue Nov 02 10:57:00 EDT 2010

Had a question relative to DXL debuggers.

Re: Automate Creating Traces with DXL...
Mathias Mamsch - Tue Nov 02 14:28:19 EDT 2010

gkane - Tue Nov 02 10:07:05 EDT 2010
@Mathias

Thanks for the reply!

Are there any other DXL debuggers out there, other than the SODIUS product? Thanks!

GK

I really don't think there is or will be another DXL debugger, since making a DXL debugger means quite a lot of pain for a relatively small market. If IBM/Rational/Telelogic for example had any interest in making a tool like this, they would have done this long before. With DOORS 10 and Jazz, DXL will probably die or be crippled - I can imagine at best that DOORS 10 (Eclipse based as far as I know) will have a compatibility layer for DXL meaning you can "emulate" DXL scripts or translate them to java code or whatever. But that is just my personal impression, the official statement from IBM that I know till today, is that DXL will be alive, so lets hope for the best.

However this does not mean, that you have no other means of "debugging" your DXL. You can do a lot, using the startDXLTrace_ and stopDXLTrace function, if you write your own scripts that will evaluate the trace. You can write your own "debugging framework", by introducing "DebugInformation"/"Trace" functions, that will write information about the execution, whenever you run the script in "DEBUG" mode (use a global variable for that). However this will make your scripts dependent on that DEBUG variable.

Using the sodius debugger is nice, since you can do dynamic evaluation, meaning you can stop your script at a defined breakpoint and then inspect variables and interactivly evaluate expressions, without changing the code at all. Using a trace you will only get a result, when your program stops and don't have the ability to evaluate expressions.

Hope that helps, regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Automate Creating Traces with DXL...
llandale - Tue Nov 02 15:42:25 EDT 2010

Mathias Mamsch - Tue Nov 02 14:28:19 EDT 2010
I really don't think there is or will be another DXL debugger, since making a DXL debugger means quite a lot of pain for a relatively small market. If IBM/Rational/Telelogic for example had any interest in making a tool like this, they would have done this long before. With DOORS 10 and Jazz, DXL will probably die or be crippled - I can imagine at best that DOORS 10 (Eclipse based as far as I know) will have a compatibility layer for DXL meaning you can "emulate" DXL scripts or translate them to java code or whatever. But that is just my personal impression, the official statement from IBM that I know till today, is that DXL will be alive, so lets hope for the best.

However this does not mean, that you have no other means of "debugging" your DXL. You can do a lot, using the startDXLTrace_ and stopDXLTrace function, if you write your own scripts that will evaluate the trace. You can write your own "debugging framework", by introducing "DebugInformation"/"Trace" functions, that will write information about the execution, whenever you run the script in "DEBUG" mode (use a global variable for that). However this will make your scripts dependent on that DEBUG variable.

Using the sodius debugger is nice, since you can do dynamic evaluation, meaning you can stop your script at a defined breakpoint and then inspect variables and interactivly evaluate expressions, without changing the code at all. Using a trace you will only get a result, when your program stops and don't have the ability to evaluate expressions.

Hope that helps, regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Golly, I must be from the stone age. I may not to that real clever addr_ of addr_ stuff, but I do just about everything else and have no difficulty debugging my code with simple print statements.

About half the time I get a full script running without a single debug print statement, but that's because most of my scripts generate a report which provides a lot of info. Some other times I have to narrow down the area of consern with some print statements. The larger scripts, 5000k lines or larger certainly have quite a few at time.

Its pretty straight forward to use print statements to narrow down the location of the error, which works fine since the turn around time from a code update to a code execution is just a couple seconds.

I liken this situation to a 'writer' who claims he cannot write without a modern word processor, which is bunk since you can write a novel on toilet paper. (And I have, and I invite funny retorts, but I digress!). A big difference is that a 'word processor' quality debugger isn't much 'better' than a bunch of 'prints', except you can run production code with them and don't need to insert prints.

  • Louie

Re: Automate Creating Traces with DXL...
Mathias Mamsch - Tue Nov 02 18:13:26 EDT 2010

llandale - Tue Nov 02 15:42:25 EDT 2010
Golly, I must be from the stone age. I may not to that real clever addr_ of addr_ stuff, but I do just about everything else and have no difficulty debugging my code with simple print statements.

About half the time I get a full script running without a single debug print statement, but that's because most of my scripts generate a report which provides a lot of info. Some other times I have to narrow down the area of consern with some print statements. The larger scripts, 5000k lines or larger certainly have quite a few at time.

Its pretty straight forward to use print statements to narrow down the location of the error, which works fine since the turn around time from a code update to a code execution is just a couple seconds.

I liken this situation to a 'writer' who claims he cannot write without a modern word processor, which is bunk since you can write a novel on toilet paper. (And I have, and I invite funny retorts, but I digress!). A big difference is that a 'word processor' quality debugger isn't much 'better' than a bunch of 'prints', except you can run production code with them and don't need to insert prints.

  • Louie

I agree, a debugger does not weigh up for debugging and programming experience. But especially people that are new to DXL (or) programming do not know from the start where to set the right print statements. And it really depends very much on the setting you are programming in. When you are in a setting where you program isolated scripts, based on a well tested library, which might even be your own code (that you know in and out), it is probably much easier to find bugs, make changes, etc. In a setting where you have to develop or change a complex system like an exporter with no library for reuse or have to find bugs in other peoples code (e.g. a memory leak in WEXP) this is a different story. There are bugs that are easy to find and bugs that are hard to find. I for myself can say that I find no sake in the purity of using a typewriter for a novel just because I CAN use a typewriter for writing it. But I am also never satisfied with the stuff I got and always try to make things work better, faster, more efficient or just more slick so I am probably not a reference on questions like these :-)

Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Automate Creating Traces with DXL...
SystemAdmin - Thu Nov 04 12:38:59 EDT 2010

Mathias Mamsch - Tue Nov 02 18:13:26 EDT 2010
I agree, a debugger does not weigh up for debugging and programming experience. But especially people that are new to DXL (or) programming do not know from the start where to set the right print statements. And it really depends very much on the setting you are programming in. When you are in a setting where you program isolated scripts, based on a well tested library, which might even be your own code (that you know in and out), it is probably much easier to find bugs, make changes, etc. In a setting where you have to develop or change a complex system like an exporter with no library for reuse or have to find bugs in other peoples code (e.g. a memory leak in WEXP) this is a different story. There are bugs that are easy to find and bugs that are hard to find. I for myself can say that I find no sake in the purity of using a typewriter for a novel just because I CAN use a typewriter for writing it. But I am also never satisfied with the stuff I got and always try to make things work better, faster, more efficient or just more slick so I am probably not a reference on questions like these :-)

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Mathias,

whether anyone debates if the DXL debugger is useful or not: you definitely do the slickest DXL stuff on this planet outside of IBM :-)

Until now you have been the living debugger on this forum. I guess you hope for some relief from the debugger! Good luck!

p

Re: Automate Creating Traces with DXL...
gkane - Mon Nov 08 14:16:31 EST 2010

Mathias Mamsch - Sat Oct 30 06:51:12 EDT 2010
Indeed you can do this. First you should open the modules for Doc1 and Doc2 and store all objects in string skip lists, with key = object number and value = object. Then open the file using a "Stream". You can read lines from the stream using the "stringVar <- Stream" operator. You can use regular expressions to extract the trace information from the string.
At this point it seems that with 3.1.1.a they have a different format, then the DOORS heading numbers, so you probably need to do some conversion. You can then use the skip lists to find the objects that correspond to the numbers through the skip and use the "object -> linkmod -> object" operator to create the link.

Hope that helps. Btw.: You can also directly access an SQL database using COM from DXL. This is more complicated of course but also way cooler ;-). If you need examples, just say.

Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

@Mathias

Yes, I would be interested in the COM from DXL examples you mention, accessing a SQL db...

Let me know...thx!

GK

Re: Automate Creating Traces with DXL...
Mathias Mamsch - Tue Nov 09 20:28:55 EST 2010

gkane - Mon Nov 08 14:16:31 EST 2010
@Mathias

Yes, I would be interested in the COM from DXL examples you mention, accessing a SQL db...

Let me know...thx!

GK

I will create another post for that. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Automate Creating Traces with DXL...
gkane - Wed Nov 10 15:00:20 EST 2010

Mathias Mamsch - Tue Nov 09 20:28:55 EST 2010
I will create another post for that. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

@Mathias

Another question...

I have been having success building the code to automate my trace building as discussed earlier...ran into a little snag.

How do you reference a skip list data item that is not the "Object Text", but a custom piece of text?

For instance -
The line I read in is a text line like this:
3.1.1.2 First Requirement

I use string manipulation to strip the "3.1.1.2" from the above and insert it as the data item (along with the key of course) in my skip list.

Here's my code to retrieve records from my skip list "fromCache":
Object o
for o in fromCache do{

int i = (int key fromCache)
string heading = (dataElement fromCache) <---doesn't work

or this line...

string heading = o."Object Text" <------doesn't work
print i"\t" heading"\n"

How do I retrieve the data element (which is "3.1.1.2")?

Re: Automate Creating Traces with DXL...
gkane - Wed Nov 10 15:35:42 EST 2010

gkane - Wed Nov 10 15:00:20 EST 2010
@Mathias

Another question...

I have been having success building the code to automate my trace building as discussed earlier...ran into a little snag.

How do you reference a skip list data item that is not the "Object Text", but a custom piece of text?

For instance -
The line I read in is a text line like this:
3.1.1.2 First Requirement

I use string manipulation to strip the "3.1.1.2" from the above and insert it as the data item (along with the key of course) in my skip list.

Here's my code to retrieve records from my skip list "fromCache":
Object o
for o in fromCache do{

int i = (int key fromCache)
string heading = (dataElement fromCache) <---doesn't work

or this line...

string heading = o."Object Text" <------doesn't work
print i"\t" heading"\n"

How do I retrieve the data element (which is "3.1.1.2")?

Never mind...figured it out...use a string type instead of an object.

string oText = ""

for oText in fromCache do{

int i = (int key fromCache)
string heading = oText
print i"\t" heading"\n"
Bingo...

GK

Re: Automate Creating Traces with DXL...
llandale - Thu Nov 11 13:53:17 EST 2010

gkane - Wed Nov 10 15:00:20 EST 2010
@Mathias

Another question...

I have been having success building the code to automate my trace building as discussed earlier...ran into a little snag.

How do you reference a skip list data item that is not the "Object Text", but a custom piece of text?

For instance -
The line I read in is a text line like this:
3.1.1.2 First Requirement

I use string manipulation to strip the "3.1.1.2" from the above and insert it as the data item (along with the key of course) in my skip list.

Here's my code to retrieve records from my skip list "fromCache":
Object o
for o in fromCache do{

int i = (int key fromCache)
string heading = (dataElement fromCache) <---doesn't work

or this line...

string heading = o."Object Text" <------doesn't work
print i"\t" heading"\n"

How do I retrieve the data element (which is "3.1.1.2")?

Yes, with Skip lists you must be very mindful to keep the data types you put in the same as you retrieve. Failing to do so causes lots of nasty emails to be sent to you Mom and you Mate. I routinely announce these as I declare the skip. You also must make sure that the 'Key' you insert into the Skip is indeed a unique 'key' of the data it represents; don't use some Object Text value as a 'key' since many objects will have the same text (null for example). You can indeed use handles such as 'Object' or 'Link' as the 'Key' of a skip; but the retrieval order is unknown (but often create date). Also, Skips with a 'Key' of type 'string' MUST be created with "createString()", all others are created with "create()".

Skip skpReqIDs = createString() // KEY 'string' ReqID; DATA: 'Object'
Object obj, iInSkip
string ReqID
 
for obj in mod do
{  ReqID = probeAttr_(obj, "ReqID")
   if (null ReqID)                      continue
   if (find(skpReqIDs, ReqID, oInSkip))
   {  print "XX Duplicate ReqIDs [" ReqID "]  in " (identifier(obj)) "  and  " (identifier(oInSkip)) "\n"
   }
   else put(skpReqIDs, ReqID, obj)
}
print "\nReqIDs in the module....\n"
          // Note that the retrieval loop is for the Data in the Skip (obj in this case)
for obj in skpReqIDs do
{        // This loop retrieves in sorted order of the Key,
         //   in this case Alphabetical order of ReqIDs
   ReqID = (string key skpReqIDs)
   print ReqID "\t" (number(obj)) "\t" (identifier(obj)) "\n"
}
delete(skpReqIDs)

 

  • Louie

 

Re: Automate Creating Traces with DXL...
gkane - Tue Dec 07 16:21:56 EST 2010

llandale - Thu Nov 11 13:53:17 EST 2010

Yes, with Skip lists you must be very mindful to keep the data types you put in the same as you retrieve. Failing to do so causes lots of nasty emails to be sent to you Mom and you Mate. I routinely announce these as I declare the skip. You also must make sure that the 'Key' you insert into the Skip is indeed a unique 'key' of the data it represents; don't use some Object Text value as a 'key' since many objects will have the same text (null for example). You can indeed use handles such as 'Object' or 'Link' as the 'Key' of a skip; but the retrieval order is unknown (but often create date). Also, Skips with a 'Key' of type 'string' MUST be created with "createString()", all others are created with "create()".

Skip skpReqIDs = createString() // KEY 'string' ReqID; DATA: 'Object'
Object obj, iInSkip
string ReqID
 
for obj in mod do
{  ReqID = probeAttr_(obj, "ReqID")
   if (null ReqID)                      continue
   if (find(skpReqIDs, ReqID, oInSkip))
   {  print "XX Duplicate ReqIDs [" ReqID "]  in " (identifier(obj)) "  and  " (identifier(oInSkip)) "\n"
   }
   else put(skpReqIDs, ReqID, obj)
}
print "\nReqIDs in the module....\n"
          // Note that the retrieval loop is for the Data in the Skip (obj in this case)
for obj in skpReqIDs do
{        // This loop retrieves in sorted order of the Key,
         //   in this case Alphabetical order of ReqIDs
   ReqID = (string key skpReqIDs)
   print ReqID "\t" (number(obj)) "\t" (identifier(obj)) "\n"
}
delete(skpReqIDs)

 

  • Louie

 

More fun...

I created a Skip list which consists of the Absolute Number (an integer), and the Object Number (a string). Note: I used the number(objName) to grab the Object Number as a string.

So basically the Skip list 'key' is the Absolute Number, and the Skip list 'data' is the string type of the Object Number.

How can I use this Skip list in order to create a link, which is looking for 'identifiers' for link creating?

In other words, when I find the text I'm looking for in the Skip, what do I use for the object identifier, so it will agree with the create link command (objFrom -> objTo). The objTo identifier is what I am stuck on, I have the objFrom identifier.

My for loop is not really using an object for objTo, since it is looking for text:

here's my code:
string toText = ""
for toText in toCache do{
...
}

Thanks in advance....GK

Re: Automate Creating Traces with DXL...
gkane - Tue Dec 07 16:23:10 EST 2010

New question...new problem.

Re: Automate Creating Traces with DXL...
gkane - Wed Dec 08 11:33:42 EST 2010

gkane - Tue Dec 07 16:21:56 EST 2010
More fun...

I created a Skip list which consists of the Absolute Number (an integer), and the Object Number (a string). Note: I used the number(objName) to grab the Object Number as a string.

So basically the Skip list 'key' is the Absolute Number, and the Skip list 'data' is the string type of the Object Number.

How can I use this Skip list in order to create a link, which is looking for 'identifiers' for link creating?

In other words, when I find the text I'm looking for in the Skip, what do I use for the object identifier, so it will agree with the create link command (objFrom -> objTo). The objTo identifier is what I am stuck on, I have the objFrom identifier.

My for loop is not really using an object for objTo, since it is looking for text:

here's my code:
string toText = ""
for toText in toCache do{
...
}

Thanks in advance....GK

OK...I figured this one out.

I just needed to continue to utilize an Object in the for loop, and reference the 'Object Number' using string number(objName).

This way I get the identifier of the object in the Skip list to correctly create the link (obj1 -> obj2).

Guess I just needed to walk away and think about it for awhile...learned something!

GK