fsm:tools
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
fsm:tools [2007/05/03 15:36] – fgm | fsm:tools [2020/11/23 17:23] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Tools usable with the OSInet FSM ====== | ====== Tools usable with the OSInet FSM ====== | ||
+ | ===== Generating FSM from UML State machine diagrams ===== | ||
- | ===== Generating FSM files ===== | + | Since the FSM (>= 1.3) now uses external schema |
- | Since the FSM (>= 1.3) now uses external schema files, it seems only logical to generate these from a visual editor instead of hand-typing them. And with OOo being the de facto standard for office work, OOo Draw seems a logical choice. | + | In addition, while I'd gladly have used Dia or Inkscape as a drawing tools, both are significantly less easy to use for this type of diagramming (IMHO), so the first UML to FSM converter rests on OOo Draw. |
+ | Now, how can one go about it ? Simply enough, with OpenDocument being an open standard, its layout is rather obvious. | ||
- | Now, how can one go about it ? Simply enough, with OpenDocument being an open standard, its layour | + | However, in the long run, Dia has dedicated UML formatting, and hence seems a more logical choice, although it is far less easy to use. So the maintained converter, at least for now, uses Dia files. |
- | ==== The FSM subset | + | ==== OOo Draw to FSM ==== |
+ | === A FSM subset | ||
The data in OpenDocument drawings is held in the '' | The data in OpenDocument drawings is held in the '' | ||
Line 18: | Line 21: | ||
* '' | * '' | ||
* '' | * '' | ||
- | * the child '' | + | * the child '' |
* name | * name | ||
* event guard (ignored in version 1.3) | * event guard (ignored in version 1.3) | ||
Line 24: | Line 27: | ||
* action | * action | ||
- | + | === Sample data === | |
- | ==== Sample data ==== | + | |
This following excerpt represents the useful part of a two-state transition diagram: | This following excerpt represents the useful part of a two-state transition diagram: | ||
- | < | + | |
+ | < | ||
| | ||
< | < | ||
Line 53: | Line 56: | ||
</ | </ | ||
- | ==== Parsing the graph ==== | + | === Parsing the graph === |
Supposing for now that the OOo document has already been unzipped to directory '' | Supposing for now that the OOo document has already been unzipped to directory '' | ||
- | <php> | ||
- | <?php | ||
+ | <code php> | ||
error_reporting(E_ALL|E_STRICT); | error_reporting(E_ALL|E_STRICT); | ||
- | | + | |
$doc = new DOMDocument(); | $doc = new DOMDocument(); | ||
$doc-> | $doc-> | ||
$doc-> | $doc-> | ||
- | |||
$xpath = new DOMXPath($doc); | $xpath = new DOMXPath($doc); | ||
$xpath-> | $xpath-> | ||
Line 77: | Line 78: | ||
. ' | . ' | ||
$result = $xpath-> | $result = $xpath-> | ||
- | |||
foreach ($result as $node) | foreach ($result as $node) | ||
{ | { | ||
Line 102: | Line 102: | ||
} | } | ||
} | } | ||
- | </php> | + | </code> |
+ | |||
+ | From there on, it's a simple matter of merging the two trees and generating the resulting FSM XML file. | ||
+ | |||
+ | ==== Dia UML to FSM ==== | ||
+ | |||
+ | Like OOo, Dia saves its content in an easy to parse zipped XML format. | ||
+ | |||
+ | Since Dia includes dedicated UML widgets, these can be used to semantically extract them instead of relying on format limitations as was the case in the OOo converter test. | ||
+ | |||
+ | The elements recognized are: | ||
+ | |||
+ | * "UML - State Term": used for initial and final states | ||
+ | * "UML - State": | ||
+ | * "UML - Transition": | ||
+ | * Trigger (event) | ||
+ | * Guard (event outcome) | ||
+ | * Action (post-state-switch behaviour) | ||
+ | |||
+ | Other UML elements are available but not processed yet. The "UML - Fork" division/ |
fsm/tools.1178206594.txt.gz · Last modified: 2020/11/23 17:23 (external edit)