Sequence Diagrams with Diagrams In Note And Functions

0 votes
asked Sep 18, 2019 in Question / help by kjw

Plantuml is bloody awesome !!!

I was about to ask why can't sequence diagrams a have notes with diagrams in them as raised in 

https://forum.plantuml.net/10128/diagram-in-a-note-function

A bit of fiddling and boom!!! 

Just the consistency of the syntax of notes across the diagrams would be good

Bringing the single line connection would be great as per : https://forum.plantuml.net/10149/how-to-connect-a-note-to-a-single-class-with-a-dashed-line  if they could be pointed to the message arrows in sequence diagrams - will add the ask as a comment for clarity in this section

http://www.plantuml.com/plantuml/png/PP5FY-904CNlzIdAmw8USjZrpq4MKG-xiB08ih2NWBJfSinCMnMxgmK9-UwJFmR2c5kzt-jNrCicgF4QhmvW5FaMHSdYENAckJ3kTtycKoXBGCJCcH1mVtgdJB5Lse_DbN25AX_4NyMpCs-jLa5LmOZOzia09bFn-4laEvmaiZN-qKm_81DMBwuPPa2ikRPW3jQeEPb0pRIeRSvHcnKQOGbD52RhDgJU_K-mpnsYMOUUIuPatf7dnWFT8WM52uiIofryx_alqLdyxSaegjH6jZLCsN1VJiwebu3DInY_l2_Bb0lZDS_omh3YtySMJS1jojjalTwjiF1KSqgvgb96U0duvabzJdSwtYMtnwRIoRZ-K-DfTyxF91dSq_Lye5081neUlEWCVQr3jEpGe6E03R6DL_S9

@startuml

!unquoted function OBJ()
{{
   class Object {
        name : token
        name : flag
    }
}}
!endfunction

actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
collections Foo6
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity Request
hnote over Foo4 : Would Great to Render \nan Object in this note
'note over Foo4 : {{\nparticipant MyA as A\nA->>B: prepare\n}}\n 
note over Foo4 : %retrieve_void_func('OBJ')
Foo1 <-- Foo4 : To actor Response
Foo1 -> Foo5 : To database
Foo1 -> Foo6 : To collections

@enduml

commented Sep 18, 2019 by kjw

So far we can do :

http://www.plantuml.com/plantuml/png/bP5FgzDG4CNtyodcWPBtm2pqjLqKAMqN2e9MH70JABUv8utUpAJtpYsKaEzk_YGQxEfbD_TtvamuPnlKU8sb0tY8V8cYPF5dv5mBOJpiFps-2bBI5rFI4q9TG-vC27Wu_Q9SiGOSFsu5k4QLtyJ_F_vrw443JGCFn7Qw0c1o5OyVHDx2II9Rus_Tz0voOVNYkk4PYBNG7Yp06ZKd4wYRbgtCEUgzGlUmWiuAqqrlWclyBZZvpj7pWCOZSx8Oo7Zn6rqY1ONapAA4SYK_YNv8T1O_UZAAAgsIRGipDZn5L33gEM2t2SdTVbrdN1clHLvKXXK_ttPe0kuotgMRpNwDbQUMKyPDap72dS5hJ-eBkjBnAeKzTfa-9crjoHjCnl_-QcvEZ4sUNhmUAk50__PnoEXzciv26igRnFCKbuDWwcgELWEQ5GUm9RQnT7y0

In a large sequence diagram it would be great to add diagrams in a note to visualise some of the payload being passed around and position them away from the busy parts if the diagram. I know you can place this in the message but when you have to use skinparam maxMessageSize 100 to fit all participants in the view the messages can get scrambled and push everything down the page and still not have clarity

The ask : if the notes could be attached to the message arrows with a single dashed line that would be a great improvement and if they could contain diagrams even better :

Could something like the following be implemented ?

@startuml

!unquoted function OBJ($someName) 
{{   class Object {
        name : token
        name : $someName
    }
}}
!endfunction

actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
collections Foo6
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity Request as req1
note over Foo4 : <b>Request Object </b>\n%retrieve_void_func('OBJ', 'RequestPayload') as N1
req1..N1
note over Foo4 : <b>Request Object </b>\n%retrieve_void_func('OBJ', 'ResponsePayload') as N2
N2..resp1
Foo1 <-- Foo4 : To actor Response as resp1
Foo1 -> Foo5 : To database
Foo1 -> Foo6 : To collections

@enduml

commented Sep 18, 2019 by plantuml (294,960 points)

That's a nice suggestion, thanks!

You will need to switch to the new teoz layout (this is not possible with the legacy layout engine).

We have begun to do something in last beta http://beta.plantuml.net/plantuml.jar

This is really a first release, which is still buggy.
So you can now have:

@startuml
!pragma teoz true
!unquoted function OBJ()
{{
   class Object {
        name : token
        name : flag
    }
}}
!endfunction

Alice -> Bob : hello1
note bottom : my note
Alice -> Bob : hello2
note bottom
  my note
  is on several line
  OBJ()
end note
@enduml

This is still under work, but at least you can comment the expected syntax.

Is this somehow what you are looking for ?

commented Sep 19, 2019 by kjw

Looking to apply to Sequence Diagrams the idea being to have single dotted lines connecting the relevant notes the respective the the message arrows

PlantUML Diagram

@startuml

!unquoted function OBJ($someName) 
{{   class Object {
        name : token
        name : $someName
    }
}}
!endfunction

actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
collections Foo6
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity Request as req1
note over Foo4 : <b>Request Object </b>\n%retrieve_void_func('OBJ', 'RequestPayload') as N1
'req1..N1
note over Foo4 : <b>Request Object </b>\n%retrieve_void_func('OBJ', 'ResponsePayload') as N2
'N2..resp1
Foo1 <-- Foo4 : To actor Response as resp1
Foo1 -> Foo5 : To database
Foo1 -> Foo6 : To collections

@enduml

commented Mar 14, 2023 by MP
Hi,

I was wondering if there were any updates about this kind of notes in sequence diagrams, i.e., notes linked to messages.

I even tried to copy-paste this PlantUML diagram but it seems it is no longer working.

Could you help me?

Thanks in advance
commented Mar 14, 2023 by plantuml (294,960 points)
This thread is very old and confuse now: I think it would be better to open a new question about your issue https://forum.plantuml.net/ask
commented Mar 14, 2023 by kjw

Updated to  work but not as requested in this thread:

@startuml
!procedure $OBJ($someName) 
{{   class Object {
        name : token
        name : $someName
    }
}}
!endfunction

actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
collections Foo6
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity Request as req1
note over Foo4 : <b>Request Object </b>\n%retrieve_void_func('RequestPayload') as N1
'req1..N1
note over Foo4 : <b>Response Object </b>\n%retrieve_void_func('OBJ', 'ResponsePayload') as N2
'N2..resp1
Foo1 <-- Foo4 : To actor Response as resp1
Foo1 -> Foo5 : To database
Foo1 -> Foo6 : To collections
@enduml

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.
...