yegor256
yegor256

Reputation: 105063

How to design a UML diagram with a scripting language?

I'm designing a software component which will get instructions from other components on how the UML diagram should look like, and then will produce this UML diagram in different presentation ways (in SVG, GIF, etc.), for example (in Java):

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

I don't want to re-invent the wheel and want to use some industry-standard language/interface for interconnection between my DiagramDesigner and other components. I'm looking for an interface similar to DOM, but for UML, not for XML.

Can anyone help? Thanks in advance.

ps. Besides the example above I would like to make my diagrams inter-operable and transferrable between servers, e.g.:

// first server
String script = designer.getScript();
// second server
DiagramDesigner desiger2 = DiagramDesigner.import(script);

Upvotes: 4

Views: 5984

Answers (4)

Rebol Tutorial
Rebol Tutorial

Reputation: 2754

You can inspire from these scripts to generate any output you want: http://askuml.com/

Currently examples are given in yUML because they're nice but could be anything.

Upvotes: 1

Jordi Cabot
Jordi Cabot

Reputation: 8228

At least for the syntax part, you could get some inspiration from the large set of textual UML tools (theses tools allow designers to textually specify the model and then they automatically show the model graphically using the standard UML notation).

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

Upvotes: 0

Gabriel Ščerbák
Gabriel Ščerbák

Reputation: 18570

So if I understand you right, you are looking for a way to work with UML on the metamodel level. You should look at the MOF standard and its implementation the EMF (Eclipse Modeling Framework), which is used by almost all Eclipse based UML tools and this framework is used by many other modeling projects, it even somewhat influenced the standardization of MOF (resulting in SMOF and EMOF split) and therefore I would declare it industry standard.

Upvotes: 3

Bernd
Bernd

Reputation: 3418

Probably only loosely related but anyhow: PlantUML. It is open source, built in Java and likely contains already parts of what you want to do.

Upvotes: 2

Related Questions