@Test public void Export_Turtle() throws UnsupportedEncodingException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); repository.export(Format.TURTLE, null, baos); String str = new String(baos.toByteArray(), "UTF-8"); System.out.println(str); }
@Override public void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out) { RDFWriter writer = WriterUtils.createWriter(format, out, ns2prefix); RDFConnection conn = openConnection(); try { CloseableIterator<STMT> stmts = conn.findStatements(null, null, null, context, false); try { writer.begin(); while (stmts.hasNext()) { writer.handle(stmts.next()); } writer.end(); } finally { stmts.close(); } } finally { conn.close(); } }
MiniRepository implements Repository { @Override public void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out) { RDFWriter writer = WriterUtils.createWriter(format, out, ns2prefix); RDFConnection conn = openConnection(); try { CloseableIterator<STMT> stmts = conn.findStatements(null, null, null, context, false); try { writer.begin(); while (stmts.hasNext()) { writer.handle(stmts.next()); } writer.end(); } finally { stmts.close(); } } finally { conn.close(); } } }
MiniRepository implements Repository { @Override public void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out) { RDFWriter writer = WriterUtils.createWriter(format, out, ns2prefix); RDFConnection conn = openConnection(); try { CloseableIterator<STMT> stmts = conn.findStatements(null, null, null, context, false); try { writer.begin(); while (stmts.hasNext()) { writer.handle(stmts.next()); } writer.end(); } finally { stmts.close(); } } finally { conn.close(); } } MiniRepository();  MiniRepository(int initialCapacity);  MiniRepository(int initialCapacity, boolean inverseIndex);  MiniRepository(STMT... stmts); }
MiniRepository implements Repository { @Override public void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out) { RDFWriter writer = WriterUtils.createWriter(format, out, ns2prefix); RDFConnection conn = openConnection(); try { CloseableIterator<STMT> stmts = conn.findStatements(null, null, null, context, false); try { writer.begin(); while (stmts.hasNext()) { writer.handle(stmts.next()); } writer.end(); } finally { stmts.close(); } } finally { conn.close(); } } MiniRepository();  MiniRepository(int initialCapacity);  MiniRepository(int initialCapacity, boolean inverseIndex);  MiniRepository(STMT... stmts); void add(STMT... stmts); void clear(); @Override void close(); @Override void load(Format format, InputStream is, @Nullable UID context, boolean replace); @Override void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out); @Override void export(Format format, UID context, OutputStream out); @SuppressWarnings("unchecked") CloseableIterator<STMT> findStatements(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context, boolean includeInferred); boolean exists(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context); MiniDialect getDialect(); synchronized long getNextLocalId(); void index(ID key, STMT stmt, Map<ID, PredicateCache> index); @Override void initialize(); MiniConnection openConnection(); void remove(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context); void removeStatements(Collection<STMT> stmts); @Override RT execute(RDFConnectionCallback<RT> operation); }
MiniRepository implements Repository { @Override public void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out) { RDFWriter writer = WriterUtils.createWriter(format, out, ns2prefix); RDFConnection conn = openConnection(); try { CloseableIterator<STMT> stmts = conn.findStatements(null, null, null, context, false); try { writer.begin(); while (stmts.hasNext()) { writer.handle(stmts.next()); } writer.end(); } finally { stmts.close(); } } finally { conn.close(); } } MiniRepository();  MiniRepository(int initialCapacity);  MiniRepository(int initialCapacity, boolean inverseIndex);  MiniRepository(STMT... stmts); void add(STMT... stmts); void clear(); @Override void close(); @Override void load(Format format, InputStream is, @Nullable UID context, boolean replace); @Override void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out); @Override void export(Format format, UID context, OutputStream out); @SuppressWarnings("unchecked") CloseableIterator<STMT> findStatements(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context, boolean includeInferred); boolean exists(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context); MiniDialect getDialect(); synchronized long getNextLocalId(); void index(ID key, STMT stmt, Map<ID, PredicateCache> index); @Override void initialize(); MiniConnection openConnection(); void remove(@Nullable ID subject, @Nullable UID predicate, @Nullable NODE object, @Nullable UID context); void removeStatements(Collection<STMT> stmts); @Override RT execute(RDFConnectionCallback<RT> operation);  }