de.saar.chorus.domgraph.codec.domgraph
Class DomgraphGxlInputCodec

Object
  extended by InputCodec
      extended by DomgraphGxlInputCodec

public class DomgraphGxlInputCodec
extends InputCodec

An input codec for weakly normal dominance graphs in GXL syntax. GXL is a standard format for representing graphs based on XML. Inputs of this codec specify the nodes of the dominance graph, plus edges of type "dominance" or "solid" connecting them.

An example input looks as follows:

<gxl xmlns:xlink="http://www.w3.org/1999/xlink">
<graph id="testgraph" edgeids="true" hypergraph="false" edgemode="directed">
<node id="x">
<type xlink:href="root" />
<attr name="label"><string>f</string></attr>
</node>
<node id="y">
<type xlink:href="hole" />
</node>
<node id="z">
<type xlink:href="leaf" />
<attr name="label"><string>a</string></attr>
</node>
<edge from="x" to="y" id="edge1">
<type xlink:href="solid" />
</edge>
<edge from="y" to="z" id="edge2">
<type xlink:href="dominance" />
</edge>
</graph>
</gxl>

Author:
Alexander Koller

Constructor Summary
DomgraphGxlInputCodec()
           
 
Method Summary
 void decode(Reader inputStream, DomGraph graph, NodeLabels labels)
          Reads a GXL description of a dominance graph from a file and writes it into a JDomGraph object.
 
Methods inherited from class InputCodec
getReaderForSpecification
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DomgraphGxlInputCodec

public DomgraphGxlInputCodec()
Method Detail

decode

public void decode(Reader inputStream,
                   DomGraph graph,
                   NodeLabels labels)
            throws IOException,
                   ParserException,
                   MalformedDomgraphException
Reads a GXL description of a dominance graph from a file and writes it into a JDomGraph object. Any previous contents of the JDomGraph object are deleted in the process.

Specified by:
decode in class InputCodec
Parameters:
inputStream - the stream from which we read the GXL document.
graph - the graph into which we write the dominance graph we read.
labels - the node labels of the labelled dominance graph
Throws:
ParserConfigurationException - if there was an internal error in the parser configuration.
IOException - if an error occurred while reading from the stream.
SAXException - if the input wasn't well-formed XML.
ParserException - if a syntactic error occurred while parsing the USR
MalformedDomgraphException - if a semantic error occurred, i.e. the USR cannot be converted into a dominance graph