Search in sources :

Example 1 with StoragePrefixesTDB

use of org.apache.jena.tdb2.store.StoragePrefixesTDB in project jena by apache.

the class LoaderMain method executeData.

/**
 * Create data ingestion and primary index building of a {@link LoaderPlan}.
 * In phase 1, separate threads for parsing, node table loading and primary index building,
 *
 * Used by {@link InputStage#MULTI}.
 */
private static StreamRDFCounting executeData(LoaderPlan loaderPlan, DatasetGraphTDB dsgtdb, Map<String, TupleIndex> indexMap, List<BulkStartFinish> dataProcess, MonitorOutput output) {
    StoragePrefixesTDB dps = (StoragePrefixesTDB) dsgtdb.getStoragePrefixes();
    PrefixHandlerBulk prefixHandler = new PrefixHandlerBulk(dps, output);
    dataProcess.add(prefixHandler);
    // -- Phase 2 block. Indexer and Destination (blocks of Tuple<NodeId>)
    TupleIndex[] idx3 = PhasedOps.indexSetFromNames(loaderPlan.primaryLoad3(), indexMap);
    Indexer indexer3 = new Indexer(output, idx3);
    TupleIndex[] idx4 = PhasedOps.indexSetFromNames(loaderPlan.primaryLoad4(), indexMap);
    Indexer indexer4 = new Indexer(output, idx4);
    dataProcess.add(indexer3);
    dataProcess.add(indexer4);
    Destination<Tuple<NodeId>> functionIndexer3 = indexer3.index();
    Destination<Tuple<NodeId>> functionIndexer4 = indexer4.index();
    // -- Phase 2 block.
    // -- Phase 1.
    // This is the other way round to AsyncParser.
    // Here, we return a StreamRDF to pump data into and the rest of the
    // processing is on other threads. AsyncParser has the processing on the caller thread
    // and so the current thread continues when the processing from the parser is finished.
    DataToTuples dtt = new DataToTuples(dsgtdb, functionIndexer3, functionIndexer4, output);
    DataBatcher dataBatcher = new DataBatcher(dtt.data(), prefixHandler.handler(), output);
    dataProcess.add(dtt);
    dataProcess.add(dataBatcher);
    return dataBatcher;
}
Also used : StoragePrefixesTDB(org.apache.jena.tdb2.store.StoragePrefixesTDB) TupleIndex(org.apache.jena.tdb2.store.tupletable.TupleIndex) Tuple(org.apache.jena.atlas.lib.tuple.Tuple)

Example 2 with StoragePrefixesTDB

use of org.apache.jena.tdb2.store.StoragePrefixesTDB in project jena by apache.

the class TDB2StorageBuilder method buildPrefixes.

private StoragePrefixes buildPrefixes() {
    NodeTable nodeTablePrefixes = buildNodeTable(params.getPrefixTableBaseName(), false);
    StoragePrefixesTDB prefixes = buildPrefixTable(nodeTablePrefixes);
    return prefixes;
}
Also used : NodeTable(org.apache.jena.tdb2.store.nodetable.NodeTable)

Example 3 with StoragePrefixesTDB

use of org.apache.jena.tdb2.store.StoragePrefixesTDB in project jena by apache.

the class TDB2StorageBuilder method buildPrefixTable.

private StoragePrefixesTDB buildPrefixTable(NodeTable prefixNodes) {
    String primary = params.getPrimaryIndexPrefix();
    String[] indexes = params.getPrefixIndexes();
    TupleIndex[] prefixIndexes = makeTupleIndexes(primary, indexes);
    if (prefixIndexes.length != 1)
        error(log, "Wrong number of triple table tuples indexes: " + prefixIndexes.length);
    // No cache - the prefix mapping is a cache
    // NodeTable prefixNodes = makeNodeTable(location, pnNode2Id, pnId2Node, -1, -1, -1);
    NodeTupleTable prefixTable = new NodeTupleTableConcrete(primary.length(), prefixIndexes, prefixNodes);
    StoragePrefixesTDB x = new StoragePrefixesTDB(txnSystem, prefixTable);
    // DatasetPrefixesTDB prefixes = new DatasetPrefixesTDB(prefixTable);
    log.debug("Prefixes: " + primary + " :: " + String.join(",", indexes));
    return x;
}
Also used : NodeTupleTable(org.apache.jena.tdb2.store.nodetupletable.NodeTupleTable) NodeTupleTableConcrete(org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete) TupleIndex(org.apache.jena.tdb2.store.tupletable.TupleIndex)

Aggregations

TupleIndex (org.apache.jena.tdb2.store.tupletable.TupleIndex)2 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)1 StoragePrefixesTDB (org.apache.jena.tdb2.store.StoragePrefixesTDB)1 NodeTable (org.apache.jena.tdb2.store.nodetable.NodeTable)1 NodeTupleTable (org.apache.jena.tdb2.store.nodetupletable.NodeTupleTable)1 NodeTupleTableConcrete (org.apache.jena.tdb2.store.nodetupletable.NodeTupleTableConcrete)1