|
|||||||||||
| 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.AbbreviatedRdfXmlWriter
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 RdfDocumentWriter. 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>
...
</foaf:Person>
instead of
<rdf:Description>
<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>
| Constructor Summary | |
AbbreviatedRdfXmlWriter(OutputStream out)
Creates a new RdfXmlWriter that will write to the supplied OutputStream. |
|
AbbreviatedRdfXmlWriter(Writer out)
Creates a new RdfXmlWriter that will write to the supplied Writer. |
|
| Method Summary | |
void |
endDocument()
Ends the document writing. |
void |
flush()
|
void |
startDocument()
Starts the document writing. |
void |
writeComment(String comment)
Writes a comment to the document. |
void |
writeStatement(Resource subj,
URI pred,
Value obj)
Writes a statement to the document. |
| Methods inherited from class org.openrdf.rio.rdfxml.RdfXmlWriter |
addStyleSheet, addStyleSheet, setNamespace |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AbbreviatedRdfXmlWriter(OutputStream out)
out - The OutputStream to write the RDF/XML document to.public AbbreviatedRdfXmlWriter(Writer out)
out - The Writer to write the RDF/XML document to.| Method Detail |
public void startDocument()
throws IOException
RdfDocumentWriter
startDocument in interface RdfDocumentWriterstartDocument in class RdfXmlWriterIOException
public void endDocument()
throws IOException
RdfDocumentWriter
endDocument in interface RdfDocumentWriterendDocument in class RdfXmlWriterIOException
public void flush()
throws IOException
IOException
public void writeStatement(Resource subj,
URI pred,
Value obj)
throws IOException
RdfDocumentWriter
writeStatement in interface RdfDocumentWriterwriteStatement in class RdfXmlWriterIOException
public void writeComment(String comment)
throws IOException
RdfDocumentWriter
writeComment in interface RdfDocumentWriterwriteComment in class RdfXmlWriterIOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||