将芝麻存储库复制到新存储库中 [英] Copy a Sesame repository into a new one

查看:79
本文介绍了将芝麻存储库复制到新存储库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将所有数据从现有的Sesame存储库复制到一个新的存储库中.我需要进行迁移,以便在三重存储上使用OWL推理,而在内存中存储库(现有存储库的类型)中无法使用OWLIM.

I'd like to copy all the data from an existing Sesame repository into a new one. I need the migration so that I use OWL-inferencing on my triplestore which is not possible using OWLIM in an In Memory repository (the type of my existing repository).

将所有三元组从一个存储库复制到一个新的最有效的方法是什么?

What is the most efficient way to copy all triples from a repository into a new one?

更新1:

我很好奇为什么使用SPARQL INSERT不能成为有效的方法.我在新存储库的SPARQL Update部分下尝试了以下代码:

I'm curious to understand why using SPARQL INSERT cannot be a valid approach. I tried this code under the SPARQL Update section of a new repository:

PREFIX : <http://dbpedia.org/resource/>
INSERT{?s ?p ?o} 
WHERE 
{ 
SERVICE <http://my.ip.ad.here:8080/openrdf-workbench/repositories/rep_name>
{ 
?s ?p ?o 
} 
}

我收到以下错误:

org.openrdf.query.UpdateExecutionException: org.openrdf.sail.SailException: org.openrdf.query.QueryEvaluationException:

查询中是否存在错误,或者无法以这种方式插入数据?我已经使用类似结构的查询从DBpedia插入了数据.

Is there an error in the query or can the data not be inserted this way? I've inserted data from DBpedia using queries of similar structure.

推荐答案

手动(工作台)

  1. 打开要从中复制 的存储库.
  2. 选择导出".
  3. 选择合适的导出格式("TriG"或"BinaryRDF"都是不错的选择,因为它们都保留了上下文信息),然后单击下载"按钮以将数据导出保存到本地磁盘.
  4. 打开要复制的存储库.
  5. 选择添加".
  6. 选择选择包含您要上传的RDF数据的文件"
  7. 单击浏览"以在本地磁盘上找到数据导出文件.
  8. 确保未未选择使用基本URI作为上下文标识符".
  9. 打上载",然后坐下.
  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.

以编程方式

首先,打开两个仓库的RepositoryConnnection:

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

然后,从source中读取所有语句,然后立即插入target中:

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.

这篇关于将芝麻存储库复制到新存储库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