Does PlantUML support references between class/component members

0 votes
asked Jul 14, 2015 in To be sorted by anonymous

I want to link members of class or components.
Here is an example:

@startuml
object user
user : id
user : name
user : email
 
object project {
id
name
description
user_id
}
 
' And now I try to link directly the members
project.user_id -> user.id
@enduml
 
The DOT syntax itself allows something like this:
See: http://www.graphviz.org/doc/info/shapes.html Chapter Record-based nodes.
 
Does PlantUML support something similar? 
 

2 Answers

0 votes
answered Jul 15, 2015 by plantuml (295,760 points)
Hi,

Thank for the suggestion. However, PlantUML does not support this (yet).

The closest feature you can have is note attached to specific method/attribut of a class (see http://plantuml.sourceforge.net/qa/?qa=3474/attach-note-to-specific-method-attribut-of-a-class ).

We can allow notes for object attribut if you need it.

Using record-bases nodes of Graphviz to link class members is theorically possible. But this is not an easy move so we have to postpone it somehow. Sorry about that!

Regards,
commented Jul 15, 2015 by anonymous
Thanks for the fast answer.
Luckily PlantUML is still awesome enough.
Great work so long.
0 votes
answered Jun 29, 2016 by plantuml (295,760 points)

With last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can now have:

@startuml
class Foo {
+ field1
+ field2
}

class Bar {
+ field3
+ field4
}

Foo::field1 --> Bar::field3 : foo
Foo::field2 --> Bar::field4 : bar
@enduml


Note that this is still a beta version, so it may not work/crash in some case.
Feedback welcome!

commented Dec 19, 2016 by anonymous
Sorry for the really late response.

But finally: Works great :)
Would like to have it inside an official release.

Thanks a lot for the work!
commented Sep 18, 2019 by valexiev (1,220 points)

Great! Another example is at https://forum.plantuml.net/5261

commented Jun 9, 2023 by Ron HD
It doesn't work with PlantUML 1.2023.7 with the built-in Smetana renderer (and as of when I write this, homebrew installation of GraphViz on MacOs Ventura 13.4 is broken by a missing dependency)
...