Allow relations between attributes of elements e.g. class, ER

0 votes
asked Dec 22, 2022 in Wanted features by jlo2k (160 points)

Hello,

often when discussing more detailed data models, the relations between attributes of one entity and another entity are required to my experience. Does the community agree or did I miss any method to acquire this within PlantUML?

Example:

A person might have a location referenced via the ID of the location. A location itself might have a parent location also referenced via the ID of the location, not its name.

image

commented Dec 29, 2022 by jlo2k (160 points)

Given the answers below i could find the link to the information I was looking for:

Does PlantUML support references between class/component members

The asked feature seems to have been implemented already, I just did overlook it in the docs.

But as shown in the example comments below, they do not work without flaws.

2 Answers

0 votes
answered Dec 22, 2022 by Todd Musheno (2,680 points)
commented Dec 29, 2022 by jlo2k (160 points)
I appreciate your proposal with entities, but as you can see there is not a direct indication that an attribute-to-attribute relation (via FK optionally) is doable. The other proposal looked like it, on classes, but on entities, I could not get it to work with line type orthogonal. At least both proposals gave me some hints on how to look further into it, although I did not see these options in the documentation mentioned.
commented Jan 4, 2023 by Todd Musheno (2,680 points)
I guess it depends if you are doing an entity relationship diagram, or doing a diagram of a relational database using an erd diagram.
0 votes
answered Dec 22, 2022 by The-Lu (65,440 points)

Here is another proposal:

@startuml
left to right direction

class Person {
  ID
  Name
  Location
}

class Location {
  ID
  Name
  Parent
}

Person::Location }o..|| Location::ID
Location::ID ||--o| Location::Parent
@enduml

Regards.

commented Dec 29, 2022 by jlo2k (160 points)

Strangely left to right does not apply to the second relationship, if you try to use ortho, it breaks the attribute relationship to a certain extent.

...