Copy a Sesame repository into a new one

谁说胖子不能爱 提交于 2019-12-02 06:23:10

Manually (Workbench)

  1. Open the repository you want to copy from.
  2. select 'Export'.
  3. choose a suitable export format ('TriG' or 'BinaryRDF' are good choices as these both preserve context information), and hit the 'download' button to save the data export to local disk.
  4. Open the repository you want to copy to.
  5. select 'Add'.
  6. choose 'select the file containing the RDF data you wish to upload'
  7. Click 'Browse' to find the data export file on your local disk.
  8. Make sure 'use Base URI as context identifier' is not selected.
  9. Hit 'upload', and sit back.

Programmatically

First, open RepositoryConnnections to both repositories:

RepositoryConnection source = sourceRepo.getConnection();
RepositoryConnection target = targetRepo.getConnection();

Then, read all statements from source and immediately insert into target:

target.add(source.getStatements(null, null, null, true)); 

Either basic method should work just fine for any repository up to about several million triples in size. Of course there are plenty of more advanced methods for larger bulk sizes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!