|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.rio.helpers.RDFHandlerBase
org.eaglei.repository.format.RDFContextNTriplesWriter
public class RDFContextNTriplesWriter
Writer for "Context NTriples" RDF serialization format About the Format: This is NOT a standard or "offcial" format. We made 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). Note that there IS a similar quasi-official semi-standard, "N-Quads" format documented ehre: http://sw.deri.org/2008/07/n-quads/ It is NOT useful for our needs since they put the context last and leave it as an optional addition, so statements might be rendered as triples; this makes simple text comparison difficult and columnar manipulation (e.g. with "awk" is impossible, since the 3rd element of a statement might be a literal with embedded colum-sep characters.. It's much more sensible efficeint to put the context in the first column! 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!
| Field Summary | |
|---|---|
static org.openrdf.rio.RDFFormat |
CONTEXT_NTRIPLES
Constant CONTEXT_NTRIPLES |
static java.lang.String |
CONTEXT_NTRIPLES_MIME
Constant CONTEXT_NTRIPLES_MIME="text/x-rdf-context-ntriples" |
static boolean |
normalizeBNodes
|
| Constructor Summary | |
|---|---|
RDFContextNTriplesWriter(java.io.Writer out)
Constructor for RDFContextNTriplesWriter. |
|
| 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 |
|---|
public static final java.lang.String CONTEXT_NTRIPLES_MIME
CONTEXT_NTRIPLES_MIME="text/x-rdf-context-ntriples"
public static final boolean normalizeBNodes
public static final org.openrdf.rio.RDFFormat CONTEXT_NTRIPLES
CONTEXT_NTRIPLES
| Constructor Detail |
|---|
public RDFContextNTriplesWriter(java.io.Writer out)
Constructor for RDFContextNTriplesWriter.
out - a Writer object.| Method Detail |
|---|
public org.openrdf.rio.RDFFormat getRDFFormat()
getRDFFormat
getRDFFormat in interface org.openrdf.rio.RDFWriterRDFFormat object.
public void handleStatement(org.openrdf.model.Statement s)
throws org.openrdf.rio.RDFHandlerException
handleStatement in interface org.openrdf.rio.RDFHandlerhandleStatement in class org.openrdf.rio.helpers.RDFHandlerBaseorg.openrdf.rio.RDFHandlerException
public void endRDF()
throws org.openrdf.rio.RDFHandlerException
endRDF
endRDF in interface org.openrdf.rio.RDFHandlerendRDF in class org.openrdf.rio.helpers.RDFHandlerBaseorg.openrdf.rio.RDFHandlerException - if any.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||