Package com.stardog.stark.io.jsonld
Class StreamingJSONLDWriter
java.lang.Object
com.stardog.stark.io.jsonld.StreamingJSONLDWriter
- All Implemented Interfaces:
RDFHandler,RDFWriter
Streaming writer for JSON-LD
- Author:
- Evren Sirin
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidvoidWrite a comment to the output.voidend()Signals the writing process is completed.format()Theformatthis writer will serialize output in.protected Stringprotected StringformatResource(Resource res) voidWrite the givenStatementvoidProvide a namespace to the writer.voidstart()Signals that the RDF writing process is starting.protected voidstartActiveContext(Resource context) protected voidwriteLiteral(Literal literal) protected voidwritePredicateValues(IRI predicate, Collection<Value> values) protected voidwritePredicateValues(String predicate, Collection<Value> values, boolean onlyResources) protected voidwriteTypes(Collection<Value> types) protected voidwriteValue(Value theValue)
-
Field Details
-
mWriter
protected final com.fasterxml.jackson.core.JsonGenerator mWriter -
mOptions
-
mNamespaces
-
mStarted
protected boolean mStarted -
mNamespacesWritten
protected boolean mNamespacesWritten -
currentSubject
-
currentTriples
-
-
Constructor Details
-
StreamingJSONLDWriter
-
-
Method Details
-
start
public void start()Signals that the RDF writing process is starting.- Specified by:
startin interfaceRDFHandler- Specified by:
startin interfaceRDFWriter
-
end
public void end()Description copied from interface:RDFWriterSignals the writing process is completed. The underlyingInputStreamis *not* closed, but the caller should not call additional methods on this writer as that will normally yield syntax errors in the output.- Specified by:
endin interfaceRDFHandler- Specified by:
endin interfaceRDFWriter
-
startActiveContext
- Throws:
IOException
-
closeActiveContext
- Throws:
IOException
-
comment
Description copied from interface:RDFWriterWrite a comment to the output. Writing need not bestartedat this point; comments can be written prior to any actual serialized RDF -
handle
Description copied from interface:RDFWriterWrite the givenStatement- Specified by:
handlein interfaceRDFHandler- Specified by:
handlein interfaceRDFWriter- Parameters:
theStmt- the statement to write
-
namespace
Provide a namespace to the writer. This method can be called before writing hasstarted, in which case, the namespace bindings are buffered and written when appropriate after writing has begun.- Specified by:
namespacein interfaceRDFHandler- Specified by:
namespacein interfaceRDFWriter- Parameters:
thePrefix- the namespace prefixtheIRI- the associated IRI
-
closePreviousStatement
protected void closePreviousStatement() -
writeTypes
- Throws:
IOException
-
writePredicateValues
- Throws:
IOException
-
writePredicateValues
protected void writePredicateValues(String predicate, Collection<Value> values, boolean onlyResources) throws IOException - Throws:
IOException
-
writeValue
- Throws:
IOException
-
formatResource
-
formatIRI
-
writeLiteral
- Throws:
IOException
-
format
Description copied from interface:RDFWriterTheformatthis writer will serialize output in.
-