public class RDFJSONWriter extends AbstractRDFWriter implements RDFWriter
RDFWriter implementation for the RDF/JSON formatnamespaceTable, statementConsumer| Constructor and Description |
|---|
RDFJSONWriter(OutputStream out,
RDFFormat actualFormat) |
RDFJSONWriter(Writer writer,
RDFFormat actualFormat) |
| Modifier and Type | Method and Description |
|---|---|
void |
consumeStatement(Statement statement)
Consume a statement.
|
void |
endRDF()
Signals the end of the RDF data.
|
RDFFormat |
getRDFFormat()
Gets the RDF format that this RDFWriter uses.
|
Collection<RioSetting<?>> |
getSupportedSettings() |
void |
handleComment(String comment)
Handles a comment.
|
void |
handleNamespace(String prefix,
String uri)
Handles a namespace declaration/definition.
|
static void |
modelToRdfJsonInternal(Model graph,
WriterConfig writerConfig,
com.fasterxml.jackson.core.JsonGenerator jg) |
static String |
resourceToString(Resource uriOrBnode)
Returns the correct syntax for a Resource, depending on whether it is a URI or a Blank Node (ie, BNode)
|
void |
startRDF()
Signals the start of the RDF data.
|
static void |
writeObject(Value object,
Set<Resource> contexts,
com.fasterxml.jackson.core.JsonGenerator jg)
Helper method to reduce complexity of the JSON serialisation algorithm Any null contexts will only be serialised
to JSON if there are also non-null contexts in the contexts array
|
checkWritingStarted, getOutputStream, getWriterConfig, handleStatement, isWritingStarted, set, setWriterConfigclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOutputStream, getWriterConfig, set, setWriterConfighandleStatementpublic RDFJSONWriter(OutputStream out, RDFFormat actualFormat)
public void endRDF()
throws RDFHandlerException
RDFHandlerendRDF in interface RDFHandlerRDFHandlerException - If the RDF handler has encountered an unrecoverable error.public RDFFormat getRDFFormat()
RDFWritergetRDFFormat in interface RDFWriterpublic Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings in interface RDFWritergetSupportedSettings in class AbstractRDFWriterRioSettings that are supported by this RDFWriter.public void handleComment(String comment) throws RDFHandlerException
RDFHandlerhandleComment in interface RDFHandlercomment - The comment.RDFHandlerException - If the RDF handler has encountered an unrecoverable error.public void handleNamespace(String prefix, String uri) throws RDFHandlerException
RDFHandlerhandleNamespace in interface RDFHandlerhandleNamespace in class AbstractRDFWriterprefix - 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 void consumeStatement(Statement statement) throws RDFHandlerException
AbstractRDFWriterAbstractRDFWriter.handleStatement(Statement) in order to
benefit from automatic handling of RDF* conversion or encoding.consumeStatement in class AbstractRDFWriterstatement - the statement to consume.RDFHandlerExceptionpublic void startRDF()
throws RDFHandlerException
RDFHandlerstartRDF in interface RDFHandlerstartRDF in class AbstractRDFWriterRDFHandlerException - If the RDF handler has encountered an unrecoverable error.public static void writeObject(Value object, Set<Resource> contexts, com.fasterxml.jackson.core.JsonGenerator jg) throws com.fasterxml.jackson.core.JsonGenerationException, IOException
object - The RDF value to serialisecontexts - The set of contexts that are relevant to this object, including null contexts as they are found.jg - the JsonGenerator to write to.IOExceptioncom.fasterxml.jackson.core.JsonGenerationExceptionJSONExceptionpublic static String resourceToString(Resource uriOrBnode)
uriOrBnode - The resource to serialise to a stringpublic static void modelToRdfJsonInternal(Model graph, WriterConfig writerConfig, com.fasterxml.jackson.core.JsonGenerator jg) throws IOException, com.fasterxml.jackson.core.JsonGenerationException
IOExceptioncom.fasterxml.jackson.core.JsonGenerationExceptionCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.