Package com.stardog.stark.io.rdfjson
Class RDFJSONWriter
java.lang.Object
com.stardog.stark.io.rdfjson.RDFJSONWriter
- All Implemented Interfaces:
RDFHandler,RDFWriter
Writer for RDF in RDF/JSON format
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Peter Ansell, Michael Grove
- See Also:
- Implementation Notes:
- This class buffers the written statements until the
end()so it is not suitable for writing large graphs.
-
Nested Class Summary
Nested Classes -
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.static StringresourceToString(Resource uriOrBnode) Returns the correct syntax for a Resource, depending on whether it is a URI or a Blank Node (ie, BNode)voidstart()Signals that the RDF writing process is starting.
-
Constructor Details
-
RDFJSONWriter
-
-
Method Details
-
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
-
comment
Write a comment to the output. Writing need not bestartedat this point; comments can be written prior to any actual serialized RDF -
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
-
handle
Write the givenStatement- Specified by:
handlein interfaceRDFHandler- Specified by:
handlein interfaceRDFWriter- Parameters:
theStmt- the statement to write
-
start
public void start()Signals that the RDF writing process is starting.- Specified by:
startin interfaceRDFHandler- Specified by:
startin interfaceRDFWriter
-
resourceToString
Returns the correct syntax for a Resource, depending on whether it is a URI or a Blank Node (ie, BNode)- Parameters:
uriOrBnode- The resource to serialise to a string- Returns:
- The string value of the sesame resource
-
format
Theformatthis writer will serialize output in.
-