Output using RIOT depends on the format, which involves both the language (syntax)
being written and the variant of that syntax.

The RIOT writer architecture is extensible. The following languages
are available as part of the standard setup.

Turtle

N-Triples

NQuads

TriG

JSON-LD

RDF/XML

RDF/JSON

TriX

RDF Binary

In addition, there are variants of Trutle, TriG for pretty printing,
streamed output and flat output. RDF/XML has variants for pretty printing
and plain output. Jena RIOT uses org.apache.jena.riot.RDFFormat as a way
to identify the language and variant to be written. The class contains constants
for the standard supported formats.

All Turtle and TriG formats use
prefix names, and short forms for literals.

The pretty printed versions of Turtle and TriG prints
data with the same subject in the same graph together.
All the properties for a given subject are sorted
into a predefined order. RDF lists are printed as
(...) and [...] is used for blank nodes where possible.

The analysis for determining what can be pretty printed requires
temporary datastructures and also a scan of the whole graph before
writing begins. Therefore, pretty printed formats are not suitable
for writing persistent graphs and datasets.

When writing at scale use either a "blocked" version of Turtle or TriG,
or write N-triples/N-Quads.

Fully pretty printed formats can't not be streamed. They require analysis
of all of the data to be written in order to choose the short forms. This limits
their use in fully scalable applications.

Some formats can be written streaming style, where the triples or quads
are partially grouped together by adjacent subject or graph/subject
in the output stream.

The written data is like the pretty printed forms of Turtle or TriG,
but without RDF lists being written in the '(...)' form, without
using [...] for blank nodes.

This gives some degree of readability while not requiring
excessive temporary datastructure. Arbitrary amounts of data
can be written but blank node labels need to be tracked in order
to use the short label form.

The main N-Triples and N-Quads writers follow RDF 1.1 and output using UTF-8.
For compatibility with old software, writers are provided that output
in ASCII (using \u escape sequences for non-ASCI characters where necessary).

JSON-LD output is supported, in its various flavors
("compacted", "expanded", "flattened", "framed"),
by using one of the following RDFFormats:

RDFFormat

JSONLD_EXPAND_PRETTY

JSONLD_EXPAND_FLAT

JSONLD_COMPACT_PRETTY

JSONLD_COMPACT_FLAT

JSONLD_FLATTEN_PRETTY

JSONLD_FLATTEN_FLAT

JSONLD_FRAME_PRETTY

JSONLD_FRAME_FLAT

The default registration for JSONLD is JSONLD_PRETTY.
JSONLD_PRETTY is identical to JSONLD_COMPACT_PRETTY.

Output can be customized, passing more info to the writer by using the
"Context" mechanism provided by Jena. The same mechanism is used to
pass the "frame" in the JSONLD_FRAME_PRETTY and JSONLD_FRAME_FLAT
cases.

This is a binary encoding using
Apache Thrift for RDF Graphs
and RDF Datasets, as well as SPARQL Result Sets, and it provides faster parsing
compared to the text-based standardised syntax such as N-triples, Turtle or RDF/XML.

RDFFormat

RDFTHRIFT

RDFTHRIFT_VALUES

RDFTHRIFT_VALUES is a variant where numeric values are written as values,
not as lexical format and datatype. See the
description of RDF Thrift
for dsicussion.

Using OutputStreams is strongly encouraged. This allows the writers
to manage the character encoding using UTF-8. Using java.io.Writer
does not allow this; on platforms such as MS Windows, the default
configuration of a Writer is not suitable for Turtle because
the character set is the platform default, and not UTF-8.
The only use of writers that is useful is using java.io.StringWriter.