Skip to content

Commit

Permalink
Merged with master.
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelRoeder committed May 20, 2016
2 parents 174a74c + aa91171 commit c39ac0e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.zip.GZIPOutputStream;

import org.aksw.gerbil.datatypes.ExperimentTaskConfiguration;
import org.aksw.gerbil.io.nif.NIFWriter;
Expand Down Expand Up @@ -52,15 +53,18 @@ public <T extends Marking> void storeAnnotatorOutput(ExperimentTaskConfiguration
List<List<T>> results, List<Document> documents) {
if (outputShouldBeStored(configuration)) {
FileOutputStream fout = null;
GZIPOutputStream gout = null;
try {
File file = generateOutputFile(configuration);
List<Document> resultDocuments = generateResultDocuments(results, documents);
fout = new FileOutputStream(file);
gout = new GZIPOutputStream(fout);
NIFWriter writer = new TurtleNIFWriter();
writer.writeNIF(resultDocuments, fout);
writer.writeNIF(resultDocuments, gout);
} catch (Exception e) {
LOGGER.error("Couldn't write annotator result to file.", e);
} finally {
IOUtils.closeQuietly(gout);
IOUtils.closeQuietly(fout);
}
}
Expand All @@ -84,7 +88,7 @@ private File generateOutputFile(ExperimentTaskConfiguration configuration) {
fileBuilder.append("-s-");
}
appendCleanedString(fileBuilder, configuration.type.name());
fileBuilder.append(".ttl");
fileBuilder.append(".ttl.gz");
return new File(fileBuilder.toString());
}

Expand Down

0 comments on commit c39ac0e

Please sign in to comment.