User Tools

Site Tools


fsm:tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
fsm:tools [2007/06/10 16:37] fgmfsm: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 from UML State machine diagrams =====
  
Line 14: Line 11:
  
 ==== OOo Draw to FSM ==== ==== OOo Draw to FSM ====
- 
- 
 === A FSM subset for OOo Draw === === A FSM subset for OOo Draw ===
  
Line 31: Line 26:
       * output conditions       * output conditions
       * 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:
-<file>+ 
 +<file xml>
    [..snip..]    [..snip..]
     <draw:page draw:name="page1" draw:style-name="dp1" draw:master-page-name="Standard">     <draw:page draw:name="page1" draw:style-name="dp1" draw:master-page-name="Standard">
Line 60: Line 55:
   [..snip..]   [..snip..]
 </file> </file>
- 
- 
  
 === Parsing the graph === === Parsing the graph ===
  
 Supposing for now that the OOo document has already been unzipped to directory ''draw2'', here is a possible piece of code to parse the FSM: Supposing for now that the OOo document has already been unzipped to directory ''draw2'', here is a possible piece of code to parse the FSM:
-<php>+ 
 +<code php>
 error_reporting(E_ALL|E_STRICT); error_reporting(E_ALL|E_STRICT);
-  +
 $doc = new DOMDocument(); $doc = new DOMDocument();
 $doc->preserveWhiteSpace = false; $doc->preserveWhiteSpace = false;
 $doc->load('draw2/content.xml'); $doc->load('draw2/content.xml');
- 
 $xpath = new DOMXPath($doc); $xpath = new DOMXPath($doc);
 $xpath->registerNamespace('office', "urn:oasis:names:tc:opendocument:xmlns:office:1.0"); $xpath->registerNamespace('office', "urn:oasis:names:tc:opendocument:xmlns:office:1.0");
Line 85: Line 78:
   . ')';   . ')';
 $result = $xpath->query($qnodes, $doc); $result = $xpath->query($qnodes, $doc);
- 
 foreach ($result as $node) foreach ($result as $node)
   {   {
Line 110: Line 102:
     }     }
   }   }
-</php>+</code>
  
 From there on, it's a simple matter of merging the two trees and generating the resulting FSM XML file. 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": used for other states
 +  * "UML - Transition": used for transitions. Properties include:
 +    * Trigger (event)
 +    * Guard (event outcome)
 +    * Action (post-state-switch behaviour)
 +
 +Other UML elements are available but not processed yet. The "UML - Fork" division/reunion bar could be the next addition, but state nesting is not being considered.
fsm/tools.1181493468.txt.gz · Last modified: 2020/11/23 17:23 (external edit)