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

Drawing a UML diagram #1

Open
ronaldtse opened this issue Aug 4, 2020 · 15 comments
Open

Drawing a UML diagram #1

ronaldtse opened this issue Aug 4, 2020 · 15 comments
Assignees
Labels
enhancement New feature or request

Comments

@ronaldtse
Copy link
Contributor

ronaldtse commented Aug 4, 2020

We need to use OGDF to draw a UML diagram in C++.

OGDF is a framework for drawing graphs. They seem to be able to draw UML diagrams well.

Some links:

Here's an example of UML generated by OGDF:

Screen Shot 2020-08-04 at 10 32 41 AM

The goal is to re-draw this diagram using OGDF (the current diagram is ugly, OGDF output is much nicer!):

image

I think one of these ways will work:

  1. via XMI directly to OGDF
  2. via GraphML directly to OGDF
  3. via OGDF API in C++ (like the blog post examples above)

Eventually the goal is to have a Ruby API that can perform either of these.

@ronaldtse ronaldtse added the enhancement New feature or request label Aug 4, 2020
@ronaldtse ronaldtse changed the title Using OGDF to draw UML diagram Drawing a UML diagram Aug 18, 2020
@ronaldtse
Copy link
Contributor Author

@elquimista you up for this?

@elquimista
Copy link

@ronaldtse yes I'm up for this. The second diagram is a class diagram right? Can you draw it on paper and share?

@ronaldtse
Copy link
Contributor Author

@elquimista Yes the second diagram is a class diagram that we wish to reproduce in OGDF.

@ronaldtse
Copy link
Contributor Author

@elquimista please feel free to ask questions here. @w00lf and @DmitryDrobotov would be also able to help. Thanks!

@elquimista
Copy link

Find below (also attached as SVG) graph for the second diagram generated by OGDF (code attached - C++17):

graph

After spending considerable time and effort on this, here are my observations and updates:

OGDF doesn't fully support UML Class diagrams yet!
All the required elements of the UML Class Diagram such as Class (attributes, methods, visibility, etc.) and relationships (inheritance, composition, aggregation, etc.) are not available.
The image generation through SVG (please refer to SvgPrinter) does not support the components of a Class Diagram mentioned above.
The generation of a similar diagram like the first one could be emulated by writing everything (just like HTML + CSS + SVG) but that's a non-trivial task.
To do this, the drawing and layout of each element need to be manually planned and generated. Then, what's the point of using OGDF at all?
This could be done by writing a custom library that only deals with UML diagrams i.e. the required types, algorithms, and image generation mechanism.

Additionally, I've tried to use its GML and GraphML formats but it didn't work.
It's unable to even read the file generated by its own code (please refer to these examples).


On the other hand, I tried yEd and it supports these things out-of-the-box and is pretty straightforward to use.
Here's one of its sample UML Class diagram:

yed-uml-diagram

To sum up, if the objective is just to provide Ruby bindings for OGDF APIs then that should be targeted.
The bindings may be updated as and when the UML support is added or as the library itself grows.
Otherwise, a standalone Ruby version of OGDF (not necessarily based on OGDF) may be developed.
And, that is a non-trivial and long-term commitment.

@elquimista
Copy link

@ronaldtse @DmitryDrobotov @w00lf ☝️

@ronaldtse
Copy link
Contributor Author

@elquimista could you provide the code you wrote for both diagrams? You mentioned about code attached but I don't see them...

All the required elements of the UML Class Diagram such as Class (attributes, methods, visibility, etc.) and relationships (inheritance, composition, aggregation, etc.) are not available.

The first diagram, generated via OGDF, contains attributes, generalization and composition.

yEd does not meet our requirements for drawing these: https://github.com/lutaml/lutaml-uml/issues

What exactly did you mean by:

This could be done by writing a custom library that only deals with UML diagrams i.e. the required types, algorithms, and image generation mechanism.
?

Were you able to find out how to do diagrams like this?

https://ogdf.uos.de/doc/dir_d2bf5410fcb0d0ed7083a64a0eaec90a.html
Screen Shot 2020-08-27 at 1 20 52 AM

Maybe the approach is we have to do a C++ program in OGDF to handle our UML syntax and create a Ruby binding for that.

@elquimista
Copy link

@ronaldtse

Could you provide the code you wrote for both diagrams? You mentioned code attached but I don't see them.

Sorry I thought I attached it. Here's the code: ogdf-example.zip

