Book a Demo

Author Topic: Need DiagramObject.DiagramLinks collection  (Read 10350 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Need DiagramObject.DiagramLinks collection
« on: July 30, 2009, 05:42:40 pm »
Why isn't there one (as of build 846)?  I think it would be very useful for AI work...

At present to simulate this, there's a lot of spinning of cycles as you iterate through the entire DiagramLinks collection for the diagram as a whole to find the ones connected to your selected DiagramObject...

While I'm at it, the reverse would also be nice to have DiagramLink.SupplierDiagramObject and DiagramLink.ClientDiagramObject to make diagram navigation easier...

If there's support for this idea, I'll pop in a feature request...

Paolo
« Last Edit: July 30, 2009, 05:43:08 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Need DiagramObject.DiagramLinks collection
« Reply #1 on: July 30, 2009, 06:08:56 pm »
Vote!

I remember writing those functions myself as well. Would save a bit of work if they would be provided by the API.

Geert

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #2 on: July 31, 2009, 03:05:06 am »
Yes, definitely!

This is one area where doing it yourself is both time-wasting (EA already knows the answer, but won't tell us) and error-prone (we each have to invent the method for ourselves, even though the answer should be obvious).
No, you can't have it!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #3 on: July 31, 2009, 11:36:58 am »
Feature request sent...

I've added a link back here for the Sparxians to observe further discussions.

If anyone has any other API additions in the same general area, pop them here and add a feature request, referencing this topic...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #4 on: August 05, 2009, 10:57:33 am »
I've heard back from Sparx with an interesting reply:


There is no DiagramLinks collection on the DiagramObject class at this time because there is no direct relationship between these two classes.

A DiagramLink provides formatting information for a Connector on a single Diagram, and a DiagramObject represents an Element on a single Diagram.  A DiagramLink has no direct relationship with a DiagramObject.

From the support from the user base above, I guess we users didn't see it that way.

I've tried to get clarification on whether there always exists a DiagramLink for each Connector on the Diagram (regardless of whether the Connector has had its format changed).  A couple of years ago we found issues with RTE because DiagramLinks weren't being consistently created - but I thought that had been resolved by always creating a DiagramLink for each possible Connector on a Diagram.

I guess, in part it's a self fulfilling outcome - while you don't provide the requested attributes, they aren't directly related...

Thoughts?
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Need DiagramObject.DiagramLinks collection
« Reply #5 on: August 05, 2009, 04:06:01 pm »
We know there is no direct link between the DiagramObjects and the DiagramLinks, that is exactly why it would be good if Sparx could provide this function.
If you have to find the diagramlinks for a Diagram Object you have to
  • loop over all diagram links for the diagram
  • get the connector for the diagramLink
  • test the supplierID and the ClientID to see whether one of them is equal to the ElementID of the DiagramObject
This is a time consuming routine that could be made a lot faster with a decent SQL query

Geert

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #6 on: August 05, 2009, 08:49:34 pm »
Geert makes a good point: there is a query that could be used to provide this function.

Geert's argument shows another 'hidden' point. There is a clear procedure that can be followed to obtain this information. The procedure works with the two classes in question. Furthermore the procedure is both deterministic (in the sense that it always gets only correct results and no others) and complete (in the sense that the results include all the correct results).

IMO this would seem to belie Sparx' claim that there is no direct link. But of course this is not my call to make, at least as far as modifying the API goes.

Sigh...

No, you can't have it!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #7 on: August 06, 2009, 11:15:12 am »
Indeed...

We need this functionality so we can more easily determine the "visual" state of a diagram.

We're working on auto-updatable diagrams.  You provide a specification of the diagram and how it is to be managed and the automaton can keep it updated for you.  One factor is the automatic removal of either actually or visually orphaned vertexes.

So we need to know, for any diagram, the set of links to/from an object on that diagram and whether they are hidden or not.

So, like Geert, we had to write our own function to simulate this missing API functionality.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #8 on: August 06, 2009, 09:00:34 pm »
Quote
...One factor is the automatic removal of either actually or visually orphaned vertexes....
Well said!

Visually orphaned elements are a diagram-specific concept. This is one area where the collections provided by EA are completely inadequate.
No, you can't have it!

Dave.B

  • EA User
  • **
  • Posts: 94
  • Karma: +0/-0
    • View Profile
Re: Need DiagramObject.DiagramLinks collection
« Reply #9 on: October 30, 2009, 01:33:20 am »
This is exactly the problem that I have - see http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1256653355/0. So this feature request gets my vote.

I would also add that with the scripting interface to EA I wouldn't expect to have to write scripts to do relative simple bits of automation that involve writing complex helper functions. The automation interface should provide the solutions so that scripts can remain goal oriented.

In the mean time would any one be so kind as to post a bit of code on this thread that can identify the diagram-links associated with a given diagram-object? Pretty Please! (I'm out of time to write a helper script to help format several tree style SysML BDD diagrams into 3 columns (to fit on an A4 sheet) that have a lot of blocks on them.)

Thanks
Dave B.