What URI to use for a Sesame repository while executing a SPARQL ADD query

空扰寡人 提交于 2020-01-06 13:13:56

问题


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>

The query gets executed with output as 'true' but no triples are added.

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.

What am I doing incorrectly here? Is the URL I am using for repositories OK or does something else need to be changed?


回答1:


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.

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)

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.



来源:https://stackoverflow.com/questions/34457554/what-uri-to-use-for-a-sesame-repository-while-executing-a-sparql-add-query

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