public class RDFJSONWriter extends RDFWriterBase implements RDFWriter
RDFWriter
implementation for the RDF/JSON formatnamespaceTable
Constructor and Description |
---|
RDFJSONWriter(OutputStream out,
RDFFormat actualFormat) |
RDFJSONWriter(Writer writer,
RDFFormat actualFormat) |
Modifier and Type | Method and Description |
---|---|
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.
|
void |
handleStatement(Statement statement)
Handles a statement.
|
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
|
getWriterConfig, setWriterConfig
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWriterConfig, setWriterConfig
public RDFJSONWriter(OutputStream out, RDFFormat actualFormat)
public void endRDF() throws RDFHandlerException
RDFHandler
endRDF
in interface RDFHandler
RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public RDFFormat getRDFFormat()
RDFWriter
getRDFFormat
in interface RDFWriter
public Collection<RioSetting<?>> getSupportedSettings()
getSupportedSettings
in interface RDFWriter
getSupportedSettings
in class RDFWriterBase
RioSetting
s that are supported by this
RDFWriter.public void handleComment(String comment) throws RDFHandlerException
RDFHandler
handleComment
in interface RDFHandler
comment
- The comment.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void handleNamespace(String prefix, String uri) throws RDFHandlerException
RDFHandler
handleNamespace
in interface RDFHandler
handleNamespace
in class RDFWriterBase
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 void handleStatement(Statement statement) throws RDFHandlerException
RDFHandler
handleStatement
in interface RDFHandler
statement
- The statement.RDFHandlerException
- If the RDF handler has encountered an unrecoverable error.public void startRDF() throws RDFHandlerException
RDFHandler
startRDF
in interface RDFHandler
RDFHandlerException
- 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.IOException
com.fasterxml.jackson.core.JsonGenerationException
JSONException
public 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
IOException
com.fasterxml.jackson.core.JsonGenerationException
Copyright © 2001-2016 Aduna. All Rights Reserved.