}
}
}
private boolean initRdfWriter(String format, boolean report, boolean annotate) throws IOException {
final WriterFactory factory = getFormatWriter(format);
if (factory == null) {
sendError(
400,
"Invalid format '" + format + "', try one of: [rdfxml, turtle, ntriples, nquads, trix, json]",
null,
null,
report
);
return false;
}
FormatWriter fw = factory.getRdfWriter(byteOutStream);
fw.setAnnotated(annotate);
outputMediaType = factory.getMimeType();
List<TripleHandler> tripleHandlers = new ArrayList<TripleHandler>();
tripleHandlers.add(new IgnoreAccidentalRDFa(fw));
tripleHandlers.add(new CountingTripleHandler());
rdfWriter = new CompositeTripleHandler(tripleHandlers);
reporter = new ReportingTripleHandler(rdfWriter);