Bambus
Bambus

Reputation: 1583

RDFWriter write takes so much time

I have Java app with Jena TDB. I want to make export on the database which has over 3 million objects.

For exporting i have increased Java heap space and i am using:

  RDFWriter writer = model.getWriter("RDF/XML");
  writer.setProperty("allowBadURIs", true);
  writer.setProperty("relativeURIs", ""); 
  writer.setProperty("tab", "0"); 
  writer.setProperty("showXmlDeclaration", "true");
  writer.setProperty("xmlbase", JENAXMLBASE);
  fis = new FileOutputStream(file);
  writer.write(writableModel, fis, null);

It works fine but the function takes so much time. I can see that file is created and i can open the exported file but the function continues to work.

My question is how can i reduce the execution time and to stop the function when the file is created and the objects are exported if it is possible?

Upvotes: 1

Views: 112

Answers (1)

AndyS
AndyS

Reputation: 16700

"RDF/XML" is pretty-printed output and can be expensive, depending on the data.

You can also try using a buffered output stream.

Or try different RDFWriter settings, especially the rules: https://jena.apache.org/documentation/io/rdfxml_howto.html#advanced-rdfxml-output

Upvotes: 1

Related Questions