use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class DebugTDB method getIndex.
public static TupleIndex getIndex(String idxName, DatasetGraphTDB dsg) {
System.out.println(idxName);
TupleIndex[] indexes1 = dsg.getTripleTable().getNodeTupleTable().getTupleTable().getIndexes();
TupleIndex[] indexes2 = dsg.getQuadTable().getNodeTupleTable().getTupleTable().getIndexes();
TupleIndex idx = null;
for (TupleIndex i : indexes1) {
if (i.getName().equals(idxName))
return i;
}
for (TupleIndex i : indexes2) {
if (i.getName().equals(idxName))
return i;
}
return null;
}
use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class DebugTDB method dumpInternals.
public static void dumpInternals(DatasetGraphTDB dsg, boolean includeNamedGraphs) {
dumpNodeTable("Nodes", dsg);
TupleIndex[] indexes1 = dsg.getTripleTable().getNodeTupleTable().getTupleTable().getIndexes();
TupleIndex[] indexes2 = dsg.getQuadTable().getNodeTupleTable().getTupleTable().getIndexes();
for (TupleIndex idx : indexes1) {
System.out.println(idx.getName());
dumpIndex(idx);
}
if (!includeNamedGraphs)
return;
for (TupleIndex idx : indexes2) {
System.out.println(idx.getName());
dumpIndex(idx);
}
}
use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class ProcIndexCopy method exec.
// Ideas:
// Copy to buffer, sort, write in sequential clumps.
// Profile code for hotspots
// Maybe be worth opening the data file (the leaves) as a regular,
// non-memory mapped file as we read it through once, in natural order,
// and it may be laid out in increasing block order on-disk, e.g. repacked
// and in increasing order with occassional oddities if SPO from the bulk loader.
public static void exec(String locationStr1, String indexName1, String locationStr2, String indexName2) {
// Argument processing
Location location1 = Location.create(locationStr1);
Location location2 = Location.create(locationStr2);
int keyLength = SystemTDB.SizeOfNodeId * indexName1.length();
int valueLength = 0;
// The name is the order.
String primary = "SPO";
String indexOrder = indexName2;
String label = indexName1 + " => " + indexName2;
TupleIndex index1 = Build.openTupleIndex(location1, indexName1, primary, indexName1, 10, 10, keyLength, valueLength);
TupleIndex index2 = Build.openTupleIndex(location2, indexName2, primary, indexOrder, 10, 10, keyLength, valueLength);
tupleIndexCopy(index1, index2, label);
index1.close();
index2.close();
}
use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class LoaderNodeTupleTable method copyIndex.
static void copyIndex(Iterator<Tuple<NodeId>> srcIter, TupleIndex[] destIndexes, String label, LoadMonitor monitor) {
monitor.startIndex(label);
long counter = 0;
for (; srcIter.hasNext(); ) {
counter++;
Tuple<NodeId> tuple = srcIter.next();
monitor.indexItem();
for (TupleIndex destIdx : destIndexes) {
if (destIdx != null)
destIdx.add(tuple);
}
}
monitor.finishIndex(label);
}
use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.
the class BuilderSecondaryIndexesParallel method createSecondaryIndexes.
@Override
public void createSecondaryIndexes(TupleIndex primaryIndex, TupleIndex[] secondaryIndexes) {
monitor.print("** Parallel index building");
Timer timer = new Timer();
timer.startTimer();
int semaCount = 0;
Semaphore sema = new Semaphore(0);
for (TupleIndex index : secondaryIndexes) {
if (index != null) {
Runnable builder = setup(sema, primaryIndex, index, index.getMapping());
new Thread(builder).start();
semaCount++;
}
}
try {
sema.acquire(semaCount);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
long time = timer.readTimer();
timer.endTimer();
monitor.print("Time for parallel indexing: %.2fs\n", time / 1000.0);
}
Aggregations