I am wanting to create a collaboration-like diagram which looks something like this:
I am struggling to find a way to mark-up PlantUML to influence the positioning of the various objects. I have also tried using Graphviz directly, but with even worse results.
This is what I is renders as now:
Can anyone provide some hints as to what I can try?
#startuml
actor "Operator" as op
actor "Subscriber" as sub
node "HSS" as hss
node "SMDP+" as smdp
op -right-> smdp : 1: Place profile order
smdp -> op : 2: Return provisioning data
op -right-> hss : 3: Provision profile data
op -down-> sub : 4: Provide download info
sub -[norank]> smdp : 5: Request download
hss -[hidden]down-> smdp
#enduml
Here's an attempt using my comments on your question:
#startuml
'left to right direction
together {
actor "Operator" as op
actor "Subscriber" as sub
}
together {
rectangle "HSS" as hss
rectangle "SMDP+" as smdp
}
op -right-> smdp : 1: Provisioning data:=\nPlace profile order
'smdp -> op : 2: Return provisioning data
op -right-> hss : 2: Provision profile data
op -down-> sub : 3: Provide\ndownload\ninfo
sub -[norank]> smdp : 4: Request download
hss -[hidden]down-> smdp
#enduml
Related
I'm evaluating if PlantUML can be a good alternative to GraphViz.
It's promoted as "intuitive" but honestly the very first example from the homepage is already confusing.
Why does the following create "Bob" and "Alice" twice?
I'm seeing 2 nodes in the text, and 4 in the output.
Also, the arrow doesn't go between the nodes, but between relations between duplications of the nodes.
Bob->Alice : hello
It makes zero sense to me.
What is the meaning of this example, and what would be a more trivial example with just 2 nodes and an arrow between them?
I see you have fallen for the classical trap of "The first page of the manual is not representative of the tool".(1)
Besides various UML diagrams (like the sequence diagram you encounered), PlantUML has support for various other Software development related formats (such as archimate, Block diagram, bpmn, c4, Computer network diagrams, erd, gantt chart, Mind maps, and wbd), as well as visualization of json and yaml files.
In fact, it even understands Graphviz syntax!(2)
Because of all of this, "intuitive" doesn't happen until you have some basic knowledge of PlantUML.
So back to your issue... What you are seeing isn't what you think it is.
What is that?
Relating things to Graphviz, instead of this:
digraph d {
Bob -> Alice : hello
}
You are actually seeing this:(3)
#startuml
digraph sequenceDiagramExample {
bobHead [ label="Bob" pos="0,1.5!" shape="record" ];
bobPoint0 [ pos="0,0.75!" shape="point" width="0" ]
bobFoot [ label="Bob" pos="0,0!" shape="record" ];
aliceHead [ label="Alice" pos="1,1.5!" shape="record" ];
alicePoint0 [ pos="1,0.75!" shape="point" width="0" ]
aliceFoot [ label="Alice" pos="1,0!" shape="record" ];
bobHead -> bobPoint0 -> bobFoot [ dir="none" style="dashed" ]
aliceHead -> alicePoint0 -> aliceFoot [ dir="none" style="dashed" ]
bobPoint0 -> alicePoint0 [ label="hello" labelloc="c" style="solid" ]
}
#enduml
Gimme an example!
What an example with just two nodes and an arrow between them looks like depends on the kind of graph chosen...
What you have to remember is that, with Graphviz, you have to apply all meaning to a diagram yourself. With PlantUML, the meaning is provided by PlantUML for you. All you need to do is tell PlantUML what you mean.
With a few basic pointers, this becomes intuitive quite quickly. You just need to know what kind of diagram you want to draw before starting...
As you can see from the examples below, PlantUML is a very powerful tool to add to your software developer toolbelt.
I hope the examples will help to make things more intuitive, and that your first misstep won't keep you from exploring PlantUML further!
Activity
#startuml
:Alice;
:Bob;
#enduml
Archimate
#startuml
archimate #Application Alice
archimate #Business Bob
Alice -> Bob
#enduml
Class
#startuml
Alice -|> Bob: Hello
#enduml
Component
#startuml
[Alice] -> [Bob]: Hello
#enduml
Deployment
#startuml
folder Alice
file Bob
Alice -> Bob: Hello
#enduml
Ditaa
#startuml
ditaa
+-------+ +-----+
| | hello | |
| Alice +------>| Bob |
| | | |
+-------+ +-----+
#enduml
Gantt
#startgantt
[Alice]->[Bob]
#endgantt
JSON
#startjson
{
"Alice": ["Bob"]
}
#endjson
MindMap
#startmindmap
+ Alice
++ Bob
#endmindmap
Network
#startuml
nwdiag {
network hello {
Alice;
Bob;
}
}
#enduml
Object
#startuml
object Alice
object Bob
Alice -> Bob
#enduml
Sequence
#startuml
Bob -> Alice : hello
#enduml
State
#startuml
[*] -> Alice
Alice -> Bob: hello
Bob -> [*]
#enduml
Timing
#startuml
concise Hello
0 is Alice
+100 is Bob
#enduml
Use Case
#startuml
:Alice: -> :Bob: : Hello
#enduml
WBS
#startwbs
+ Alice
++ Bob
#endwbs
Footnotes
It's not realy a classic, I just made that up. But it is something that commonly happens.
Reference the manual here: https://plantuml.com/dot
Rendered in neato not dot, see https://stackoverflow.com/a/53470455/153049
They are not “four nodes”, they are top and bottom headers for every participant in the sequence. This is useful for readability in larger sequence diagrams, see some examples here https://plantuml.com/en/sequence-diagram
You can style your diagram to comply with strict UML with
skinparam style strictuml
Full code
#startuml
skinparam style strictuml
Bob -> Alice : hello
Alice -> Bob : ok
#enduml
How to add nested alt flow in plant UML ?
I have a use case in which I want nested alt. Similar to below
When I add it only innermost alt is displayed. Need help in finding right syntax for it
alt [condition 1]
do some steps
alt [condition 2]
do some steps
else [condition 2 Not true] so do nothing
else [condition 2 Not true] so do nothing
You have to add an end statement to close the alt block.
As a side note: You do not need to add the square brackets in your alt statements. PlantUML renders those itself.
alt condition 1
bob -> alice
alt condition 2
bob -> alice
else condition 3
bob -> alice
end
else condition 4
bob -> alice
end
I want to have deployment and sequence stuff in one and the same rendered plantuml picture. So I tried the following but it does not work, the rendering shows the sequence stuff for A, B and C as deployment.
How can I force rendering for "A->B" and "B->C" as sequence diagram stuff?
#startuml
file main.c
note right: I want to have description text here
A -> B : main()
note left : program\nentry function
B -> C : load()
note left : another important function
#enduml
I think you need to add your note later:
#startuml
title file main.c
A -> B : main()
note left : program\nentry function
B -> C : load()
note left : another important function
note right: I want to have description text here
#enduml
Result:
I want to display nodes in a Use Case diagram more compact than Graphviz does by default. Say for example the following cases are wrapped in a rectangle:
actor A
actor B
A - (case a)
(case b) - B
A - (mixed case)
(mixed case) - B
By default the cases are aligned vertically. I'd prefer to have (case a) an (case b) side-by-side and (mixed case) centred and below the previous cases. I've also tried to use -[hidden]- links
(case a) -[hidden]- (case b)
but then (mixed case) gets left aligned and cases a and b are too wide apart. Here's how it looks in full beauty:
#startuml
left to right direction
Source <<Operator>>
Sink <<Operator>>
Source ..> Sink : notify service address
rectangle "Init phase" {
Source -> (Prepare service)
(Prepare service) -[hidden]-(Register with service)
(Register with service) <- Sink
Source -> (Secure channel) : <<initiate>>
(Secure channel) <-- Sink : <<participate>>
Source --> (Ensure readiness) : <<participate>>
(Ensure readiness) <- Sink : <<initiate>>
}
#enduml
Image here:
I usually accept the formatting (after a bit of tweaking with -left->, -right-> etc.)
You might consider the use of skinparam to have use cases in one column (default, very compact) and distinguish them by color. This is different than what you have asked for, but I do hope that it
#startuml
left to right direction
Source <<Operator>>
Sink <<Operator>>
Source ..> Sink : notify service address
skinparam usecase {
BackgroundColor<< Source >> DarkSeaGreen
BorderColor<< Source >> DarkSlateGray
BackgroundColor<< Both >> YellowGreen
BorderColor<< Both >> YellowGreen
BackgroundColor<< Sink >> Yellow
BorderColor<< Sink >> Yellow
}
rectangle "Init phase" {
Source -> (Prepare service)<<Source>>
' (Prepare service) -[hidden]-(Register with service)
Source -> (Secure channel)<<Both>> : initiate
(Secure channel) <-- Sink : <<participate>>
Source --> (Ensure readiness) : <<participate>>
(Ensure readiness)<<Both>> <- Sink : <<initiate>>
(Register with service)<<Sink>> <- Sink
}
#enduml
This results in the following:
Hi : I am a neebie in Gremlin and Orient-db. I was playing around with Gremlin and orient db in java. I was able to query my vertices and edges using the available methods and get the results.I am using back("Alias-name") to get the result vertices of my query.
My question is can I get a graph of all the result vertices ( the related graph and the information of the result) since right now I am able to get the vertices but I want the entire "sub graph" information of my resultant vertices in the same query.
Any help is greatly appreciated.
Here is a code with generic example:
GremlinPipeline startPipe = pipe.has("friend-name", "friend-name")
.in("friend-depends").as("friend-depends")
.outE("resource-depends").inV()
.has("resource-name", "car")
.back("friend-depends");
v(Friend)[#15:13]
v(Friend)[#15:7]
v(Friend)[#15:12]
The results are right but I would like to get the results as
Friend#15:13{friend-name:Frank,Friend-type:Personal,in_depends:#17:10 (friend of friends),... with edges} v2
Thanks,
Sabari
Gremlin does not provide an explicit subgraph function (as of the unreleased 2.5.0). The only way to get a subgraph with Gremlin is to explicitly extract those graph elements yourself. My preference is to simply sideEffect the elements to an in-memory TinkerGraph. You can see an example here:
http://gremlindocs.com/#recipes/subgraphing
Given your amended question, you may use the the path step to get individual parts of the path as in:
gremlin> g = TinkerGraphFactory.createTinkerGraph();
==>tinkergraph[vertices:6 edges:6]
gremlin> g.v(1).outE.inV.path
==>[v[1], e[9][1-created->3], v[3]]
==>[v[1], e[7][1-knows->2], v[2]]
==>[v[1], e[8][1-knows->4], v[4]]
gremlin> g.v(1).outE.inV.has('age',T.gte,31).path
==>[v[1], e[8][1-knows->4], v[4]]
That looks a bit like what you are looking for. From there you could sideEffect to a subgraph. From there you could choose to not use back anymore:
gremlin> g.v(1).outE.inV.has('age',T.gte,31).path.sideEffect{println it}.collect{it.last()}
[v[1], e[8][1-knows->4], v[4]]
==>v[4]
or stick with it:
gremlin> g.v(1).as('x').outE.inV.has('age',T.gte,31).path.sideEffect{println it}.back('x')
[v[1], e[8][1-knows->4], v[4]]
==>v[1]