Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for class diagram relationships in PlantUML generation. #166

Closed
davidoevans opened this issue Feb 5, 2020 · 9 comments · Fixed by #595
Closed

Add support for class diagram relationships in PlantUML generation. #166

davidoevans opened this issue Feb 5, 2020 · 9 comments · Fixed by #595
Assignees
Labels

Comments

@davidoevans
Copy link

Is your feature request related to a problem? Please describe.
The current PlantUMLVisitor implementation does not represent --> relationships defined in a concerto model.

Describe the solution you'd like
PlantUML generated would show class diagram relationships for property references modelled as --> as documented here -> Class Diagrams Relationships.

Describe alternatives you've considered
When introducing this feature, consider having it be an option that can be passed via parameters since these relationships may appear cluttered for more complex models.

Additional context
@dselman pointed to this line of code as likely being best place to implement this feature. -> https://github.com/accordproject/concerto/blob/master/packages/concerto-tools/lib/codegen/fromcto/plantuml/plantumlvisitor.js#L220

@mttrbrts mttrbrts added the Type: Feature Request 🛍️ New feature or request label Mar 7, 2020
@Aniruddha-Shriwant
Copy link
Contributor

Aniruddha-Shriwant commented Mar 27, 2021

I was willing to work on this but was having some doubts,

if(classDeclaration.getSuperType()) {
parameters.fileWriter.writeLine(0, classDeclaration.getFullyQualifiedName() + ' --|> ' + classDeclaration.getSuperType());
}

As you can see here it uses --> when it extends superClass/has any superClass i.e. it shows the relationship...

Also, I was exploring the Accord Project's models repo and found that the same plantumlvisitor.js is used for generating plantUML diagrams that are in html files for models
https://github.com/accordproject/models/blob/c614455d42d61cd3c18f30a6d60b7fe38f9a375c/build.js#L55

So now when you open a model page (for example open this: https://models.accordproject.org/cicero/runtime.html)
You can see the plantUML diagram is showing the relationships between the classes

So is this issue still open?

Correct me if I'm wrong...I may be wrong :)
If the issue is still open can anyone throw some light on which class diagram relationships in PlantUML generation is @davidoevans talking about...

@Aniruddha-Shriwant
Copy link
Contributor

Aniruddha-Shriwant commented Mar 27, 2021

I was also having some doubts regarding plantuml generation,
Although the same plantumlvisitor.js is used in concerto-cli and https://github.com/accordproject/models

I had used concerto-cli command for generating plantuml as follows:
concerto compile --ctoFiles calendar.cto --target PlantUML
The output plantuml was this

But when you will see the plantuml for the same model here https://models.accordproject.org/calendar/calendar.html it will be different (not drastically different but small in size)

So why this is done differently? Are they different because we want small-size plantuml on the website and the rest of the things can be included in the Dependencies section?

@jeromesimeon
Copy link
Member

jeromesimeon commented Apr 13, 2021

@Aniruddha-Shriwant I believe the issue is for relationships (has a) rather than inheritance (is a) https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance

In Concerto you can have both:

namespace foo

concept Person identified {
  o String name
}
concept Vehicle {
  --> Person owner   // relationship
  o String model
  o Integer year
}
concept Car extends Vehicle { // inheritance
  o Integer milage
}

@Aniruddha-Shriwant
Copy link
Contributor

Thanks @jeromesimeon, for clearing my doubts I will look into it now :)

@AbhishekJamhoriya
Copy link

@jeromesimeon is this issue still open . if Yes please assign me this issue .

@Aaditya-23
Copy link

Is this issue still open? If yes then please assign it to me.

@jeromesimeon
Copy link
Member

@Aaditya-23 done.

@Aaditya-23
Copy link

@jeromesimeon thanks for assigning the issue. I had some doubts though. I forked the project concerto repo and cloned it into my pc. But, how do I run the project? Where can I see the plant uml generator?

@Aaditya-23
Copy link

Hey @Aniruddha-Shriwant can your help me out👆?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants