|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openrdf.rio.rdfxml.RDFXMLWriter
org.openrdf.rio.rdfxml.util.RDFXMLPrettyWriter
public class RDFXMLPrettyWriter
An extension of RDFXMLWriter that outputs a more concise form of RDF/XML. The resulting output is semantically equivalent to the output of an RDFXMLWriter (it produces the same set of statements), but it is usually easier to read for humans.
This is a quasi-streaming RDFWriter. Statements are cached as long as the striped syntax is followed (i.e. the subject of the next statement is the object of the previous statement) and written to the output when the stripe is broken.
The abbreviations used are typed node elements, empty property elements and striped syntax. Note that these abbreviations require that statements are written in the appropriate order.
Striped syntax means that when the object of a statement is the subject of the next statement we can nest the descriptions in each other.
Example:
<rdf:Seq>
<rdf:li>
<foaf:Person>
<foaf:knows>
<foaf:Person>
<foaf:mbox rdf:resource="..."/>
</foaf:Person>
</foaf:knows>
</foaf:Person>
</rdf:li>
</rdf:Seq>
Typed node elements means that we write out type information in the short
form of
<foaf:Person rdf:about="...">
...
</foaf:Person>
instead of
<rdf:Description rdf:about="...">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
...
</rdf:Description>
Empty property elements are of the form
<foaf:Person>
<foaf:homepage rdf:resource="http://www.cs.vu.nl/˜marta"/>
</foaf:Person>
instead of
<foaf:Person>
<foaf:homepage>
<rdf:Description rdf:about="http://www.cs.vu.nl/˜marta"/>
<foaf:homepage>
</foaf:Person>
| Field Summary |
|---|
| Fields inherited from class org.openrdf.rio.rdfxml.RDFXMLWriter |
|---|
headerWritten, lastWrittenSubject, namespaceTable, writer, writingStarted |
| Constructor Summary | |
|---|---|
RDFXMLPrettyWriter(OutputStream out)
Creates a new RDFXMLPrintWriter that will write to the supplied OutputStream. |
|
RDFXMLPrettyWriter(Writer out)
Creates a new RDFXMLPrintWriter that will write to the supplied Writer. |
|
| Method Summary | |
|---|---|
void |
close()
|
void |
flush()
|
protected void |
flushPendingStatements()
|
void |
handleStatement(Statement st)
Handles a statement. |
protected void |
writeHeader()
|
protected void |
writeIndents(int n)
Writes n indents. |
protected void |
writeStartTag(String namespace,
String localName)
|
| Methods inherited from class org.openrdf.rio.rdfxml.RDFXMLWriter |
|---|
endRDF, getRDFFormat, handleComment, handleNamespace, setNamespace, startRDF, writeAttribute, writeAttribute, writeCharacterData, writeEndOfEmptyTag, writeEndOfStartTag, writeEndTag, writeIndent, writeNewLine, writeStartOfStartTag |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RDFXMLPrettyWriter(OutputStream out)
out - The OutputStream to write the RDF/XML document to.public RDFXMLPrettyWriter(Writer out)
out - The Writer to write the RDF/XML document to.| Method Detail |
|---|
protected void writeHeader()
throws IOException
writeHeader in class RDFXMLWriterIOException
public void flush()
throws IOException
flush in interface FlushableIOException
public void close()
throws IOException
close in interface CloseableIOException
protected void flushPendingStatements()
throws IOException
flushPendingStatements in class RDFXMLWriterIOException
public void handleStatement(Statement st)
throws RDFHandlerException
RDFHandler
handleStatement in interface RDFHandlerhandleStatement in class RDFXMLWriterst - The statement.
RDFHandlerException - If the RDF handler has encountered an unrecoverable error.
protected void writeStartTag(String namespace,
String localName)
throws IOException
IOException
protected void writeIndents(int n)
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||