MetaUML

This article or chapter is incomplete and its contents need further attention. Some information may be missing or may be wrong, spelling and grammar may have to be improved, use your judgment!

SORRY this page is broken. Had to remove an uml extension for security reasons - Daniel K. Schneider (talk) 16:57, 21 August 2013 (CEST)

## Contents

* 1 Definition
* 2 Examples
* 3 Using the MediaWiki extension
* 4 Installation notes for Linux Ubuntu
* 5 Installation notes for MetaUML and Mediawiki extension for Solaris
* 6 Links

## Definition[edit | edit source]

MetaUML is a GNU GPL MetaPost library for typesetting UML diagrams, using a human-friendly textual notation. Currently (nov 2008) it offers support for class diagrams, package diagrams, activity diagrams, state machine diagrams use case diagrams and component diagrams.

MetaUML can be used to:

* Create UML diagrams readily usable in a LaTeX article or book.
* Create independent PDF-s
* Create jpeg-s, png-s etc.
* Insert UML diagrams in Mediawikis (provided that the extension is installed)

This page is for people who don't mind to draw by writing code. If you are looking for a simple drawing program to draw UML diagrams (or quasi UML diagrams), see the Unified modeling language, e.g. have a look at the free Dia program.

Sorry, there is no how-to for now. Look at examples and the manual.

## Examples[edit | edit source]

Some drawing that uses empty classes and notes

To make simple drawings, I figured that it is enough to do the following:

* Define each object
* Stack them by using constraints (x, y z are distributed horizontally or vertically)
* Then draw lines from x.compass_direction to y.compass_direction

Look at the source of the follwing example:

<uml>
ClassName.FB("Flex Builder 3");
ClassName.MXML("MXML Compiler");

Note.HTML("application.html");
Note.SWF("application.swf");

Note.AP("Application Project","(directory structure)");
Note.CO("Code", "(MXML and ActionScript)" );
Note.A("Multimedia Assets", "(Images, Audio, ..)");
Note.L("Libraries");

leftToRight(30)(FB,MXML,HTML);
topToBottom(20)(HTML,SWF);
topToBottom(20)(FB,AP);
leftToRight(30)(CO,A,L);
topToBottom(20)(AP,A);

drawObjects(FB, MXML,HTML,SWF,AP,CO,A,L);

link(association)(FB.e -- MXML.w);
link(association)(FB.s -- AP.n);
link(association)(AP.s -- CO.n);
link(association)(AP.s -- A.n);
link(association)(AP.s -- L.n);

link(associationUni)(MXML.e -- HTML.w);
link(associationUni)(MXML.e -- SWF.w);
</uml>

Diagrams error (with plantuml command): /bin/bash: line 1: plantuml: command not found

The following was copied from the Extension:UML page

Activity diagram

Diagrams error (with plantuml command): /bin/bash: line 1: plantuml: command not found

State diagram

Diagrams error (with plantuml command): /bin/bash: line 1: plantuml: command not found

## Using the MediaWiki extension[edit | edit source]

Using the MetaUML uml tag in a mediawiki is quite tricky. The only way to figure out errors is to install this software locally (or log on to your wiki server machine) and then test like this. E.g code like this:

<uml>
Fork.forkA("h", 100);
Fork.forkB("v", 20);
leftToRight(10)(forkA, forkB);
drawObjects(forkA, forkB);
</uml>

goes into a xxx.mp file like this:

input metauml;
beginfig(1);
Fork.forkA("h", 100);
Fork.forkB("v", 20);
leftToRight(10)(forkA, forkB);
drawObjects(forkA, forkB);
endfig;
end

Then, type in a console:

mpost xxx.mp

## Installation notes for Linux Ubuntu[edit | edit source]

Install textlive first via aptitude, apt-get or synaptic.

As of Sept 2009, Ubuntu distributes a very old version, since it relies on the CTAN archive which isn't updated with MetaUML. The old version is 0.2.3 and since 1996 the good version is 0.2.5.

You can copy the files to:

usr/share/texmf-texlive/metapost/metauml/

Then type:

texhash

(though I wonder what happens if you then upgrade textlive to an other old MetaUML distro. There certainly must be smarter way...)

Also, I found a missing font: ptmr8r

apt-get install texlive-fonts-recommended

Note on debugging. If you use this with the MediaWiki extension. Quote lines in MetaUML.php.

//    unlink($wgTmpDirectory."/".$tmp_filename.".mp");
//      unlink($wgTmpDirectory."/".$tmp_filename.".log");
//      unlink($wgTmpDirectory."/".$tmp_filename.".1");

Then watch the *.log files in the Mediawiki /images/tmp directory. You also then can directly type something like:

mpost c35cdfb376362cf4eabede45a0762dd7.mp

... and enjoy the error messages (*.mp is the temporary file that mpost then must process)

## Installation notes for MetaUML and Mediawiki extension for Solaris[edit | edit source]

Installing the necessary software requires some installation skills. Here are my (rough) installation notes

Step: Make sure that latex, dvips, gs (ghostscript), and convert (ImageMagick) installed and available in the PATH. Depending on how the system is installed, this also means to fix the path of the Apache webserver.

It probably would be a good idea to install livetex, but since I found I binary for (older) teTex I went with this. texTex in /opt/sfw wasn't correctly installed. Got a new version from http://www.sunfreeware.com/. This package installs in /usr/local

gunzip tetex-3.0-sol10-sparc-local.gz
pkgadd -d tetex-3.0-sol10-sparc-local

teTex now should be installed and there is some postinstall work to do

* Add /usr/local/teTeX/bin/sparc-sun-solaris2.10 to the path.
* Configure

texconfig conf

Step: Install texvc (maybe not needed). This is a standard Mediawiki script to render Latex math fragments.

* It's already in the mediawiki distribution
* Read: http://en.wikipedia.org/wiki/Texvc and compile.

Step: Get the MediaWiki extension

http://www.mediawiki.org/wiki/Extension:UML

Step: Fix some configuration variables. Some documentation on variables is here:

* http://www.mediawiki.org/wiki/Manual:Configuration_settings

You have to make sure that all these variables are defined:

$wgUseTeX	    = true;
$wgMathPath         = "{$wgUploadPath}/math";
$wgMathDirectory    = "{$wgUploadDirectory}/math";
$wgTmpDirectory     = "{$wgUploadDirectory}/tmp";
$wgImageMagickIdentifyCommand="/usr/local/bin/identify";
$wgImageMagickConvertCommand = "/usr/local/bin/convert";
$wgDvipsCommand="/usr/local/teTeX/bin/sparc-sun-solaris2.10/dvips";

Step: Install MetaUML, UML for LaTeX/MetaPost

* Get the archive from http://metauml.sourceforge.net/
* Decompress
* Copy files into /usr/local/teTeX/share/texmf-dist/metauml
* texhash

## Links[edit | edit source]

* MetaUML home page (sourceforge). Includes a manual and examples
* PDF manual