Please allow adding edges to class members and methods with complex names

0 votes
asked Dec 8, 2016 in Closed feature request by anonymous

Hi! I am using PlantUML to generate simple ER diagrams, utilizing class keyword for describing entities.

Currently there is a way to link two properties or methods using class1::prop -- class2::prop syntax, but it doesn't work with complex property names that contain formatting. 

Here is an example of what I am trying to do:

hide empty methods
hide circle

skinparam linetype ortho

!define PK <size:12><&key></size><b>
!define FK <size:12><&link-intact></size><i>
!define PP <size:12><&caret-right></size>

class "<b> Some dict </b>" as d {
    PK ID        \t\t\t Integer
    PP Name          \t String
}

class "<b> Some entity </b>" as e {
    PK ID       \t\t Integer
    FK Type     \t\t Integer
    PP Some field \t JSON
}

e::Type }-- d::ID

I tried to put full property name in quotes like this:  e::"FK Type \t\t Integer" }-- d::"PK ID \t\t\t Integer", but all I get is a syntax error.

Please allow adding edges to class members and methods with complex names.

1 Answer

0 votes
answered Dec 9, 2016 by plantuml (176,140 points)
 
Best answer

This feature is under development, but we fixed several issue in the last beta. We also enhanced it so that you can use in your case.

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

Now, the following diagram is working:

@startuml
hide empty methods
hide circle

'skinparam linetype ortho

!define PK <size:12><&key></size><b>
!define FK <size:12><&link-intact></size><i>
!define PP <size:12><&caret-right></size>

class "<b> Some dict </b>" as d {
    PK ID      \t\t Integer
    PP Name    \t String
}

class "<b> Some entity </b>" as e {
    PK ID       \t\t Integer
    FK Type     \t\t Integer
    PP Some field \t JSON
}

e::Type }-- d::ID

@enduml

Unfortunately, the skinparam linetype ortho does not work very well, and there is nothing we can really do here (all this is managed by Graphviz/Dot).

Well, there may be one solution: we could still request Graphviz/Dot to do B-splines, and then we could transform those B-splines into segment for the drawing.
Not sure that it will give some good drawing. And it needs some work.

Another thing that we can do is to enhance crowfoot drawing to only handle 0/90/180/270 angle (should be easy to do).

Does it sound good to you?

commented Dec 9, 2016 by anonymous
I don't really need the ortho mode and I only turned it on to make crownfoots placed at 90 deg angles, but yeah, it didn't work well. So I think it would be good if crownfoots are placed only at 0/90/180/270 deg angles.
commented Dec 9, 2016 by plantuml (176,140 points)
The crowfoots should be better in last beta:
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
Not highly tested, so feedback welcome!
commented Dec 9, 2016 by anonymous
Just tried it on couple somewhat large (10-15 entities) diagrams, works great! Crowfoot ends are nicely attached to edges everywhere.
The only problem I noticed is a strange class members matching.

Here is an example:

class A {
 PK ID Integer
 FK OSM_ID BigInteger
 PP OtherID Integer
}
A::ID -- B::Field

In this case the line will be drawn not from ID property of A, but from OtherID property. I guess it just matches the last line that contains "ID" somewhere, even if it is just a part of a word?
commented Dec 10, 2016 by plantuml (176,140 points)
You're correct.

So in last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
If several properties contains the "ID" substring, then it has to be an exact word, and not only a part of a word.
So your last example is now working.

All this may sounds strange, but we are trying to have something short in <classname>::<ID> notation.
Tell us if you find other issues!
Thanks
...