On 29/08/17 15:45, aj...@apache.org wrote:
tdbdump (along with all of the TDB shell utilities) is available in the Jena full distribution:

https://jena.apache.org/download/index.cgi


ajs6f

George News wrote on 8/29/17 2:30 AM:
Hi,

I have a named graph that is becoming very big, and therefore searches on it are quite slow. I'm planning on make a backup from time to time and reset the data in the original.

The code that I'm currently using is the one below, which summarizing consists on creating a new graph based on the original one, delete the original and create it from scratch.

public void reset() {
  dataset.begin(ReadWrite.WRITE);
  try {
    LocalDateTime date = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
    String dateString = date.format(formatter);
    String backupModelName = modelName + "-" + dateString;
    dataset.addNamedModel(backupModelName, getModel());

A SPARQL UPDATE of using "MOVE" is neater.

For TDB, there is little choice but to do some kind of copy to rename. It is a change to the quads for the graph with no indirection to flip the name in the storage.

    Andy

    dataset.removeNamedModel(modelName);
    dataset.addNamedModel(modelName,
                            FiestaIoTOntModel.getInstance());
    dataset.commit();
  } finally {
    dataset.end();
  }
}


Is there any easier way to do this?

Besides, I want to also get the graph model as a text file or backup file to be stored in another machine. I have read about `tdbdump` utility. Where can I find it? I'm only using JENA Java libraries.

Thanks in advance.

Reply via email to