public class RDFXMLPrettyWriter extends RDFXMLWriter implements Closeable, Flushable
This is a quasi-streaming RDFWriter. Statements are cached as long as the striped syntax is followed (i.e. the subject of the next statement is the object of the previous statement) and written to the output when the stripe is broken.
The abbreviations used are typed node elements, empty property elements and striped syntax. Note that these abbreviations require that statements are written in the appropriate order.
Striped syntax means that when the object of a statement is the subject of the next statement we can nest the descriptions in each other.
Example:
<rdf:Seq>
<rdf:li>
<foaf:Person>
<foaf:knows>
<foaf:Person>
<foaf:mbox rdf:resource="..."/>
</foaf:Person>
</foaf:knows>
</foaf:Person>
</rdf:li>
</rdf:Seq>
Typed node elements means that we write out type information in the short form of
<foaf:Person rdf:about="...">
...
</foaf:Person>
instead of
<rdf:Description rdf:about="...">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
...
</rdf:Description>
Empty property elements are of the form
<foaf:Person>
<foaf:homepage rdf:resource="http://www.cs.vu.nl/˜marta"/>
</foaf:Person>
instead of
<foaf:Person>
<foaf:homepage>
<rdf:Description rdf:about="http://www.cs.vu.nl/˜marta"/>
<foaf:homepage>
</foaf:Person>
baseIRI, defaultNamespace, entityQuote, headerWritten, lastWrittenSubject, quote, writernamespaceTable, statementConsumer| Constructor and Description |
|---|
RDFXMLPrettyWriter(OutputStream out)
Creates a new RDFXMLPrintWriter that will write to the supplied OutputStream.
|
RDFXMLPrettyWriter(OutputStream out,
ParsedIRI baseIRI)
Creates a new RDFXMLPrintWriter that will write to the supplied OutputStream.
|
RDFXMLPrettyWriter(Writer out)
Creates a new RDFXMLPrintWriter that will write to the supplied Writer.
|
RDFXMLPrettyWriter(Writer writer,
ParsedIRI baseIRI)
Creates a new RDFXMLPrintWriter that will write to the supplied Writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
consumeStatement(Statement st)
Consume a statement.
|
void |
endRDF()
Signals the end of the RDF data.
|
void |
flush() |
protected void |
flushPendingStatements() |
Collection<RioSetting<?>> |
getSupportedSettings() |
protected void |
writeHeader() |
protected void |
writeIndents(int n)
Writes n indents.
|
protected void |
writeStartTag(String namespace,
String localName) |
getRDFFormat, getValidNodeId, getWriter, handleComment, handleNamespace, setNamespace, writeAttribute, writeAttribute, writeCharacterData, writeEndOfEmptyTag, writeEndOfStartTag, writeEndTag, writeIndent, writeNewLine, writeQuotedAttribute, writeStartOfStartTagcheckWritingStarted, getFileFormat, getWriterConfig, handleStatement, isWritingStarted, set, setWriterConfig, startRDFclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetWriterConfig, set, setWriterConfighandleStatement, startRDFacceptsFileFormat, getFileFormatpublic RDFXMLPrettyWriter(OutputStream out)
out - The OutputStream to write the RDF/XML document to.public RDFXMLPrettyWriter(OutputStream out, ParsedIRI baseIRI)
out - The OutputStream to write the RDF/XML document to.public RDFXMLPrettyWriter(Writer out)
out - The Writer to write the RDF/XML document to.public void endRDF()
throws RDFHandlerException
RDFHandlerendRDF in interface RDFHandlerendRDF in class RDFXMLWriterRDFHandlerException - If the RDF handler has encountered an unrecoverable error.protected void writeHeader()
throws IOException
writeHeader in class RDFXMLWriterIOExceptionpublic void flush()
throws IOException
flush in interface FlushableIOExceptionpublic Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface RDFWritergetSupportedSettings in class RDFXMLWriterRioSettings that are supported by this RDFWriter.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionprotected void flushPendingStatements()
throws IOException,
RDFHandlerException
flushPendingStatements in class RDFXMLWriterIOExceptionRDFHandlerExceptionpublic void consumeStatement(Statement st) throws RDFHandlerException
AbstractRDFWriterAbstractRDFWriter.handleStatement(Statement) in order to
benefit from automatic handling of RDF* conversion or encoding.consumeStatement in class RDFXMLWriterst - the statement to consume.RDFHandlerExceptionprotected void writeStartTag(String namespace, String localName) throws IOException
IOExceptionprotected void writeIndents(int n)
throws IOException
IOExceptionCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.