size = FastRDF3XIndexConstruction.mergeRuns(dir, listOfTries.size(), primaryPos, other_condition1, other_condition2);
size = FastRDF3XIndexConstruction.mergeRuns(dir, listOfTries.size(), primaryPos, other_condition2, other_condition1);
}
// generate indices (evaluation indices plus histogram indices)
final SixIndices indices = new SixIndices(defaultGraphs.iterator().next());
for(int primaryPos=0; primaryPos<3; primaryPos++) {
final int other_condition1 = (primaryPos==0)?1:0;
final int other_condition2 = (primaryPos==2)?1:2;
final CollationOrder order1 = CollationOrder.valueOf(FastRDF3XIndexConstruction.map[primaryPos] + FastRDF3XIndexConstruction.map[other_condition1] + FastRDF3XIndexConstruction.map[other_condition2]);
final String prefixFilename = dir + FastRDF3XIndexConstruction.map[primaryPos] + "_Final_Run_";
indices.generate(order1, new GeneratorFromFinalRun(prefixFilename + FastRDF3XIndexConstruction.map[other_condition1] + FastRDF3XIndexConstruction.map[other_condition2], size, primaryPos, other_condition1, other_condition2));
indices.generateStatistics(order1);
final CollationOrder order2 = CollationOrder.valueOf(FastRDF3XIndexConstruction.map[primaryPos] + FastRDF3XIndexConstruction.map[other_condition2] + FastRDF3XIndexConstruction.map[other_condition1]);
indices.generate(order2, new GeneratorFromFinalRun(prefixFilename + FastRDF3XIndexConstruction.map[other_condition2] + FastRDF3XIndexConstruction.map[other_condition1], size, primaryPos, other_condition2, other_condition1));
indices.generateStatistics(order2);
}
indices.constructCompletely();
// write out index info
final OutputStream out = new BufferedOutputStream(new FileOutputStream(writeindexinfo));
BufferManager.getBufferManager().writeAllModifiedPages();
OutHelper.writeLuposInt(lupos.datastructures.paged_dbbptree.DBBPTree.getCurrentFileID(), out);
((lupos.datastructures.paged_dbbptree.DBBPTree) ((StringIntegerMapJava) LazyLiteral.getHm()).getOriginalMap()).writeLuposObject(out);
((StringArray) LazyLiteral.getV()).writeLuposStringArray(out);
OutHelper.writeLuposInt(1, out);
LiteralFactory.writeLuposLiteral(defaultGraphs.iterator().next(), out);
indices.writeIndexInfo(out);
OutHelper.writeLuposInt(0, out);
out.close();
final Date end = new Date();
log.debug("_______________________________________________________________");
log.info("Done, RDF3X index constructed!");
log.debug("End time: {}", end);
log.debug("Used time: {}", new TimeInterval(start, end));
log.debug("Number of imported triples: {}", indices.getIndex(CollationOrder.SPO).size());
} catch (final Exception e) {
log.error(e.getMessage(), e);
}
}