use of org.apache.jena.tdb2.store.NodeId in project jena by apache.
the class StageGeneratorDirectTDB method execute.
@Override
public QueryIterator execute(BasicPattern pattern, QueryIterator input, ExecutionContext execCxt) {
// --- In case this isn't for TDB2
Graph g = execCxt.getActiveGraph();
if (g instanceof GraphViewSwitchable) {
GraphViewSwitchable gvs = (GraphViewSwitchable) g;
g = gvs.getBaseGraph();
}
if (!(g instanceof GraphTDB))
// Not us - bounce up the StageGenerator chain
return above.execute(pattern, input, execCxt);
GraphTDB graph = (GraphTDB) g;
Predicate<Tuple<NodeId>> filter = QC2.getFilter(execCxt.getContext());
return PatternMatchTDB2.execute(graph, pattern, input, filter, execCxt);
}
use of org.apache.jena.tdb2.store.NodeId in project jena by apache.
the class NodeIdFactory method create.
private static NodeId create(int v1, long v2) {
if (!BitsInt.isSet(v1, 32))
return createPtrLong(v1, v2);
int t = v1 >> 24;
NodeIdType type = NodeIdType.intToEnum(t);
if (type == NodeIdType.SPECIAL)
throw new TDBException(String.format("Attempt to create a special from a long: 0x%016", v2));
return createNew(type, 0, v2);
}
use of org.apache.jena.tdb2.store.NodeId in project jena by apache.
the class NodeIdFactory method create64.
// ---- Create from binary.
// 64 bit create
private static NodeId create64(long value2) {
if (!BitsLong.isSet(value2, 63))
return createPtr(value2);
// Inline.
long v2 = value2;
if (BitsLong.isSet(v2, 62)) {
// XSD_DOUBLE
v2 = DoubleNode62.removeType(v2);
return NodeId.createRaw(NodeIdType.XSD_DOUBLE, v2);
}
// 7 bits
int t = (int) BitsLong.unpack(v2, 56, 63);
v2 = BitsLong.clear(v2, 56, 64);
NodeIdType type = NodeIdType.intToEnum(t);
if (type == NodeIdType.SPECIAL)
throw new TDBException(String.format("Attempt to create a special from a long: 0x%016", v2));
return NodeId.createRaw(type, v2);
}
use of org.apache.jena.tdb2.store.NodeId 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.NodeId 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);
}
Aggregations