UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
GTXLWriterXerces Class Reference

This class exports GXL or GTXL XML files by converting them from Hypergraph and GTS objects respectively. More...

#include <GTXLWriterXerces.h>

Inheritance diagram for GTXLWriterXerces:
Inheritance graph
[legend]
Collaboration diagram for GTXLWriterXerces:
Collaboration graph
[legend]

Public Member Functions

 GTXLWriterXerces ()
 Creates a new GTXLWriterXerces object, which includes initialization of the Xerces framework. More...
 
virtual ~GTXLWriterXerces ()
 Destroys the GTXLWriterXerces object. More...
 
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 given filename. More...
 
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. More...
 
virtual void writeGXL (vector< graphs::Hypergraph_sp > const &graphs, string filename) const
 This method takes a collection of Hypergraphs and stores the collection as a GXL XML-file with the given filename. More...
 
virtual void writeGXL (graphs::Hypergraph_sp graph, string filename) const
 This method takes a single Hypergraph and stores it as a GXL XML-file with the given filename. More...
 
virtual void writeGXL (graphs::Hypergraph_sp graph, boost::filesystem::path &filename) const
 This method takes a single Hypergraph and stores it as a GXL XML-file with the given filename. More...
 
virtual void writeGTXL (graphs::GTS const &gts, string filename) const
 This method takes a GTS object and stores it as a GTXL XML-file with the given filename. More...
 
void setGraphIDStorage (bool value)
 Sets whether the graph IDs used internally will be stored in the resulting file. More...
 
bool getGraphIDStorage () const
 Returns whether internal graph IDs will be exported. More...
 
void setRuleIDStorage (bool value)
 Sets whether internal rule IDs should be stores in the resulting file. More...
 
bool getRuleIDStorage () const
 Returns whether internal rule IDs will be exported. More...
 

Static Public Member Functions

static GTXLWriternewWriter ()
 Use this method to generate a new GTXLWriter object. More...
 
static unique_ptr< GTXLWriternewUniqueWriter ()
 Use this method to generate a new GTXLWriter object. More...
 

Protected Attributes

bool storeGraphIDs
 A value of true will cause the internally used ID of a graph to be stored as its name in the exported file.
 
bool storeRuleIDs
 A value of true will cause the internally used ID of a rule to be stored as its name in the exported file.
 

Private Member Functions

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 DOMElement. More...
 
void writeHypergraph (xercesc::DOMElement *gxlRoot, graphs::AnonHypergraph const &graph) const
 Takes an AnonHypergraph, converts it to a DOMElement and adds the resulting object as a child of the given DOMElement. More...
 
xercesc::DOMElement * writeHypergraph (xercesc::DOMElement *gxlRoot, graphs::AnonHypergraph const &graph, IDType const &graphID) const
 Implements the writeHypergraph functions for Hypergraph and AnonHypergraph. More...
 
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 DOMElement. More...
 
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 DOMElement. More...
 
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(...). More...
 
string generateGraphID (const IDType &graphID) const
 Generates a unique XML ID for a Hypergraph. More...
 
string generateVertexID (const IDType &nodeID, const IDType &graphID) const
 Generates a unique XML ID for a vertex of a graph. More...
 
string generateEdgeID (const IDType &edgeID, const IDType &graphID) const
 Generates a unique XML ID for an edge of a graph. More...
 
string generateRuleID (const IDType &ruleID) const
 Generates a unique XML ID for a Rule. More...
 
string generateLeftRulegraphID (const IDType &ruleID) const
 Generates a unique XML ID for the left graph of a Rule. More...
 
string generateRightRulegraphID (const IDType &ruleID) const
 Generates a unique XML ID for the right graph of a Rule. More...
 

Private Attributes

XMLCh * xmlch_gxl
 
XMLCh * xmlch_graph
 
XMLCh * xmlch_edgeids
 
XMLCh * xmlch_true
 
XMLCh * xmlch_hypergraph
 
XMLCh * xmlch_id
 
XMLCh * xmlch_edgemode
 
XMLCh * xmlch_undirected
 
XMLCh * xmlch_node
 
XMLCh * xmlch_vertex
 
XMLCh * xmlch_rel
 
XMLCh * xmlch_attr
 
XMLCh * xmlch_name
 
XMLCh * xmlch_string
 
XMLCh * xmlch_label
 
XMLCh * xmlch_relend
 
XMLCh * xmlch_target
 
XMLCh * xmlch_role
 
XMLCh * xmlch_startorder
 
XMLCh * xmlch_int
 
