Package com.stardog.stark.io.turtle
Class PrettyTurtleWriter
java.lang.Object
com.stardog.stark.io.turtle.TurtleWriter
com.stardog.stark.io.turtle.PrettyTurtleWriter
- All Implemented Interfaces:
RDFHandler,RDFWriter
An Turtle writer that abbreviates bnodes and lists. This writer requires to buffer all the
triples in memory before writing so no output will be printed until end() is called. If the number of
triples exceed a limit, the writer prints them as TurtleWriter, i.e. without
bnode and list shortcuts.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
- Implementation Notes:
- Comments are not supported with this writer
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.stardog.stark.io.turtle.TurtleWriter
TurtleWriter.TurtleWriterFactory -
Field Summary
Fields inherited from class com.stardog.stark.io.turtle.TurtleWriter
mBlockSpec, mLastWrittenPredicate, mLastWrittenSubject, mNamespaces, mOptions, mStarted, mStmtClosed, mWriter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidWrite a comment to the output.voidend()Signals the writing process is completed.format()Theformatthis writer will serialize output in.voidWrite the givenStatementvoidProvide a namespace to the writer.voidstart()Signals that the RDF writing process is starting.Methods inherited from class com.stardog.stark.io.turtle.TurtleWriter
closePreviousStatement, writeBNode, writeCommentLine, writeEmbeddedTriple, writeIRI, writeLiteral, writeNamespace, writePredicate, writeResource, writeValue
-
Constructor Details
-
PrettyTurtleWriter
-
-
Method Details
-
start
public void start()Signals that the RDF writing process is starting.- Specified by:
startin interfaceRDFHandler- Specified by:
startin interfaceRDFWriter- Overrides:
startin classTurtleWriter
-
handle
Write the givenStatement- Specified by:
handlein interfaceRDFHandler- Specified by:
handlein interfaceRDFWriter- Overrides:
handlein classTurtleWriter- Parameters:
theStmt- the statement to write
-
end
public void end()Signals 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- Overrides:
endin classTurtleWriter
-
comment
Write a comment to the output. Writing need not bestartedat this point; comments can be written prior to any actual serialized RDF- Specified by:
commentin interfaceRDFWriter- Overrides:
commentin classTurtleWriter- Parameters:
theComment- the comment to write
-
namespace
Description copied from class:TurtleWriterProvide 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- Overrides:
namespacein classTurtleWriter- Parameters:
thePrefix- the namespace prefixtheIRI- the associated IRI
-
format
Theformatthis writer will serialize output in.- Specified by:
formatin interfaceRDFWriter- Overrides:
formatin classTurtleWriter- Returns:
- the format
-