The first diagram, generated via OGDF, contains attributes, generalization, and composition.

A code reference may have helped but could not find anything remotely similar. Even if it was developed with OGDF, its support must be buried deep in its Git history. Maybe, you want to look at that.

yEd does not meet our requirements.

Right.

What exactly did you mean by this:

This could be done by writing a custom library that only deals with UML diagrams i.e. the required types, algorithms, and image generation mechanism.
?

OGDF doesn't support UML fully and it's going to be removed.
Its source code for layouts and rendering shows that the required functionality is not there.
The SvgPrinter module that renders the images in SVG doesn't include UML components.

So, it was suggested that the required components, algorithms, and renderer may be custom-developed.

Were you able to find out how to do diagrams like this?

These are simple graphs with a different layout (planar + upward + weighted edges), not UML Class diagrams.

Maybe the approach is we have to do a C++ program in OGDF to handle our UML syntax and create a Ruby binding for that.

Which is akin to build a custom library altogether, as I mentioned earlier, and that from the scratch.

@w00lf
Copy link

w00lf commented Aug 28, 2020

@ronaldtse

Could you provide the code you wrote for both diagrams? You mentioned code attached but I don't see them.

Sorry I thought I attached it. Here's the code: ogdf-example.zip

The first diagram, generated via OGDF, contains attributes, generalization, and composition.

A code reference may have helped but could not find anything remotely similar. Even if it was developed with OGDF, its support must be buried deep in its Git history. Maybe, you want to look at that.

yEd does not meet our requirements.

Right.

What exactly did you mean by this:

This could be done by writing a custom library that only deals with UML diagrams i.e. the required types, algorithms, and image generation mechanism.
?

OGDF doesn't support UML fully and it's going to be removed.
Its source code for layouts and rendering shows that the required functionality is not there.
The SvgPrinter module that renders the images in SVG doesn't include UML components.

So, it was suggested that the required components, algorithms, and renderer may be custom-developed.

Were you able to find out how to do diagrams like this?

These are simple graphs with a different layout (planar + upward + weighted edges), not UML Class diagrams.

Maybe the approach is we have to do a C++ program in OGDF to handle our UML syntax and create a Ruby binding for that.

Which is akin to build a custom library altogether, as I mentioned earlier, and that from the scratch.

That's strange, we have made research before about ogdf capabilities and most of the sources tell that it can be used to create complex uml state diagrams, for example - http://publications.lib.chalmers.se/records/fulltext/252095/252095.pdf, in 2.4.1 ogdf described as a modular library capable of rendering complex diagrams. Maybe there are some additional libraries(plugins) for ogdf that extend its drawing capabilities?

@elquimista
Copy link

That discusses State Machines (useful for FA, TG, GTG, etc.), not Class Diagrams.

Here are some of the resources that I've gone through:

Maybe there are some additional libraries (plugins) for ogdf that extend its drawing capabilities?

That may be the case. But, then something must pop up in the search results, GitHub history, or the source code.
Even if someone or some company is doing it with OGDF then most probably that would be proprietary.

@ronaldtse
Copy link
Contributor Author

Which is akin to build a custom library altogether, as I mentioned earlier, and that from the scratch.

@elquimista can you help do this? The point is we want to create that UML diagram.

@elquimista
Copy link

@ronaldtse I'd like to help you with this provided that the detailed specs are complete and I'm not busy on other things.
Regardless, I'd be able to spend some time on the weekends depending on my availability.
Also, it would be very helpful to know what this library would be expected to provide in terms of usability and performance.

@w00lf
Copy link

w00lf commented Sep 3, 2020

@ronaldtse I'd like to help you with this provided that the detailed specs are complete and I'm not busy on other things.
Regardless, I'd be able to spend some time on the weekends depending on my availability.
Also, it would be very helpful to know what this library would be expected to provide in terms of usability and performance.

The main requirement here is to create a collection of predefined methods that we can use as native extensions from our ruby library like described here - http://tristanpenman.com/blog/posts/2018/09/16/extending-ruby-with-cpp/. performance won't be an issue here, the largest diagram we encounter so far in our docs consists of 15 nodes. @elquimista do you think it will be possible to create such collection of methods?

@ronaldtse
Copy link
Contributor Author

Ping @elquimista

@elquimista
Copy link

@ronaldtse Did you get my email I sent on Sep 3?

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

No branches or pull requests

4 participants