XMLCh * xmlch_gts
 
XMLCh * xmlch_initial
 
XMLCh * xmlch_rule
 
XMLCh * xmlch_lhs
 
XMLCh * xmlch_rhs
 
XMLCh * xmlch_rulegraph
 
XMLCh * xmlch_mapping
 
XMLCh * xmlch_mapelem
 
XMLCh * xmlch_from
 
XMLCh * xmlch_to
 
XMLCh * xmlch_quantification
 
XMLCh * xmlch_elem
 
XMLCh * xmlch_ref
 

Detailed Description

This class exports GXL or GTXL XML files by converting them from Hypergraph and GTS objects respectively.

Xerces is used as underlying framework.

Author
Jan Stückrath

Constructor & Destructor Documentation

Creates a new GTXLWriterXerces object, which includes initialization of the Xerces framework.

No additional initialization is needed.

~GTXLWriterXerces ( )
virtual

Destroys the GTXLWriterXerces object.

This also frees all resources reserved for Xerces.

Member Function Documentation

string generateEdgeID ( const IDType edgeID,
const IDType graphID 
) const
private

Generates a unique XML ID for an edge of a graph.

If the given graphID is not unique, the generated ID will only be unique within the graph.

Parameters
edgeIDthe internal ID of the edge
graphIDthe internal ID of the graph containing the edge
Returns
a unique XML ID for a edge
string generateGraphID ( const IDType graphID) const
private

Generates a unique XML ID for a Hypergraph.

Parameters
graphIDthe internal ID of the represented Hypergraph
Returns
a unique XML ID for a Hypergraph
string generateLeftRulegraphID ( const IDType ruleID) const
private

Generates a unique XML ID for the left graph of a Rule.

Parameters
ruleIDthe internal ID of the represented Rule
Returns
a unique XML ID for the left graph of a Rule
string generateRightRulegraphID ( const IDType ruleID) const
private

Generates a unique XML ID for the right graph of a Rule.

Parameters
ruleIDthe internal ID of the represented Rule
Returns
a unique XML ID for the right graph of a Rule
string generateRuleID ( const IDType ruleID) const
private

Generates a unique XML ID for a Rule.

Parameters
ruleIDthe internal ID of the represented Rule
Returns
a unique XML ID for a Rule
string generateVertexID ( const IDType nodeID,
const IDType graphID 
) const
private

Generates a unique XML ID for a vertex of a graph.

If the given graphID is not unique, the generated ID will only be unique within the graph.

Parameters
nodeIDthe internal ID of the vertex
graphIDthe internal ID of the graph containing the vertex
Returns
a unique XML ID for a vertex
bool getGraphIDStorage ( ) const
inherited

Returns whether internal graph IDs will be exported.

Returns
true, iff internal graph IDs will exported
bool getRuleIDStorage ( ) const
inherited

Returns whether internal rule IDs will be exported.

Returns
ture, iff internal rule IDs will be exported
unique_ptr< GTXLWriter > newUniqueWriter ( )
staticinherited

Use this method to generate a new GTXLWriter object.

No initialization is needed before use.

Returns
a pointer to a new GTXLWriter object
GTXLWriter * newWriter ( )
staticinherited

Use this method to generate a new GTXLWriter object.

No initialization is needed before use.

Warning
The caller has to properly delete the GTXLWriter after use to avoid memory leaks.
Returns
a pointer to a new GTXLWriter object
void setGraphIDStorage ( bool  value)
inherited

Sets whether the graph IDs used internally will be stored in the resulting file.

Parameters
valueuse 'true' if the graph IDs will be stored
void setRuleIDStorage ( bool  value)
inherited

Sets whether internal rule IDs should be stores in the resulting file.

Parameters
valueuse 'true if the rule IDs should be stored
void writeGTXL ( graphs::GTS const &  gts,
boost::filesystem::path &  filename 
) const
overridevirtual

This method takes a GTS object and stores it as a GTXL XML-file with the given filename.

If the file already exists, it is overwritten (if possible).

Parameters
gtsthe GTS object to be stored
filenamethe filename of the resulting GTXL file

Implements GTXLWriter.

void writeGTXL ( graphs::GTS const &  gts,
string  filename 
) const
virtualinherited

This method takes a GTS object and stores it as a GTXL XML-file with the given filename.

If the file already exists, it is overwritten (if possible).

Parameters
gtsthe GTS object to be stored
filenamethe filename of the resulting GTXL file
void writeGXL ( vector< graphs::Hypergraph_sp > const &  graphs,
boost::filesystem::path &  filename 
) const
overridevirtual

