How to discover inlinks from Baseline

Dear all,

I have the following situation:

  • Module A with an object a1 linked FROM object b1 of Module B
  • I create Baseline 1.0 of Module B

If I open Module A I see only inlinks from Current version of Module B, but if I open Baseline 1.0 I can see outlinks to Module A.

Is there a way analyzing ModuleA to discover inlinks from Baseline 1.0 of Module B?

My idea is to

  • create SkipList HashMap_A_B
  • open Baseline 1.0
  • loop on each object of A, call it objA 
    • create SkipList list_B_Objects
    • loop on each object of Baseline 1.0 (Module B) call it objB
      • if  objB has outlinks to objA
        • put(list_B_Objects, objB."Absolute Number", objB)
    • if list_B_Objects is NOT empty
      • ​put(HashMap_A_B, objA."Absolute Number", list_B_Objects)

Do you have better ideas?

 

Thanks in advance

Dario


Dario_Imparato - Thu Nov 23 06:43:30 EST 2017

Re: How to discover inlinks from Baseline
EHcnck - Sat Nov 25 21:45:55 EST 2017

you need to create BaselineSets; what your currently trying to do is not feasible.

Re: How to discover inlinks from Baseline
Mike.Scharnow - Mon Nov 27 07:00:51 EST 2017

We had this scenario in some projects as well, the first tier of requirements has been created and baselined months before 2nd tier requirements and usage of BaselineSets was not feasible as there were many intermediate baselines in the lower level reqs.--- EDIT: Sorry, I confused the scenario, In my scenario you have links from current to baseline, but the script approach should be correct.

 

Concerning your approach, I would do it the other way round:

  • 1st: from module A, get the list of source modules (B, C, D, ..).
  • For each module m with m element of (B, C, D, ...)
    • iterate over all baselines of m, 
    • for each baseline bl
      • iterate over every object oBL of bl. If b has out links and the destination module is A and the destination module version is current (i.e. empty)
        • put the version number of bl plus the absolute number of oBL plus the absolute number of the destination object (oA) to a skip list. *)
  • Finally, evaluate the skip list to create a traceability report.

This way, you do not have to traverse B so often, this approach should be much faster.

The structure of your HashMap depends on your needs, on how the output shall be formatted. When you put the information to the skip list at *), you will probably do it this way:

  • Does HashMap_A_B already contain key oM."Absolute Number"?
  • If so, the value is alredy a (inner) Skip List. Set a variable to the inner Skip list, add the new information about mB."Absolute Number" and versionString (bl)
  • If not, create a new inner skip, fill the information and put the inner skip to the outer skip.

Re: How to discover inlinks from Baseline
Dario_Imparato - Mon Nov 27 08:26:44 EST 2017

Thank you all,

Mike I don't understand why your approach should be much faster.

I know the baseline version so I don't need to iterate over all baseline.

You iterate on all the objects of bl and create a sort of hashmap B_ID -> List of A_ID? 

Can you explain in details the key and the value of the following SkipList

  • put the version number of bl plus the absolute number of oBL plus the absolute number of the destination object (oA) to a skip list. *)

Thanks in advance

Re: How to discover inlinks from Baseline
Mike.Scharnow - Mon Nov 27 10:02:53 EST 2017

Dario_Imparato - Mon Nov 27 08:26:44 EST 2017

Thank you all,

Mike I don't understand why your approach should be much faster.

I know the baseline version so I don't need to iterate over all baseline.

You iterate on all the objects of bl and create a sort of hashmap B_ID -> List of A_ID? 

Can you explain in details the key and the value of the following SkipList

  • put the version number of bl plus the absolute number of oBL plus the absolute number of the destination object (oA) to a skip list. *)

Thanks in advance

Hi Dario,

well, I understood that your approach has an outer loop of all objects in Module A and an inner loop of all objects in Module B.

So, if you have 1.000 Objects in A and 1.000 Objects in B, you will have 1.000.000 repetitions of the inner loop. If this script concerns not only two small modules but several big modules in the database, it might happen that there is a difference in the runtime.

