Alias of interfaces in component diagrams

0 votes
asked Aug 16, 2017 in Wanted features by boshka (3,940 points)

is there a way to define a set of interfaces as aliases?

such as in the example below i want to define interfaces a1, a2, a3 as aliases of interface A so that only A will be rendered instead of a1, a2, a3 and the arrows will be from A to d, e and f

 

@startuml
 
 
component comp as comp {
interface a1 as a1
interface a2 as a2
interface a3 as a3
/'
now I want to declare a1, a2, and a3 as aliases of a new interface A that will be used instead of those 3 when rendering
'/
}
 
interface d as d 
interface e as e
interface f as f
 
a1->d
a2->e
a3->f
 
@enduml
 
 
so, that after that redefinition the code would virtually become as follows:
 
@startuml
 
 
component comp as comp {
interface A as A
}
 
interface d as d 
interface e as e
interface f as f
 
A->d
A->e
A->f
 
@enduml
 

1 Answer

0 votes
answered Aug 17, 2017 by Serge Wenger Work (15,620 points)

Hello,

Cou can use !define

@startuml
!define a1 A 
!define a2 A 
!define a3 A 
 
component comp as comp {
interface a1 as a1
interface a2 as a2
interface a3 as a3
/'
now I want to declare a1, a2, and a3 as aliases of a new interface A that will be used instead of those 3 when rendering
'/
}
 
interface d as d 
interface e as e
interface f as f
 
a1->d
a2->e
a3->f
@enduml
commented Aug 19, 2017 by boshka (3,940 points)
edited Aug 19, 2017 by boshka
many thanks! I should have seen this way myself :)
commented Oct 10, 2017 by boshka (3,940 points)
edited Oct 10, 2017 by boshka
Hi Serge Wenger Work,
while this works perfectly with "interface", now that I was told to use "circle", I replaced all "interface" with "circle" and this approach starts breaking.

In particular:

@startuml
    database "DB" as DB {

         !define DB_at_NSM_CQL DB_at_CQL
         circle "CQL" as DB_at_NSM_CQL

         !define DB_at_MID_CQL DB_at_CQL
         circle "CQL" as DB_at_MID_CQL

         !define DB_at_REPL_CQL DB_at_CQL
         circle "CQL" as DB_at_REPL_CQL
    }
@enduml

this piece breaks, however, if you replace circle with interface it will work.
Please NOTE: it is weird, but this SHORT piece will apparently work for you in both cases, however, within my full iuml code (wich is about 1032 lines) it fails with the error (indicating the error is in these particular lines):

... (skipping 190 lines) ...
database "DB" as DB  {
circle "CQL" as DB_at_CQL
circle "CQL" as DB_at_CQL
This element (DB_at_CQL) is already defined

Could you have a look and try fixing this? If possible, I would not want to share the whole code.
I think, to keep consistency with "interface", such an override should just work too for "circle"
commented Oct 23, 2017 by plantuml (294,960 points)
I'm sorry, but I'm lost here :-)
The following example is working for us with Version 1.2017.18

@startuml
database "DB" as DB  {
circle "CQL" as DB_at_CQL
circle "CQL" as DB_at_CQL
}
@enduml

http://www.plantuml.com/plantuml/uml/IqaiIKnAB4vLK79nKb98B5PmSL9GgEPApYnApW4AEWVwG4NZ4qlYWJmyChK0


This one is also working:
@startuml
database "DB" as DB {

         !define DB_at_NSM_CQL DB_at_CQL
         circle "CQL" as DB_at_NSM_CQL

         !define DB_at_MID_CQL DB_at_CQL
         circle "CQL" as DB_at_MID_CQL

         !define DB_at_REPL_CQL DB_at_CQL
         circle "CQL" as DB_at_REPL_CQL
    }
@enduml

http://www.plantuml.com/plantuml/uml/Kr18IIn9J4eiJbLGSd5IKaWiLd1nKgZcubA00SMKrBJCl5IWS7nYIRnVi6-ySw0Fb0Ta8HGcPnObvm2D0Gf2pK7IWDD0NqyNqWo4Qi1fO91hW0zf9i9qWDNL0W00
commented Oct 23, 2017 by boshka (3,940 points)
Yes, it does not fail for the short pieces.
However, it fails within the whole code of about 1032 lines (and unfortunately, the whole code is under NDA). Is there a way to share an NDA code with you for a fix?
commented Oct 23, 2017 by plantuml (294,960 points)
We cannot solve it if we cannot reproduce it.

So were what you can do. You have to build the shortest PlantUML diagram that crashes.

Take your 1032 lines of code, remove all comments, all title, all descriptions, methods...
Remove randomly some stuff as long as it still crashes.
Eventually, rename some of your elements to names like "foo1", "foo2", "foo3"...
At this end, it will be obfuscated (so no covered by any NDA).
And as it still crash, send it to us by mail (plantuml@gmail.com)

Sounds good ?
commented Oct 25, 2017 by plantuml (294,960 points)
Ok, great.
It should be fixed in last beta:
https://www.dropbox.com/s/koo42q3d9gxw288/plantuml.jar?dl=0

Tell us if you find other issues!
Thanks
commented Oct 26, 2017 by boshka (3,940 points)
looks good! thank you!
...