This method takes a collection of Hypergraphs and stores the collection as a GXL XML-file with the given filename.

If the file already exists, it is overwritten (if possible).

Parameters
graphsa pointer to a vector of Hypergraphs to be stored
filenamethe filename of the resulting GXL file

Implements GTXLWriter.

void writeGXL ( vector< graphs::Hypergraph_sp > const &  graphs,
string  filename 
) const
virtualinherited

This method takes a collection of Hypergraphs and stores the collection as a GXL XML-file with the given filename.

If the file already exists, it is overwritten (if possible).

Parameters
graphsa pointer to a vector of Hypergraphs to be stored
filenamethe filename of the resulting GXL file
void writeGXL ( graphs::Hypergraph_sp  graph,
string  filename 
) const
virtualinherited

This method takes a single Hypergraph and stores it as a GXL XML-file with the given filename.

If the file already exists, it is overwritten (if possible).

Parameters
grapha pointer to the Hypergraph to be stored
filenamethe filename of the resulting GXL file
virtual void writeGXL ( graphs::Hypergraph_sp  graph,
boost::filesystem::path &  filename 
) const
virtualinherited

This method takes a single Hypergraph and stores it as a GXL XML-file with the given filename.

If the file already exists, it is overwritten (if possible).

Parameters
grapha pointer to the Hypergraph to be stored
filenamethe filename of the resulting GXL file
void writeHypergraph ( xercesc::DOMElement *  gxlRoot,
graphs::Hypergraph const &  graph 
) const
private

Takes a Hypergraph, converts it to a DOMElement and adds the resulting object as a child of the given DOMElement.

Parameters
gxlRootthe DOMElement where the Hypergraph should be added as child
graphthe Hypergraph to be converted
void writeHypergraph ( xercesc::DOMElement *  gxlRoot,
graphs::AnonHypergraph const &  graph 
) const
private

Takes an AnonHypergraph, converts it to a DOMElement and adds the resulting object as a child of the given DOMElement.

This function is the same as the variant for Hypergraphs, but the graphs ID (which it does not have) will never be stored even if the option is set. Additionally elements of this graph will not have a unique (XML) ID outside the graph itself.

Parameters
gxlRootthe DOMElement where the AnonHypergraph should be added as child
graphthe AnonHypergraph to be converted
DOMElement * writeHypergraph ( xercesc::DOMElement *  gxlRoot,
graphs::AnonHypergraph const &  graph,
IDType const &  graphID 
) const
private

Implements the writeHypergraph functions for Hypergraph and AnonHypergraph.

Parameters
gxlRootthe DOMElement where the graph should be added as child
graphthe graph which should be added
graphIDthe ID of the given graph; this can be any value, but should be the Hypergraphs ID or 0 if the graph is an real AnonHypergraph
Returns
the DOMElement generated for the given graph (already added to the document tree)
void writeRule ( xercesc::DOMElement *  gtxlRoot,
graphs::AnonRule const &  rule,
IDType  id,
vector< unordered_set< IDType >> const *  leftUQids,
vector< unordered_set< IDType >> const *  rightUQids 
) const
private

This function is a generalized implementation of writeStdRule(...) and writeUQRule(...).

It creates a DOMElement from for the given rule, using the given ID and marks parts of the rule as belonging to quantifications. Which elements are marked this ways is defined in the two given vectors. The created DOMElement is added as a child of the given DOMElement.

Parameters
gtxlRootthe DOMElement where the converted rule will be added as a child
rulethe rule to be converted in a DOMElement
idthe ID of the rule
leftUQidsa vector of sets of IDs of the left-hand side of the rule; the i-th set of the vector contains all elements belonging to the i-th Quantification of the rule
rightUQidsa vector of sets of IDs of the right-hand side of the rule; the i-th set of the vector contains all elements belonging to the i-th Quantification of the rule
void writeStdRule ( xercesc::DOMElement *  gtxlRoot,
graphs::Rule const &  rule 
) const
private

Takes a Rule, converts it to a DOMElement and adds the resulting object as a child of the given DOMElement.

Parameters
gtxlRootthe DOMElement where the Rule should be added as child
rulethe Rule to be converted
void writeUQRule ( xercesc::DOMElement *  gtxlRoot,
graphs::UQRule const &  rule 
) const
private

Takes a UQRule, converts it to a DOMElement and adds the resulting object as a child of the given DOMElement.

Parameters
gtxlRootthe DOMElement where the UQRule should be added as child
rulethe UQRule to be converted

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