org.eaglei.repository.format
Class RDFNQuadsWriter

java.lang.Object
  extended by org.openrdf.rio.helpers.RDFHandlerBase
      extended by org.eaglei.repository.format.RDFNQuadsWriter
All Implemented Interfaces:
org.openrdf.rio.RDFHandler, org.openrdf.rio.RDFWriter

public class RDFNQuadsWriter
extends org.openrdf.rio.helpers.RDFHandlerBase
implements org.openrdf.rio.RDFWriter

N-Quad writer About the Format: There is no standard or "offcial" format called N-Quad. We maded this up for the eagle-i project, to have a simple line-based QUAD (not TRIPLE) format that makes it easy to compare the contents of two groups of quads, or dumps of a Sesame context-aware triplestore (really quad-store). The only purpose of tihs format is to render "quads" - i.e. the statement *and* its context(s) - in a format that is guaranteed to to be the same for any equivalent graph, modulo the order of the lines. This allows sorted output to be compared for equality with a simple text comparision. It CANNOT be parsed into reasonable RDF again because the identifiers in blank nodes are lost. So there is no parser. Format is similar to NTriples; see: http://www.w3.org/TR/rdf-testcases/#ntriples ..only each line STARTS with a forth value, the context (or named graph); null context represented by "<>". Destructive changes when filtering output: 1. Optionally normalize all blank nodes so they compare as equal, all named _:bnode 2. Transform newline characters (both \r and \n) into escaped versions so they do not induce "false" line breaks. Remember, it is *ONLY* useful to debug and compare this output!

Version:
$Id: $
Author:
Larry Stone Started May 10, 2010

Field Summary
static boolean normalizeBNodes
           
static org.openrdf.rio.RDFFormat NQUADS
          Constant NQUADS
static java.lang.String NQUADS_MIME
          Constant NQUADS_MIME="text/rdf+nquads"
 
Constructor Summary
RDFNQuadsWriter(java.io.Writer out)
          Constructor for RDFNQuadsWriter.
 
Method Summary
 void endRDF()
          endRDF
 org.openrdf.rio.RDFFormat getRDFFormat()
          getRDFFormat
 void handleStatement(org.openrdf.model.Statement s)
          
 
Methods inherited from class org.openrdf.rio.helpers.RDFHandlerBase
handleComment, handleNamespace, startRDF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openrdf.rio.RDFHandler
handleComment, handleNamespace, startRDF
 

Field Detail

NQUADS_MIME

public static final java.lang.String NQUADS_MIME
Constant NQUADS_MIME="text/rdf+nquads"

See Also:
Constant Field Values

normalizeBNodes

public static boolean normalizeBNodes

NQUADS

public static final org.openrdf.rio.RDFFormat NQUADS
Constant NQUADS

Constructor Detail

RDFNQuadsWriter

public RDFNQuadsWriter(java.io.Writer out)

Constructor for RDFNQuadsWriter.

Parameters:
out - a Writer object.
Method Detail

getRDFFormat

public org.openrdf.rio.RDFFormat getRDFFormat()

getRDFFormat

Specified by:
getRDFFormat in interface org.openrdf.rio.RDFWriter
Returns:
a RDFFormat object.

handleStatement

public void handleStatement(org.openrdf.model.Statement s)
                     throws org.openrdf.rio.RDFHandlerException

Specified by:
handleStatement in interface org.openrdf.rio.RDFHandler
Overrides:
handleStatement in class org.openrdf.rio.helpers.RDFHandlerBase
Throws:
org.openrdf.rio.RDFHandlerException

endRDF

public void endRDF()
            throws org.openrdf.rio.RDFHandlerException

endRDF

Specified by:
endRDF in interface org.openrdf.rio.RDFHandler
Overrides:
endRDF in class org.openrdf.rio.helpers.RDFHandlerBase
Throws:
org.openrdf.rio.RDFHandlerException - if any.


Copyright © 2009-2010 Eagle-I. All Rights Reserved.