So, you have a concrete baseline version, that's good.

In this case, your data structure can look exactly as you proposed (but still, this depends on how your report looks like):

 

Skip List Name: HashMap_A_B, key: integer, representing absolute Number of A. Value: inner Skip List 

inner Skip List : key: integer, representing absolute Number of B. Value: corresponding Object of B

 

With this structure, the code excerpt should be:

 

Object oB
Module mB = ... module of opened baseline of B ...
Skip HashMap_A_B = create()
for oB in mB do {
   int absNoB = intOf(oB."Absolute Number""")
   Link l
   for l in (oB) -> ("*") do {
      string destModule = target l
    if (destModule == "A") {
         Object oA = target l
         int absNoA = intOf(oA."Absolute Number""")
       Skip list_B_Objects
         if (!find (HashMap_A_B, absNoA, list_B_Objects)) {
            list_B_Objects = create()
            put (list_B_Objects, absNoB, oB)
            put (HashMap_A_B, absNoA, list_B_Objects)
         } else {
            // list_B_Objects has been initialized by the find command
            put (list_B_Objects, absNoB, oB)
         }
      }
   }
}

 

Re: How to discover inlinks from Baseline
Dario_Imparato - Mon Nov 27 11:29:40 EST 2017

Mike.Scharnow - Mon Nov 27 10:02:53 EST 2017

Hi Dario,

well, I understood that your approach has an outer loop of all objects in Module A and an inner loop of all objects in Module B.

So, if you have 1.000 Objects in A and 1.000 Objects in B, you will have 1.000.000 repetitions of the inner loop. If this script concerns not only two small modules but several big modules in the database, it might happen that there is a difference in the runtime.

So, you have a concrete baseline version, that's good.

In this case, your data structure can look exactly as you proposed (but still, this depends on how your report looks like):

 

Skip List Name: HashMap_A_B, key: integer, representing absolute Number of A. Value: inner Skip List 

inner Skip List : key: integer, representing absolute Number of B. Value: corresponding Object of B

 

With this structure, the code excerpt should be:

 

Object oB
Module mB = ... module of opened baseline of B ...
Skip HashMap_A_B = create()
for oB in mB do {
   int absNoB = intOf(oB."Absolute Number""")
   Link l
   for l in (oB) -> ("*") do {
      string destModule = target l
    if (destModule == "A") {
         Object oA = target l
         int absNoA = intOf(oA."Absolute Number""")
       Skip list_B_Objects
         if (!find (HashMap_A_B, absNoA, list_B_Objects)) {
            list_B_Objects = create()
            put (list_B_Objects, absNoB, oB)
            put (HashMap_A_B, absNoA, list_B_Objects)
         } else {
            // list_B_Objects has been initialized by the find command
            put (list_B_Objects, absNoB, oB)
         }
      }
   }
}

 

Hi Mike,

ok I understood now, thanks for your solution.

I used the outer loop to be sure the objects in A are not deleted; if you navigate the outlinks of a baseline you could find yourself on a deleted object.

I integrated the check in your code, lines 11-12.

Thank you  :)

Dario

Re: How to discover inlinks from Baseline
Mike.Scharnow - Mon Nov 27 12:08:19 EST 2017

Dario_Imparato - Mon Nov 27 11:29:40 EST 2017

Hi Mike,

ok I understood now, thanks for your solution.

I used the outer loop to be sure the objects in A are not deleted; if you navigate the outlinks of a baseline you could find yourself on a deleted object.

I integrated the check in your code, lines 11-12.

Thank you  :)

Dario

Hi Dario,

good idea. You might even change the outer loop to "for oB in entire mB do { if isDeleted oB then continue; ...}

This way, you will also get objects in oB that are currently not visible if a filter is set in the default view.

You are right in removing the conversion from Attr__ to string to int. Directly associating an Attr__ to a an integer variable is one of the cases where DXL works as expected :)

 

Re: How to discover inlinks from Baseline
Dario_Imparato - Tue Nov 28 04:07:02 EST 2017

Hi Mike,

good idea!

Below is the complete code, it can be useful to others.