Open
Graph Drawing
Framework

 v.2010.10
 

Public Member Functions | Private Types | Private Member Functions | Private Attributes

ogdf::DinoUmlToGraphConverter Class Reference

#include <ogdf/fileformats/DinoUmlToGraphConverter.h>

List of all members.

Public Member Functions

 DinoUmlToGraphConverter (const char *fileName)
 ~DinoUmlToGraphConverter ()
const DinoUmlModelGraphgetModelGraph () const
const SList
< DinoUmlDiagramGraph * > & 
getDiagramGraphs () const
const SList< UMLGraph * > & getDiagramGraphsInUMLGraphFormat () const
void printDiagramsInUMLGraphFormat (ofstream &os)
void printIdToNodeMappingTable (ofstream &os)

Private Types

enum  PredefinedInfoIndex {
  xmi = 0, xmiContent, xmiId, umlModel,
  umlNamespaceOwnedElement, umlClass, name, umlGeneralization,
  child, parent, umlAssociation, umlAssociationConnection,
  umlAssociationEnd, type, umlDiagram, rootUmlDiagramElement,
  umlDiagramElement, geometry, subject, umlPackage,
  umlInterface, umlDependency, client, supplier,
  diagramType, classDiagram, moduleDiagram, nextPredefinedInfoIndex
}

Private Member Functions

void initializePredefinedInfoIndices ()
bool createModelGraph (DinoUmlModelGraph &modelGraph)
bool traversePackagesAndInsertClassifierNodes (const XmlTagObject &currentRootTag, String currentPackageName, DinoUmlModelGraph &modelGraph)
bool insertSpecificClassifierNodes (const XmlTagObject &currentRootTag, String currentPackageName, int desiredClassifier, DinoUmlModelGraph &modelGraph)
bool traversePackagesAndInsertAssociationEdges (const XmlTagObject &currentRootTag, DinoUmlModelGraph &modelGraph)
bool traversePackagesAndInsertGeneralizationEdges (const XmlTagObject &currentRootTag, DinoUmlModelGraph &modelGraph)
bool insertDependencyEdges (const XmlTagObject &currentRootTag, DinoUmlModelGraph &modelGraph)
bool createDiagramGraphs ()
bool createDiagramGraphsInUMLGraphFormat (SList< UMLGraph * > &diagramGraphsInUMLGraphFormat)

Private Attributes

DinoXmlParserm_xmlParser
DinoUmlModelGraphm_modelGraph
SList< DinoUmlDiagramGraph * > m_diagramGraphs
SList< UMLGraph * > m_diagramGraphsInUMLGraphFormat
Hashing< int, NodeElement * > m_idToNode
Hashing< int, EdgeElement * > m_idToEdge
ofstream * m_logFile

Detailed Description

This class performs all necessary steps to obtain a model graph and diagram graphs from the input file which contains an UML model in XML format. In particular the following is done:

The graphs can be accessed via the functions getModelGraph() and getDiagramGraphs().

In debug mode warnings and the content of the model graph and the diagram graphs are written into the log file named umlToGraphConversionLog.txt.

Definition at line 88 of file DinoUmlToGraphConverter.h.


Member Enumeration Documentation

Predefined info indices for known tag and attribute names.

Enumerator:
xmi 
xmiContent 
xmiId 
umlModel 
umlNamespaceOwnedElement 
umlClass 
name 
umlGeneralization 
child 
parent 
umlAssociation 
umlAssociationConnection 
umlAssociationEnd 
type 
umlDiagram 
rootUmlDiagramElement 
umlDiagramElement 
geometry 
subject 
umlPackage 
umlInterface 
umlDependency 
client 
supplier 
diagramType 
classDiagram 
moduleDiagram 
nextPredefinedInfoIndex 

Definition at line 87 of file DinoUmlToGraphConverter.h.


Constructor & Destructor Documentation

ogdf::DinoUmlToGraphConverter::DinoUmlToGraphConverter ( const char *  fileName  ) 

