/** * Write contents of graph to writer using N3 serialization * * @param graph * @param writer */ public static void writeStatements(Collection<Statement> statements, OutputStream outputStream) { try { RDFWriter writer= Rio.createWriter(RDFFormat.N3, outputStream); writer.startRDF(); for(Statement statement:statements) { writer.handleStatement(statement); } writer.endRDF(); } catch (UnsupportedRDFormatException e) { e.printStackTrace(); } catch (RDFHandlerException e) { e.printStackTrace(); } }