org.jrdf.graph.global.molecule
Class MoleculeToText

java.lang.Object
  extended by org.jrdf.graph.global.molecule.MoleculeToText
All Implemented Interfaces:
MoleculeHandler, TypedNodeVisitor

public class MoleculeToText
extends Object
implements MoleculeHandler, TypedNodeVisitor

Create a string represetation of a molecule that follows basic NTriples escaping. This is to be used primarily for serialization or similar purposes.

Version:
$Id: MoleculeToText.java 3130 2009-10-02 21:06:35Z newmana $
Author:
Andrew Newman

Constructor Summary
MoleculeToText(StringBuilder newBuilder)
           
MoleculeToText(StringBuilder newBuilder, Localizer newLocalizer)
           
 
Method Summary
 void handleEmptyMolecules()
          The is called instead of handleStart/End contains molecules when the triple visited does not contain any submolecules.
 void handleEndContainsMolecules(Set<Molecule> newMolecules)
          This is called when the top level triple's submolecules have all been visited.
 void handleStartContainsMolecules(Set<Molecule> newMolecules)
          This is called when the current top level triple contains a set of submolecules.
 void handleTriple(Triple triple)
          A triple in the root set of triples is found.
 void visitBlankNode(BlankNode blankNode)
          Visit blank node.
 void visitLiteral(Literal literal)
          Visit Literal.
 void visitNode(Node node)
          Visit node.
 void visitResource(Resource resource)
          Visit Resource.
 void visitURIReference(URIReference uriReference)
          Visit URI Reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MoleculeToText

public MoleculeToText(StringBuilder newBuilder)

MoleculeToText

public MoleculeToText(StringBuilder newBuilder,
                      Localizer newLocalizer)
Method Detail

handleTriple

public void handleTriple(Triple triple)
Description copied from interface: MoleculeHandler
A triple in the root set of triples is found.

Specified by:
handleTriple in interface MoleculeHandler
Parameters:
triple - the triple found.

handleEmptyMolecules

public void handleEmptyMolecules()
Description copied from interface: MoleculeHandler
The is called instead of handleStart/End contains molecules when the triple visited does not contain any submolecules.

Specified by:
handleEmptyMolecules in interface MoleculeHandler

handleStartContainsMolecules

public void handleStartContainsMolecules(Set<Molecule> newMolecules)
Description copied from interface: MoleculeHandler
This is called when the current top level triple contains a set of submolecules.

Specified by:
handleStartContainsMolecules in interface MoleculeHandler
Parameters:
newMolecules - the submolecules belonging to the top level triple.

handleEndContainsMolecules

public void handleEndContainsMolecules(Set<Molecule> newMolecules)
Description copied from interface: MoleculeHandler
This is called when the top level triple's submolecules have all been visited.

Specified by:
handleEndContainsMolecules in interface MoleculeHandler
Parameters:
newMolecules - the submolecules belonging to the top level triple.

visitBlankNode

public void visitBlankNode(BlankNode blankNode)
Description copied from interface: TypedNodeVisitor
Visit blank node.

Specified by:
visitBlankNode in interface TypedNodeVisitor
Parameters:
blankNode - the blank node to visit.

visitURIReference

public void visitURIReference(URIReference uriReference)
Description copied from interface: TypedNodeVisitor
Visit URI Reference.

Specified by:
visitURIReference in interface TypedNodeVisitor
Parameters:
uriReference - the URI Reference to visit.

visitLiteral

public void visitLiteral(Literal literal)
Description copied from interface: TypedNodeVisitor
Visit Literal.

Specified by:
visitLiteral in interface TypedNodeVisitor
Parameters:
literal - the Literal to visit.

visitNode

public void visitNode(Node node)
Description copied from interface: TypedNodeVisitor
Visit node.

Specified by:
visitNode in interface TypedNodeVisitor
Parameters:
node - the node to visit.

visitResource

public void visitResource(Resource resource)
Description copied from interface: TypedNodeVisitor
Visit Resource.

Specified by:
visitResource in interface TypedNodeVisitor
Parameters:
resource - the node to visit.