Search in sources :

Example 1 with IndexParams

use of org.apache.jena.tdb.index.IndexParams in project jena by apache.

the class IndexAssembler method open.

@Override
public TupleIndex open(Assembler a, Resource root, Mode mode) {
    exactlyOneProperty(root, pDescription);
    String desc = getAsStringValue(root, pDescription).toUpperCase(Locale.ENGLISH);
    exactlyOneProperty(root, pFile);
    String filename = getAsStringValue(root, pFile);
    // Need to get location from the enclosing PGraphAssembler
    if (location != null)
        filename = location.absolute(filename);
    String primary = null;
    RecordFactory rf = null;
    switch(desc.length()) {
        case 3:
            primary = Names.primaryIndexTriples;
            rf = SystemTDB.indexRecordTripleFactory;
            break;
        case 4:
            primary = Names.primaryIndexQuads;
            rf = SystemTDB.indexRecordQuadFactory;
            break;
        default:
            throw new TDBException("Bad length for index description: " + desc);
    }
    // Problems with spotting the index technology.
    // FileSet.fromFilename(filename) ;
    FileSet fileset = null;
    IndexParams idxParams = StoreParams.getDftStoreParams();
    RangeIndex rIndex = IndexFactory.buildRangeIndex(fileset, rf, idxParams);
    return new TupleIndexRecord(desc.length(), new ColumnMap(primary, desc), desc, rf, rIndex);
}
Also used : ColumnMap(org.apache.jena.tdb.lib.ColumnMap) RecordFactory(org.apache.jena.tdb.base.record.RecordFactory) TupleIndexRecord(org.apache.jena.tdb.store.tupletable.TupleIndexRecord) FileSet(org.apache.jena.tdb.base.file.FileSet) TDBException(org.apache.jena.tdb.TDBException) IndexParams(org.apache.jena.tdb.index.IndexParams) RangeIndex(org.apache.jena.tdb.index.RangeIndex)

Example 2 with IndexParams

use of org.apache.jena.tdb.index.IndexParams in project jena by apache.

the class TestTupleIndexRecord method createIndex.

@Override
protected TupleIndexRecord createIndex(String description) {
    IndexParams indexParams = StoreParams.getDftStoreParams();
    RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams);
    ColumnMap cmap = new ColumnMap("SPO", description);
    TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx);
    return index;
}
Also used : ColumnMap(org.apache.jena.tdb.lib.ColumnMap) IndexParams(org.apache.jena.tdb.index.IndexParams) RangeIndex(org.apache.jena.tdb.index.RangeIndex)

Example 3 with IndexParams

use of org.apache.jena.tdb.index.IndexParams in project jena by apache.

the class TestTupleIndexRecordDirect method create.

static TupleIndexRecord create(String description) {
    IndexParams indexParams = StoreParams.getDftStoreParams();
    RangeIndex rIdx = IndexFactory.buildRangeIndex(FileSet.mem(), factory, indexParams);
    ColumnMap cmap = new ColumnMap("SPO", description);
    TupleIndexRecord index = new TupleIndexRecord(3, cmap, description, factory, rIdx);
    return index;
}
Also used : ColumnMap(org.apache.jena.tdb.lib.ColumnMap) IndexParams(org.apache.jena.tdb.index.IndexParams) RangeIndex(org.apache.jena.tdb.index.RangeIndex)

Aggregations

IndexParams (org.apache.jena.tdb.index.IndexParams)3 RangeIndex (org.apache.jena.tdb.index.RangeIndex)3 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)3 TDBException (org.apache.jena.tdb.TDBException)1 FileSet (org.apache.jena.tdb.base.file.FileSet)1 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)1 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)1