public class StreamingJSONLDWriter extends Object implements RDFWriter
Streaming writer for JSON-LD
Modifier and Type | Class and Description |
---|---|
static class |
StreamingJSONLDWriter.StreamingJSONLDWriterFactory
Factory for creating StreamingJSONLDWriter |
Modifier and Type | Field and Description |
---|---|
protected Resource |
currentSubject |
protected com.google.common.collect.Multimap<IRI,Value> |
currentTriples |
protected Map<String,String> |
mNamespaces |
protected boolean |
mNamespacesWritten |
protected Options |
mOptions |
protected boolean |
mStarted |
protected com.fasterxml.jackson.core.JsonGenerator |
mWriter |
Constructor and Description |
---|
StreamingJSONLDWriter(OutputStream theWriter,
Options theOptions) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeActiveContext() |
protected void |
closePreviousStatement() |
void |
comment(String theComment)
Write a comment to the output.
|
void |
end()
Signals the writing process is completed.
|
RDFFormat |
format()
The
format this writer will serialize output in. |
protected String |
formatIRI(IRI iri) |
protected String |
formatResource(Resource res) |
void |
handle(Statement theStmt)
Write the given
Statement |
void |
namespace(String thePrefix,
String theIRI)
Provide a namespace to the writer.
|
void |
start()
Signals that the RDF writing process is starting.
|
protected void |
startActiveContext(Resource context) |
protected void |
writeLiteral(Literal literal) |
protected void |
writePredicateValues(IRI predicate,
Collection<Value> values) |
protected void |
writePredicateValues(String predicate,
Collection<Value> values,
boolean onlyResources) |
protected void |
writeTypes(Collection<Value> types) |
protected void |
writeValue(Value theValue) |
protected final com.fasterxml.jackson.core.JsonGenerator mWriter
protected final Options mOptions
protected boolean mStarted
protected boolean mNamespacesWritten
protected Resource currentSubject
public StreamingJSONLDWriter(OutputStream theWriter, Options theOptions)
public void start()
start
in interface RDFHandler
start
in interface RDFWriter
public void end()
RDFWriter
InputStream
is *not* closed, but the caller
should not call additional methods on this writer as that will normally yield syntax errors in the output.end
in interface RDFHandler
end
in interface RDFWriter
protected void startActiveContext(Resource context) throws IOException
IOException
protected void closeActiveContext() throws IOException
IOException
public void comment(@Nonnull String theComment)
RDFWriter
started
at this point; comments can be written prior to any actual
serialized RDFpublic void handle(@Nonnull Statement theStmt)
RDFWriter
Statement
handle
in interface RDFHandler
handle
in interface RDFWriter
theStmt
- the statement to writepublic void namespace(@Nonnull String thePrefix, @Nonnull String theIRI)
started
, in which case, the namespace bindings
are buffered and written when appropriate after writing has begun.namespace
in interface RDFHandler
namespace
in interface RDFWriter
thePrefix
- the namespace prefixtheIRI
- the associated IRIprotected void closePreviousStatement()
protected void writeTypes(Collection<Value> types) throws IOException
IOException
protected void writePredicateValues(IRI predicate, Collection<Value> values) throws IOException
IOException
protected void writePredicateValues(String predicate, Collection<Value> values, boolean onlyResources) throws IOException
IOException
protected void writeValue(@Nonnull Value theValue) throws IOException
IOException
protected void writeLiteral(@Nonnull Literal literal) throws IOException
IOException
Copyright © 2010-2016 Stardog Union. All Rights Reserved.