Constructor. The constructor performs the following:

Parameters:
fileName The file name of the xml file which contains the data of the uml model to be converted into the graph format.
ogdf::DinoUmlToGraphConverter::~DinoUmlToGraphConverter (  ) 

Destructor. The destructor destroys:


Member Function Documentation

bool ogdf::DinoUmlToGraphConverter::createDiagramGraphs (  )  [private]

For each diagram converts the relevant information contained in the parse tree into the data structure of DinoUmlDiagramGraph. Error messages are reported in m_logFile.

Returns:
Returns true if conversion was succesful, false otherwise.
Todo:
Currently only class diagrams are handled. Must be extended to handle other kinds of uml diagrams.
bool ogdf::DinoUmlToGraphConverter::createDiagramGraphsInUMLGraphFormat ( SList< UMLGraph * > &  diagramGraphsInUMLGraphFormat  )  [private]

Transforms each diagram graph contained in m_diagramGraphs into an equivalent Error messages are reported in m_logFile.

Parameters:
diagramGraphsInUMLGraphFormat The list of diagram graphs in UMLGraph format which have been obtained from the diagram graphs.
Returns:
Returns true if conversion was successful, false otherwise.
bool ogdf::DinoUmlToGraphConverter::createModelGraph ( DinoUmlModelGraph modelGraph  )  [private]

Converts the relevant information contained in the parse tree into the data structure of DinoUmlModelGraph. Error messages are reported in m_logFile.

Parameters:
modelGraph The model graph into which the nodes and edges corresponding to uml elements and uml relations should be inserted.
Returns:
Returns true if conversion was succesful, false otherwise.
const SList<DinoUmlDiagramGraph*>& ogdf::DinoUmlToGraphConverter::getDiagramGraphs (  )  const [inline]

Access to diagram graphs.

Returns:
A const reference to the list of diagram graphs.

Definition at line 179 of file DinoUmlToGraphConverter.h.

const SList<UMLGraph*>& ogdf::DinoUmlToGraphConverter::getDiagramGraphsInUMLGraphFormat (  )  const [inline]

Access to the diagrams graphs in UMLGraph format.

Returns:
A const reference to a list of diagram graphs in UMLGraph format.

Definition at line 186 of file DinoUmlToGraphConverter.h.

const DinoUmlModelGraph& ogdf::DinoUmlToGraphConverter::getModelGraph (  )  const [inline]

Access to model graph.

Returns:
A const reference to the model graph.

Definition at line 172 of file DinoUmlToGraphConverter.h.

void ogdf::DinoUmlToGraphConverter::initializePredefinedInfoIndices (  )  [private]

Inserts known strings for tags and attributes into the hashtable of the parser. The info elements for the hashtable are taken from enum PredefinedInfoIndex.

bool ogdf::DinoUmlToGraphConverter::insertDependencyEdges ( const XmlTagObject currentRootTag,
DinoUmlModelGraph modelGraph 
) [private]

Identifies dependency tags inside the parse tree and inserts a new edge between the corresponding nodes of the involved elements.

Parameters:
currentRootTag The tag where to start the search for dependencies.
modelGraph The model graph into which edges are inserted.
Returns:
False if something went wrong, true otherwise.
bool ogdf::DinoUmlToGraphConverter::insertSpecificClassifierNodes ( const XmlTagObject currentRootTag,
String  currentPackageName,
int  desiredClassifier,
DinoUmlModelGraph modelGraph 
) [private]

Tries to find all classifiers of type desiredClassifier inside the parse tree (starting at currentRootTag). Inserts a new node into modelGraph for each classifier found.

Parameters:
currentRootTag The tag where to start the search for the desired classifier.
currentPackageName This string should contain the name of the package path corresponding to currentRootTag.
desiredClassifier The info index of the desired class (see enum PredefinedInfoIndex).
modelGraph The model graph into which nodes are inserted.
Returns:
False if something went wrong, true otherwise.
void ogdf::DinoUmlToGraphConverter::printDiagramsInUMLGraphFormat ( ofstream &  os  ) 

