开发者

How to design a UML diagram with a scripting language?

开发者 https://www.devze.com 2023-01-04 16:57 出处:网络
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

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-s开发者_开发技巧tandard 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);


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.


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消