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. More...
#include <ogdf/fileformats/UmlToGraphConverter.h>
Public Member Functions | |
| UmlToGraphConverter (istream &is) | |
| Constructor. More... | |
| ~UmlToGraphConverter () | |
| Destructor. More... | |
| const SList< UmlDiagramGraph * > & | getDiagramGraphs () const |
| Access to diagram graphs. More... | |
| const SList< UMLGraph * > & | getDiagramGraphsInUMLGraphFormat () const |
| Access to the diagrams graphs in UMLGraph format. More... | |
| const UmlModelGraph & | getModelGraph () const |
| Access to model graph. More... | |
| void | printDiagramsInUMLGraphFormat (ofstream &os) |
Prints the content of each diagram to os. More... | |
| void | printIdToNodeMappingTable (ofstream &os) |
| Print hash table which maps the ids to the nodes. More... | |
Private Member Functions | |
| bool | createDiagramGraphs () |
| For each diagram converts the relevant information contained in the parse tree into the data structure of UmlDiagramGraph. More... | |
| bool | createDiagramGraphsInUMLGraphFormat (SList< UMLGraph *> &diagramGraphsInUMLGraphFormat) |
| Transforms each diagram graph contained in m_diagramGraphs into an equivalent. More... | |
| bool | createModelGraph (UmlModelGraph &modelGraph) |
| Converts the relevant information contained in the parse tree into the data structure of UmlModelGraph. More... | |
| void | initializePredefinedInfoIndices () |
| Inserts known strings for tags and attributes into the hashtable of the parser. More... | |
| bool | insertDependencyEdges (const XmlTagObject ¤tRootTag, UmlModelGraph &modelGraph) |
| Identifies dependency tags inside the parse tree and inserts a new edge between the corresponding nodes of the involved elements. More... | |
| bool | insertSpecificClassifierNodes (const XmlTagObject ¤tRootTag, const string currentPackageName, int desiredClassifier, UmlModelGraph &modelGraph) |
Tries to find all classifiers of type desiredClassifier inside the parse tree (starting at currentRootTag). More... | |
| bool | traversePackagesAndInsertAssociationEdges (const XmlTagObject ¤tRootTag, UmlModelGraph &modelGraph) |
| Traverses the package structure and identifies associations inside the parse tree and inserts a new edge between the corresponding nodes of the involved classifiers. More... | |
| bool | traversePackagesAndInsertClassifierNodes (const XmlTagObject ¤tRootTag, const string ¤tPackageName, UmlModelGraph &modelGraph) |
Traverses the package structure and identifies classifiers inside the parse tree (starting at currentRootTag) and inserts a new node for each classifier. More... | |
| bool | traversePackagesAndInsertGeneralizationEdges (const XmlTagObject ¤tRootTag, UmlModelGraph &modelGraph) |
| Traverses the package structure and identifies generalization inside the parse tree and inserts a new edge between the corresponding nodes of the involved classifiers. More... | |
Private Attributes | |
| SList< UmlDiagramGraph * > | m_diagramGraphs |
| The set of graphs which represent special diagrams contained in the model. More... | |
| SList< UMLGraph * > | m_diagramGraphsInUMLGraphFormat |
| This list contains the set of graphs of the list m_diagramGraphs in UMLGraph format. More... | |
| Hashing< int, edge > | m_idToEdge |
| Maps string info to edge. More... | |
| Hashing< int, node > | m_idToNode |
| Maps string info to node. More... | |
| UmlModelGraph * | m_modelGraph |
| The graph which represents the complete UML model. More... | |
| XmlParser * | m_xmlParser |
| The parser used for parsing the input file. More... | |
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 62 of file UmlToGraphConverter.h.
|
strongprivate |
Predefined info indices for known tag and attribute names.
Definition at line 83 of file UmlToGraphConverter.h.
|
explicit |
Constructor.
The constructor performs the following:
| is | The input stream of the xml file which contains the data of the uml model to be converted into the graph format. |
| ogdf::UmlToGraphConverter::~UmlToGraphConverter | ( | ) |
Destructor.
The destructor destroys:
|
private |
For each diagram converts the relevant information contained in the parse tree into the data structure of UmlDiagramGraph.
|
private |
Transforms each diagram graph contained in m_diagramGraphs into an equivalent.
| diagramGraphsInUMLGraphFormat | The list of diagram graphs in UMLGraph format which have been obtained from the diagram graphs. |
|
private |
Converts the relevant information contained in the parse tree into the data structure of UmlModelGraph.
| modelGraph | The model graph into which the nodes and edges corresponding to UML elements and UML relations should be inserted. |
|
inline |
Access to diagram graphs.
Definition at line 166 of file UmlToGraphConverter.h.
|
inline |
Access to the diagrams graphs in UMLGraph format.
Definition at line 173 of file UmlToGraphConverter.h.
|
inline |
Access to model graph.
Definition at line 159 of file UmlToGraphConverter.h.
|
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.
|
private |
Identifies dependency tags inside the parse tree and inserts a new edge between the corresponding nodes of the involved elements.
| currentRootTag | The tag where to start the search for dependencies. |
| modelGraph | The model graph into which edges are inserted. |
|
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.
| 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. |
| void ogdf::UmlToGraphConverter::printDiagramsInUMLGraphFormat | ( | ofstream & | os | ) |
Prints the content of each diagram to os.
| os | The output stream where to direct the output to. |
| void ogdf::UmlToGraphConverter::printIdToNodeMappingTable | ( | ofstream & | os | ) |
Print hash table which maps the ids to the nodes.
| os | The output stream where to direct the output to. |
|
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.
| currentRootTag | The tag where to start the search for associations. |
| modelGraph | The model graph into which edges are inserted. |
|
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.
| 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. |
|
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().
| currentRootTag | The tag where to start the search for generalizations. |
| modelGraph | The model graph into which edges are inserted. |
|
private |
The set of graphs which represent special diagrams contained in the model.
Definition at line 74 of file UmlToGraphConverter.h.
This list contains the set of graphs of the list m_diagramGraphs in UMLGraph format.
The transformation is performed in the constructor UmlToGraphConverter().
Definition at line 80 of file UmlToGraphConverter.h.
Maps string info to edge.
The functionality is the same as for m_idToNode.
Definition at line 130 of file UmlToGraphConverter.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 125 of file UmlToGraphConverter.h.
|
private |
The graph which represents the complete UML model.
Definition at line 69 of file UmlToGraphConverter.h.
|
private |
The parser used for parsing the input file.
Definition at line 66 of file UmlToGraphConverter.h.