0

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?

kurious
  • 1,024
  • 10
  • 29

1 Answers1

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.

Community
  • 1
  • 1
Jeen Broekstra
  • 21,642
  • 4
  • 51
  • 73
  • Dydra won't let me use SERVICE. As an alternative, I'm trying to use an RDFlib graph that parses the sesame repository and INSERTs all data from it at one go. I've been able to port the data using GUI. This pursuit of other methods is to find a flawless method to port data programmatically. Can you please also demonstrate a code example to parse all triples from a graph without using SERVICE in your response? – kurious Dec 24 '15 at 22:28
  • Follow up question at http://stackoverflow.com/questions/34458826/how-to-insert-all-triples-from-an-rdflib-graph-into-another-repository-without-i – kurious Dec 24 '15 at 23:41