Skip to content Skip to sidebar Skip to footer

How To Prevent Triples From Getting Mixed Up While Uploading To Dydra Programmatically?

I am trying to upload some data to Dydra from a Sesame triplestore I have on my computer. While the download from Sesame works fine, the triples get mixed up (the s-p-o relationshi

Solution 1:

A far simpler way to copy your data over (apart from using a CONSTRUCT query instead of a SELECT, like I mentioned in the comment) is simply to have Dydra itself directly access your Sesame endpoint, for example via a SERVICE-clause.

Execute the following on your Dydra database, and (after some time, depending on how large your Sesame database is), everything will be copied over:

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

If the above doesn't work on Dydra, you can alternatively just directly access the RDF statements from your Sesame store by using the URI http://my.ip.ad.here:8080/openrdf-sesame/repositories/rep_name/statements. Assuming Dydra has an upload-feature where you can provide the URL of an RDF document, you can simply provide it the above URI and it should be able to load it.

Solution 2:

The code above can work if the following changes are made:

  1. Use CONSTRUCT query instead of SELECT. Details here -> How to iterate over CONSTRUCT output from rdflib?
  2. Use key as input for both account[login] and account[password]

However, this is probably not the most efficient way. Primarily, doing individual INSERTs for every triple is not a good way. Dydra doesn't record all statements this way (I got only about 30% of the triples inserted). On the contrary, using the http://my.ip.ad.here:8080/openrdf-sesame/repositories/rep_name/statements method as suggested by Jeen enabled me to port all the data successfully.

Post a Comment for "How To Prevent Triples From Getting Mixed Up While Uploading To Dydra Programmatically?"