MetaUML: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
 
Line 12: Line 12:
* Create jpeg-s, png-s etc.
* Create jpeg-s, png-s etc.
* Insert UML diagrams in Mediawikis (provided that the extension is installed)
* 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.


== Examples ==
== Examples ==


; Some drawing that uses empty classes and notes
<uml>
<uml>
ClassName.FB("Flex Builder 3");
ClassName.FB("Flex Builder 3");
Line 48: Line 51:
The following was copied from the [http://www.mediawiki.org/wiki/Extension:UML Extension:UML] page
The following was copied from the [http://www.mediawiki.org/wiki/Extension:UML Extension:UML] page


; Activity diagram
<uml>
<uml>
Begin.b;
Begin.b;
Line 80: Line 84:
</uml>
</uml>


; State diagram


<uml>
<uml>

Revision as of 14:19, 6 November 2008

<pageby nominor="false" comments="false"/>

Definition

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.

Examples

Some drawing that uses empty classes and notes

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

The following was copied from the Extension:UML page

Activity diagram

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

State diagram

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


Using the MediaWiki extension

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 redraw>
 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 MetaUML and Mediawiki extension for Solaris

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.

Step: Get the MediaWiki extension

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

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

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

Links