问题描述
我正在尝试将数据从Sesame存储库复制到另一个Triplestore.我尝试了以下查询:
I'm trying to copy the data from a Sesame repository to another triplestore. I tried the following query:
ADD <http://my.ip.ad.here:8080/openrdf-workbench/repositories/rep_name> TO <http://dydra.com/username/rep_name>
执行查询时输出为'true',但不添加任何三元组.
The query gets executed with output as 'true' but no triples are added.
因此,我尝试使用类似的查询来查看是否可以使用SPARQL Update将数据从一个芝麻存储库移动到另一个芝麻存储库:
So, I tried a similar query to see if I can move data from one Sesame repository to another using SPARQL Update:
ADD <http://my.ip.ad.here:8080/openrdf-workbench/repositories/source_rep> TO <http://my.ip.ad.here:8080/openrdf-workbench/repositories/destination_rep>
同样,查询被执行,但没有添加三元组.
Again, the query gets executed but no triples are added.
我在这里做错了什么?我用于存储库的URL是否正常,还是需要更改其他内容?
What am I doing incorrectly here? Is the URL I am using for repositories OK or does something else need to be changed?
推荐答案
SPARQL ADD
操作将复制命名图(或上下文",如芝麻中所知).此更新在单个存储库(您在其上执行更新)上运行-不会将数据从一个存储库复制到另一个存储库.
The SPARQL ADD
operation copies named graphs (or 'contexts', as they are known in Sesame). The update operates on a single repository (the one on which you execute it) - it doesn't copy data from one repository to the other.
要将数据通过SPARQL更新从一个存储库复制到另一个存储库,您需要对SERVICE
子句使用INSERT
操作:
To copy data from one repository to the other via a SPARQL update, you need to use an INSERT
operation with a SERVICE
clause:
INSERT { ?s ?p ?o }
WHERE {
SERVICE <http://my.ip.ad.here:8080/openrdf-sesame/repositories/rep_name> { ?s ?p ?o }
}
(请注意,以上内容不会保留源存储库中的上下文/命名图信息)
(note that the above will not preserve context / named graph information from your source repo)
或者,您可以通过使用http://my.ip.ad.here:8080/openrdf-sesame/repositories/rep_name/statements
作为您要上传的RDF文件的URL,通过API或通过工作台进行复制.有关此问题的更多详细信息,请参见我对相关问题的回答.
Alternatively, you can just copy over via the API, or via the Workbench by using http://my.ip.ad.here:8080/openrdf-sesame/repositories/rep_name/statements
as the URL of the RDF file you wish to upload. More details on this in my answer to this related question.
这篇关于执行SPARQL ADD查询时用于芝麻存储库的URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!