I am loading an RDF rump from the web as an InputStream, which contains between 120 and 1500 triples. On average, clearing the context takes about half a second, while adding the triples takes around 74 seconds for the 120 triples. The physical file size of the RDFXML serialisation is between 6KB and 195KB.
InputStream input = ...
try (RepositoryConnection conn = db.getConnection()) {
try {
conn.clear(context);
conn.add(input, "", RDFFormat.RDFXML, context);
} catch (Exception e) {
e.printStackTrace();
}
}
The repository is initialised as follows:
RemoteRepositoryManager manager = new RemoteRepositoryManager(serverUrl);
manager.initialize();
db = manager.getRepository("repo");
You could try the following:
Repository repo = new SailRepository(new MemoryStore());-Xmxin JAVA_OPTSconn.clear(context);is intended to do. By my understanding it will remove all triples in the context?From my place it lasts around 5min to load 10,000,000 Triples of a 2.7G rdf dump from wikidata to an in-memory repo (I run with maven tests with
export MAVEN_OPTS=-Xmx7000m). This makes ~33333 Triples per sec - if I calculated right ;-).