How to create a UML diagram with a scripting language?

I am developing a software component that will receive instructions from other components about how the UML diagram should look, and then create this UML diagram in different ways of presentation (for example, in SVG, GIF, etc.) (for example, Java):

DiagramDesigner designer = new DiagramDesigner(); designer.setStyle('Use Cases') designer.addActor('User'); designer.addUseCase('Print Document'); // etc. String svg = designer.getSvg(); 

I do not want to reinvent the wheel and want to use some kind of standard language / interface for the connection between my DiagramDesigner and other components. I am looking for an interface similar to the DOM, but for UML, not XML.

Can anyone help? Thanks in advance.

ps. Besides the above example, I would like to make my diagrams interdependent and portable between servers, for example:

 // first server String script = designer.getScript(); // second server DiagramDesigner desiger2 = DiagramDesigner.import(script); 
+4
source share
4 answers

So, if you understood correctly, you are looking for a way to work with UML at the metamodel level. You should look at the MOF standard and its implementation of EMF (Eclipse Modeling Framework), which is used by almost all Eclipse-based UML tools, and this structure is used by many other modeling projects, it even influenced the MOF standardization somewhat (as a result of SMOF and EMOF), and therefore I would call it an industry standard.

+2
source

Probably only loosely coupled, but in any case: PlantUML . It is open source, built in Java and probably already contains some of what you want to do.

+2
source

You can inspire these scenarios to generate any desired result: http://askuml.com/

Currently, examples are given in yUML because they are good, but can be anything.

+1
source

At least for part of the syntax, you can get inspiration from a large set of UML text tools (these theses allow designers to specify a model in text mode, and then they automatically display the model graphically using standard UML notation).

At least such tools are here: http://modeling-languages.com/content/uml-tools#textual

0
source

Source: https://habr.com/ru/post/1313372/


All Articles