public abstract class AbstractRDFWriter extends Object implements RDFWriter, Sink
RDFWriter
s offering common functionality for RDF writers.Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
namespaceTable
Mapping from namespace prefixes to namespace names.
|
protected java.util.function.Consumer<Statement> |
statementConsumer |
Constructor and Description |
---|
AbstractRDFWriter() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkWritingStarted()
Verify that writing has started.
|
protected void |
consumeStatement(Statement st)
Consume a statement.
|
FileFormat |
getFileFormat()
Get the
FileFormat this sink uses. |
Collection<RioSetting<?>> |
getSupportedSettings() |
WriterConfig |
getWriterConfig()
Retrieves the current writer configuration as a single object.
|
void |
handleNamespace(String prefix,
String uri)
Handles a namespace declaration/definition.
|
void |
handleStatement(Statement st)
Handles a statement.
|
protected boolean |
isWritingStarted()
See if writing has started
|
<T> RDFWriter |
set(RioSetting<T> setting,
T value)
Set a setting on the writer, and return this writer object to allow chaining.
|
RDFWriter |
setWriterConfig(WriterConfig config)
Sets all supplied writer configuration options.
|
void |
startRDF()
Signals the start of the RDF data.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRDFFormat
endRDF, handleComment
acceptsFileFormat
protected Map<String,String> namespaceTable
protected java.util.function.Consumer<Statement> statementConsumer
public void handleNamespace(String prefix, String uri) throws RDFHandlerException
RDFHandler
handleNamespace
in interface RDFHandler
prefix
- The prefix for the namespace, or an empty string in case of a default namespace.uri
- The URI that the prefix maps to.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public RDFWriter setWriterConfig(WriterConfig config)
RDFWriter
setWriterConfig
in interface RDFWriter
config
- a writer configuration object.public WriterConfig getWriterConfig()
RDFWriter
getWriterConfig
in interface RDFWriter
public FileFormat getFileFormat()
Sink
FileFormat
this sink uses.getFileFormat
in interface Sink
FileFormat
. May not be null
.public Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings
in interface RDFWriter
RioSetting
s that are supported by this RDFWriter.public <T> RDFWriter set(RioSetting<T> setting, T value)
RDFWriter
public void startRDF() throws RDFHandlerException
RDFHandler
startRDF
in interface RDFHandler
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void handleStatement(Statement st) throws RDFHandlerException
RDFHandler
handleStatement
in interface RDFHandler
st
- The statement.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.protected void consumeStatement(Statement st)
handleStatement(Statement)
in order to
benefit from automatic handling of RDF-star conversion or encoding.st
- the statement to consume.protected boolean isWritingStarted()
true
if writing has started, false
otherwiseprotected void checkWritingStarted()
RDFHandlerException
- if writing has not yet started.Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.