Package com.stardog.stark.io.rdfxml
Class RDFXMLWriter
java.lang.Object
com.stardog.stark.io.rdfxml.RDFXMLWriter
- All Implemented Interfaces:
RDFHandler,RDFWriter
- Direct Known Subclasses:
RDFXMLPrettyWriter
Default writer for the RDF/XML serialization
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Michael Grove
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidWrite a comment to the output.voidend()Signals the writing process is completed.protected voidformat()Theformatthis writer will serialize output in.protected StringgetValidNodeId(BNode theBNode) Create a syntactically valid node id from the supplied blank node id.voidWrite the givenStatementvoidProvide a namespace to the writer.protected StringsetNamespace(String prefix, String name) voidstart()Signals that the RDF writing process is starting.protected voidwriteAttribute(String attName, String value) protected voidwriteAttribute(String namespace, String attName, String value) protected voidwriteCharacterData(String chars) protected voidprotected voidprotected voidwriteEndTag(String namespace, String localName) protected voidprotected voidprotected voidprotected voidwriteStartOfStartTag(String theNamespace, String theLocalName)
-
Field Details
-
mWriter
-
mOptions
-
defaultNamespace
-
writingStarted
protected boolean writingStarted -
headerWritten
protected boolean headerWritten -
lastWrittenSubject
-
namespaceTable
-
-
Constructor Details
-
RDFXMLWriter
-
-
Method Details
-
start
Signals that the RDF writing process is starting.- Specified by:
startin interfaceRDFHandler- Specified by:
startin interfaceRDFWriter- Throws:
WritingFailed
-
writeHeader
- Throws:
IOException
-
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- Throws:
WritingFailed
-
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:
prefix- the namespace prefixname- the associated IRI
-
setNamespace
-
handle
Write the givenStatement- Specified by:
handlein interfaceRDFHandler- Specified by:
handlein interfaceRDFWriter- Parameters:
theStmt- the statement to write- Throws:
WritingFailed
-
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- Parameters:
comment- the comment to write- Throws:
WritingFailed
-
flushPendingStatements
- Throws:
IOExceptionWritingFailed
-
writeStartOfStartTag
protected void writeStartOfStartTag(@Nonnull String theNamespace, @Nonnull String theLocalName) throws IOException - Throws:
IOException
-
writeAttribute
- Throws:
IOException
-
writeAttribute
protected void writeAttribute(String namespace, String attName, String value) throws IOException, WritingFailed - Throws:
IOExceptionWritingFailed
-
writeEndOfStartTag
- Throws:
IOException
-
writeEndOfEmptyTag
- Throws:
IOException
-
writeEndTag
- Throws:
IOException
-
writeCharacterData
- Throws:
IOException
-
writeIndent
- Throws:
IOException
-
writeNewLine
- Throws:
IOException
-
getValidNodeId
Create a syntactically valid node id from the supplied blank node id. This is necessary because RDF/XML syntax enforces the blank node id is a valid NCName.- Parameters:
theBNode- a blank node identifier- Returns:
- the blank node identifier converted to a form that is a valid NCName.
- Throws:
IOException- See Also:
-
format
Theformatthis writer will serialize output in.
-