use of org.apache.jena.tdb2.store.nodetable.NodeTable in project jena by apache.
the class DataToTuples method action.
// Triples.
private void action() {
coordinator = CoLib.newCoordinator();
CoLib.add(coordinator, nodeTable);
CoLib.start(coordinator);
transaction = coordinator.begin(TxnType.WRITE);
try {
for (; ; ) {
DataBlock data = input.take();
if (data == DataBlock.END)
break;
if (data.triples != null) {
List<Tuple<NodeId>> tuples = new ArrayList<>(data.triples.size());
for (Triple t : data.triples) {
countTriples++;
accTuples(t, nodeTable, tuples);
}
dispatchTuples3(tuples);
}
if (data.quads != null) {
List<Tuple<NodeId>> tuples = new ArrayList<>(data.quads.size());
for (Quad q : data.quads) {
countQuads++;
accTuples(q, nodeTable, tuples);
}
dispatchTuples4(tuples);
}
}
dispatchTuples3(LoaderConst.END_TUPLES);
dispatchTuples4(LoaderConst.END_TUPLES);
transaction.commit();
} catch (Exception ex) {
Log.error(this, "Exception during data loading", ex);
transaction.abort();
}
transaction.end();
CoLib.finish(coordinator);
termination.release();
}
use of org.apache.jena.tdb2.store.nodetable.NodeTable in project jena by apache.
the class DataToTuplesInlineSingle method nodes.
private static Tuple<NodeId> nodes(NodeTable nt, Triple triple) {
NodeId s = idForNode(nt, triple.getSubject());
NodeId p = idForNode(nt, triple.getPredicate());
NodeId o = idForNode(nt, triple.getObject());
return TupleFactory.tuple(s, p, o);
}
use of org.apache.jena.tdb2.store.nodetable.NodeTable in project jena by apache.
the class DataToTuplesInlineSingle method startBulk.
@Override
public void startBulk() {
coordinator = CoLib.newCoordinator();
CoLib.add(coordinator, nodeTable);
// Prefixes
NodeTupleTable p = prefixes.getNodeTupleTable();
CoLib.add(coordinator, p.getNodeTable());
CoLib.add(coordinator, p.getTupleTable().getIndexes());
CoLib.start(coordinator);
transaction = coordinator.begin(TxnType.WRITE);
}
use of org.apache.jena.tdb2.store.nodetable.NodeTable in project jena by apache.
the class DataToTuplesInline method nodes.
private static Tuple<NodeId> nodes(NodeTable nt, Triple triple) {
NodeId s = idForNode(nt, triple.getSubject());
NodeId p = idForNode(nt, triple.getPredicate());
NodeId o = idForNode(nt, triple.getObject());
return TupleFactory.tuple(s, p, o);
}
use of org.apache.jena.tdb2.store.nodetable.NodeTable in project jena by apache.
the class SolverLibTDB method convertToNodeIds.
static Set<NodeId> convertToNodeIds(Collection<Node> nodes, DatasetGraphTDB dataset) {
Set<NodeId> graphIds = new HashSet<>();
NodeTable nt = dataset.getQuadTable().getNodeTupleTable().getNodeTable();
for (Node n : nodes) graphIds.add(nt.getNodeIdForNode(n));
return graphIds;
}
Aggregations