private RDFWriterFactory rdfWriterFactory = new RDFaWriterFactory();
public void test()
throws Exception
{
Repository rep1 = new SailRepository(new MemoryStore());
rep1.initialize();
RepositoryConnection con1 = rep1.getConnection();
URL rdf = this.getClass().getResource("/testcases/rdfa-test.rdf");
con1.add(rdf, rdf.toExternalForm(), RDFFormat.forFileName(rdf.toExternalForm()));
StringWriter writer = new StringWriter();
RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer);
rdfWriter.setBaseURI(rdf.toExternalForm());
con1.export(rdfWriter);
long before = con1.size();
con1.close();
Repository rep2 = new SailRepository(new MemoryStore());
rep2.initialize();
RepositoryConnection con2 = rep2.getConnection();
con2.add(new StringReader(writer.toString()), rdf.toExternalForm(), rdfWriterFactory.getRDFFormat());