UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
GTXLWriterXerces.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef GTXLWRITERXERCES_H_
21 #define GTXLWRITERXERCES_H_
22 
23 #include "GTXLWriter.h"
24 #include <xercesc/dom/DOMElement.hpp>
25 
26 namespace uncover {
27  namespace io {
28 
34  class GTXLWriterXerces : public GTXLWriter {
35 
36  public:
37 
43 
47  virtual ~GTXLWriterXerces();
48 
49  virtual void writeGXL(vector<graphs::Hypergraph_sp> const& graphs, boost::filesystem::path& filename) const override;
50 
51  virtual void writeGTXL(graphs::GTS const& gts, boost::filesystem::path& filename) const override;
52 
53  private:
54 
61  void writeHypergraph(xercesc::DOMElement* gxlRoot, graphs::Hypergraph const& graph) const;
62 
71  void writeHypergraph(xercesc::DOMElement* gxlRoot, graphs::AnonHypergraph const& graph) const;
72 
81  xercesc::DOMElement* writeHypergraph(xercesc::DOMElement* gxlRoot,
82  graphs::AnonHypergraph const& graph,
83  IDType const& graphID) const;
84 
91  void writeStdRule(xercesc::DOMElement* gtxlRoot, graphs::Rule const& rule) const;
92 
99  void writeUQRule(xercesc::DOMElement* gtxlRoot, graphs::UQRule const& rule) const;
100 
114  void writeRule(xercesc::DOMElement* gtxlRoot,
115  graphs::AnonRule const& rule,
116  IDType id,
117  vector<unordered_set<IDType>> const* leftUQids,
118  vector<unordered_set<IDType>> const* rightUQids) const;
119 
125  string generateGraphID(const IDType& graphID) const;
126 
134  string generateVertexID(const IDType& nodeID, const IDType& graphID) const;
135 
143  string generateEdgeID(const IDType& edgeID, const IDType& graphID) const;
144 
150  string generateRuleID(const IDType& ruleID) const;
151 
157  string generateLeftRulegraphID(const IDType& ruleID) const;
158 
164  string generateRightRulegraphID(const IDType& ruleID) const;
165 
167  // This XML strings will be pre-transcoded and later used in the GXL and GTXL imports.
169  XMLCh* xmlch_gxl;
170  XMLCh* xmlch_graph;
171  XMLCh* xmlch_edgeids;
172  XMLCh* xmlch_true;
173  XMLCh* xmlch_hypergraph;
174  XMLCh* xmlch_id;
175  XMLCh* xmlch_edgemode;
176  XMLCh* xmlch_undirected;
177  XMLCh* xmlch_node;
178  XMLCh* xmlch_vertex;
179  XMLCh* xmlch_rel;
180  XMLCh* xmlch_attr;
181  XMLCh* xmlch_name;
182  XMLCh* xmlch_string;
183  XMLCh* xmlch_label;
184  XMLCh* xmlch_relend;
185  XMLCh* xmlch_target;
186  XMLCh* xmlch_role;
187  XMLCh* xmlch_startorder;
188  XMLCh* xmlch_int;
189 
191  // This XML strings will be pre-transcoded and later used in the GTXL imports.
193  XMLCh* xmlch_gts;
194  XMLCh* xmlch_initial;
195  XMLCh* xmlch_rule;
196  XMLCh* xmlch_lhs;
197  XMLCh* xmlch_rhs;
198  XMLCh* xmlch_rulegraph;
199  XMLCh* xmlch_mapping;
200  XMLCh* xmlch_mapelem;
201  XMLCh* xmlch_from;
202  XMLCh* xmlch_to;
203  XMLCh* xmlch_quantification;
204  XMLCh* xmlch_elem;
205  XMLCh* xmlch_ref;
206 
207  };
208 
209  } /* namespace io */
210 } /* namespace uncover */
211 
212 #endif /* GTXLWRITERXERCES_H_ */
string generateVertexID(const IDType &nodeID, const IDType &graphID) const
Generates a unique XML ID for a vertex of a graph.
Definition: GTXLWriterXerces.cpp:409
virtual void writeGXL(vector< graphs::Hypergraph_sp > const &graphs, boost::filesystem::path &filename) const override
This method takes a collection of Hypergraphs and stores the collection as a GXL XML-file with the gi...
Definition: GTXLWriterXerces.cpp:140
This class exports GXL or GTXL XML files by converting them from Hypergraph and GTS objects respectiv...
Definition: GTXLWriter.h:34
Represents the data structure for a rule including a unique identifier.
Definition: Rule.h:38
GTXLWriterXerces()
Creates a new GTXLWriterXerces object, which includes initialization of the Xerces framework...
Definition: GTXLWriterXerces.cpp:38
This class exports GXL or GTXL XML files by converting them from Hypergraph and GTS objects respectiv...
Definition: GTXLWriterXerces.h:34
AnonRule serves as a data structure of a rule object.
Definition: AnonRule.h:39
void writeUQRule(xercesc::DOMElement *gtxlRoot, graphs::UQRule const &rule) const
Takes a UQRule, converts it to a DOMElement and adds the resulting object as a child of the given DOM...
Definition: GTXLWriterXerces.cpp:271
A Hypergraph represents a graph with a unique identifier.
Definition: Hypergraph.h:35
string generateRightRulegraphID(const IDType &ruleID) const
Generates a unique XML ID for the right graph of a Rule.
Definition: GTXLWriterXerces.cpp:425
string generateGraphID(const IDType &graphID) const
Generates a unique XML ID for a Hypergraph.
Definition: GTXLWriterXerces.cpp:405
string generateEdgeID(const IDType &edgeID, const IDType &graphID) const
Generates a unique XML ID for an edge of a graph.
Definition: GTXLWriterXerces.cpp:413
string generateRuleID(const IDType &ruleID) const
Generates a unique XML ID for a Rule.
Definition: GTXLWriterXerces.cpp:417
An AnonHypergraph is a data structure storing a hypergraph.
Definition: AnonHypergraph.h:43
virtual ~GTXLWriterXerces()
Destroys the GTXLWriterXerces object.
Definition: GTXLWriterXerces.cpp:88
void writeRule(xercesc::DOMElement *gtxlRoot, graphs::AnonRule const &rule, IDType id, vector< unordered_set< IDType >> const *leftUQids, vector< unordered_set< IDType >> const *rightUQids) const
This function is a generalized implementation of writeStdRule(...) and writeUQRule(...).
Definition: GTXLWriterXerces.cpp:278
The GTS class is the data structure for a graph transformation system.
Definition: GTS.h:36
string generateLeftRulegraphID(const IDType &ruleID) const
Generates a unique XML ID for the left graph of a Rule.
Definition: GTXLWriterXerces.cpp:421
This class serves as data structure of a universally quantified rule.
Definition: UQRule.h:38
void writeStdRule(xercesc::DOMElement *gtxlRoot, graphs::Rule const &rule) const
Takes a Rule, converts it to a DOMElement and adds the resulting object as a child of the given DOMEl...
Definition: GTXLWriterXerces.cpp:267
virtual void writeGTXL(graphs::GTS const &gts, boost::filesystem::path &filename) const override
This method takes a GTS object and stores it as a GTXL XML-file with the given filename.
Definition: GTXLWriterXerces.cpp:429
unsigned int IDType
IDType is an (unsigned) integer specifically used as an Identifier of graphs, elements of graphs or a...
Definition: globals.h:53
void writeHypergraph(xercesc::DOMElement *gxlRoot, graphs::Hypergraph const &graph) const
Takes a Hypergraph, converts it to a DOMElement and adds the resulting object as a child of the given...
Definition: GTXLWriterXerces.cpp:165