Prints the content of each diagram to os.

Parameters:
os The output stream where to direct the output to.
void ogdf::DinoUmlToGraphConverter::printIdToNodeMappingTable ( ofstream &  os  ) 

Print hash table which maps the ids to the NodeElements.

Parameters:
os The output stream where to direct the output to.
bool ogdf::DinoUmlToGraphConverter::traversePackagesAndInsertAssociationEdges ( const XmlTagObject currentRootTag,
DinoUmlModelGraph modelGraph 
) [private]

Traverses the package structure and identifies associations inside the parse tree and inserts a new edge between the corresponding nodes of the involved classifiers.

Note that it is not possible to include this function into traversePackagesAndInsertClassifierNodes(). The reason is that it is possible that edges are specified prior to that one or both nodes have been created.

Parameters:
currentRootTag The tag where to start the search for associations.
modelGraph The model graph into which edges are inserted.
Returns:
False if something went wrong, true otherwise.
bool ogdf::DinoUmlToGraphConverter::traversePackagesAndInsertClassifierNodes ( const XmlTagObject currentRootTag,
String  currentPackageName,
DinoUmlModelGraph modelGraph 
) [private]

Traverses the package structure and identifies classifiers inside the parse tree (starting at currentRootTag) and inserts a new node for each classifier. This function will call itself recursively while traversing nested packages.

Valid classifiers are currently: class and interface.

Parameters:
currentRootTag The tag where to start the search for classifiers.
currentPackageName This string should contain the name of the package path corresponding to currentRootTag.
modelGraph The model graph into which nodes are inserted.
Returns:
False if something went wrong, true otherwise.
bool ogdf::DinoUmlToGraphConverter::traversePackagesAndInsertGeneralizationEdges ( const XmlTagObject currentRootTag,
DinoUmlModelGraph modelGraph 
) [private]

Traverses the package structure and identifies generalization inside the parse tree and inserts a new edge between the corresponding nodes of the involved classifiers.

It does not make sense to put this function and traversePackagesAndInsertAssociationEdges() together since the generalization tags are inside the class tags, so first the classes have to be identified again in contrast to traversePackagesAndInsertAssociationEdges().

Parameters:
currentRootTag The tag where to start the search for generalizations.
modelGraph The model graph into which edges are inserted.
Returns:
False if something went wrong, true otherwise.

Member Data Documentation

The set of graphs which represent special diagrams contained in the model.

Definition at line 78 of file DinoUmlToGraphConverter.h.

This list contains the set of graphs of the list m_diagramGraphs in UMLGraph format. The transformation is performed in the constructor DinoUmlToGraphConverter().

Definition at line 84 of file DinoUmlToGraphConverter.h.

Maps string info to edge. The functionality is the same as for m_idToNode.

Definition at line 134 of file DinoUmlToGraphConverter.h.

Maps string info to node. We need this hash table for fast access to nodes corresponding to UML elements. For each UML Element in XMI format we have an unique identifier via the xmi.id attribute. The xmi.id attribute is saved as string in the hash table of the parser, hence we can use the info index of it. While scanning for relations between nodes we encounter the xmi.id attribute values of the involved elements referenced as type attribute in the relation. Now we can use the hash table to access the corresponding node.

Definition at line 129 of file DinoUmlToGraphConverter.h.

The log file. The log file is named umlToGraphConversionLog.txt and contains warnings and errors ocurred during the conversion process. Furthermore it contains the content of the model graph m_modelGraph and of the diagram graphs m_diagramGraphs.

Definition at line 142 of file DinoUmlToGraphConverter.h.

The graph which represents the complete UML model.

Definition at line 73 of file DinoUmlToGraphConverter.h.

The parser used for parsing the input file.

Definition at line 70 of file DinoUmlToGraphConverter.h.


The documentation for this class was generated from the following file: