@Test(expected = RepositoryException.class) public void initialize() { repository = new MemoryRepository(); repository.setSources(new RDFSource("", Format.RDFXML, "") { @Override public InputStream openStream() throws IOException { throw new IllegalStateException(); } }); repository.initialize(); }
public void initialize() { if (!initialized) { try { repository = createRepository(sesameInference); repository.initialize(); RepositoryConnection connection = repository.getConnection(); connection.setTransactionIsolation(Isolation.READ_COMMITTED); connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) { if (source.getResource() != null) { logger.info("loading " + source.getResource()); } connection.add(source.openStream(), source.getContext(), FormatHelper.getFormat(source.getFormat()), vf.createURI(source.getContext())); } } connection.commit(); } catch (Exception e) { connection.rollback(); throw new RepositoryException(e); } finally { connection.close(); } } catch (StoreException e) { throw new RepositoryException(e); } initialized = true; } }
SesameRepository implements Repository { public void initialize() { if (!initialized) { try { repository = createRepository(sesameInference); repository.initialize(); RepositoryConnection connection = repository.getConnection(); connection.setTransactionIsolation(Isolation.READ_COMMITTED); connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) { if (source.getResource() != null) { logger.info("loading " + source.getResource()); } connection.add(source.openStream(), source.getContext(), FormatHelper.getFormat(source.getFormat()), vf.createURI(source.getContext())); } } connection.commit(); } catch (Exception e) { connection.rollback(); throw new RepositoryException(e); } finally { connection.close(); } } catch (StoreException e) { throw new RepositoryException(e); } initialized = true; } } }
SesameRepository implements Repository { public void initialize() { if (!initialized) { try { repository = createRepository(sesameInference); repository.initialize(); RepositoryConnection connection = repository.getConnection(); connection.setTransactionIsolation(Isolation.READ_COMMITTED); connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) { if (source.getResource() != null) { logger.info("loading " + source.getResource()); } connection.add(source.openStream(), source.getContext(), FormatHelper.getFormat(source.getFormat()), vf.createURI(source.getContext())); } } connection.commit(); } catch (Exception e) { connection.rollback(); throw new RepositoryException(e); } finally { connection.close(); } } catch (StoreException e) { throw new RepositoryException(e); } initialized = true; } }  }
SesameRepository implements Repository { public void initialize() { if (!initialized) { try { repository = createRepository(sesameInference); repository.initialize(); RepositoryConnection connection = repository.getConnection(); connection.setTransactionIsolation(Isolation.READ_COMMITTED); connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) { if (source.getResource() != null) { logger.info("loading " + source.getResource()); } connection.add(source.openStream(), source.getContext(), FormatHelper.getFormat(source.getFormat()), vf.createURI(source.getContext())); } } connection.commit(); } catch (Exception e) { connection.rollback(); throw new RepositoryException(e); } finally { connection.close(); } } catch (StoreException e) { throw new RepositoryException(e); } initialized = true; } }  @Override void close(); @Override RT execute(RDFConnectionCallback<RT> operation); @Override void export(Format format, UID context, OutputStream out); @Override void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out); abstract long getNextLocalId(); org.openrdf.repository.Repository getSesameRepository(); void initialize(); @Override void load(Format format, InputStream is, @Nullable UID context, boolean replace); @Override RDFConnection openConnection(); final void setSesameInference(boolean sesameInference); void setSources(RDFSource... sources); }
SesameRepository implements Repository { public void initialize() { if (!initialized) { try { repository = createRepository(sesameInference); repository.initialize(); RepositoryConnection connection = repository.getConnection(); connection.setTransactionIsolation(Isolation.READ_COMMITTED); connection.begin(); try { if (sources != null && connection.isEmpty()) { ValueFactory vf = connection.getValueFactory(); for (RDFSource source : sources) { if (source.getResource() != null) { logger.info("loading " + source.getResource()); } connection.add(source.openStream(), source.getContext(), FormatHelper.getFormat(source.getFormat()), vf.createURI(source.getContext())); } } connection.commit(); } catch (Exception e) { connection.rollback(); throw new RepositoryException(e); } finally { connection.close(); } } catch (StoreException e) { throw new RepositoryException(e); } initialized = true; } }  @Override void close(); @Override RT execute(RDFConnectionCallback<RT> operation); @Override void export(Format format, UID context, OutputStream out); @Override void export(Format format, Map<String, String> ns2prefix, UID context, OutputStream out); abstract long getNextLocalId(); org.openrdf.repository.Repository getSesameRepository(); void initialize(); @Override void load(Format format, InputStream is, @Nullable UID context, boolean replace); @Override RDFConnection openConnection(); final void setSesameInference(boolean sesameInference); void setSources(RDFSource... sources);  }