AGIndexNewTriples.java
package com.franz.ag.examples;
import com.franz.ag.*;
public class AGIndexNewTriples {
@param
@throws
public static void main(String[] args) throws AllegroGraphException {
AllegroGraphConnection ags = new AllegroGraphConnection();
try {
ags.enable();
} catch (Exception e) {
throw new AllegroGraphException("Server connection problem", e);
}
long chunkSize = ags.getChunkSize();
System.out.println("Setting index chunk size to 1000.");
ags.setChunkSize(1000);
AllegroGraph ts = ags.renew("wilburwine", AGPaths.TRIPLE_STORES);
String ntripleFile = AGPaths.dataSources("wilburwine.ntriples");
System.out.println("Loading N-Triples " + ntripleFile);
AGUtils.loadNTriplesWithTiming(ts,ntripleFile);
System.out.println("Unindexed triples: " + ts.getUnindexedTripleCount());
System.out.println("Unmerged chunks: " + ts.getUnmergedCount());
ts.indexNewTriples(true);
System.out.println("After calling indexNewTriples:");
System.out.println("Unindexed triples: " + ts.getUnindexedTripleCount());
System.out.println("Unmerged chunks: " + ts.getUnmergedCount());
ts.indexAllTriples(true);
System.out.println("After calling indexAllTriples:");
System.out.println("Unindexed triples: " + ts.getUnindexedTripleCount());
System.out.println("Chunks: " + ts.getUnmergedCount());
System.out.println("Setting index chunk size back to its original value.");
ags.setChunkSize(chunkSize);
ts.closeTripleStore();
ags.disable();
}
}
Up |
Next