use of org.apache.jena.tdb2.store.NodeId in project jena by apache.
the class LoaderOps method copyIndex.
/**
* Copy a stream to several indexes (sequential version)
*/
public static void copyIndex(Iterator<Tuple<NodeId>> srcIter, TupleIndex[] destIndexes, ProgressMonitor monitor) {
long counter = 0;
for (; srcIter.hasNext(); ) {
counter++;
Tuple<NodeId> tuple = srcIter.next();
monitor.tick();
for (TupleIndex destIdx : destIndexes) {
if (destIdx != null)
destIdx.add(tuple);
}
}
}
use of org.apache.jena.tdb2.store.NodeId 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.NodeId in project jena by apache.
the class Indexer method startBulk.
/**
* Start the threads that will do the indexing
*/
@Override
public void startBulk() {
for (int i = 0; i < N; i++) {
TupleIndex idx = indexes[i];
BlockingQueue<List<Tuple<NodeId>>> pipe = pipesTripleIndexers[i];
new Thread(() -> stageIndex(pipe, idx)).start();
}
}
use of org.apache.jena.tdb2.store.NodeId 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;
}
use of org.apache.jena.tdb2.store.NodeId in project jena by apache.
the class SolverLibTDB method graphNames.
/**
* Find all the graph names in the quads table.
*/
static QueryIterator graphNames(DatasetGraphTDB ds, Node graphNode, QueryIterator input, Predicate<Tuple<NodeId>> filter, ExecutionContext execCxt) {
List<Abortable> killList = new ArrayList<>();
Iterator<Tuple<NodeId>> iter1 = ds.getQuadTable().getNodeTupleTable().find(NodeId.NodeIdAny, NodeId.NodeIdAny, NodeId.NodeIdAny, NodeId.NodeIdAny);
if (filter != null)
iter1 = Iter.filter(iter1, filter);
Iterator<NodeId> iter2 = Iter.map(iter1, t -> t.get(0));
// Project is cheap - don't brother wrapping iter1
iter2 = makeAbortable(iter2, killList);
Iterator<NodeId> iter3 = Iter.distinct(iter2);
iter3 = makeAbortable(iter3, killList);
Iterator<Node> iter4 = NodeLib.nodes(ds.getQuadTable().getNodeTupleTable().getNodeTable(), iter3);
final Var var = Var.alloc(graphNode);
Iterator<Binding> iterBinding = Iter.map(iter4, node -> BindingFactory.binding(var, node));
return new QueryIterAbortable(iterBinding, killList, input, execCxt);
}
Aggregations