use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.
the class TDBInternal method getNodeId.
/**
* Return the NodeId for a node. Returns NodeId.NodeDoesNotExist when the
* node is not found. Returns null when not a TDB-backed dataset.
*/
public static NodeId getNodeId(DatasetGraphTDB dsg, Node node) {
if (dsg == null)
return null;
NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable();
NodeId nodeId = nodeTable.getNodeIdForNode(node);
return nodeId;
}
use of org.apache.jena.tdb.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;
}
use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.
the class DatasetBuilderStd method buildNodeTable.
// -------------
private NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile, StoreParams params) {
RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId);
Index idx = /*indexBuilder.*/
buildIndex(fsIndex, recordFactory, params);
ObjectFile objectFile = objectFileBuilder.buildObjectFile(fsObjectFile, Names.extNodeData);
NodeTable nodeTable = new NodeTableNative(idx, objectFile);
nodeTable = NodeTableCache.create(nodeTable, params.getNode2NodeIdCacheSize(), params.getNodeId2NodeCacheSize(), params.getNodeMissCacheSize());
nodeTable = NodeTableInline.create(nodeTable);
return nodeTable;
}
use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.
the class DatasetBuilderStd method makePrefixTable.
protected DatasetPrefixesTDB makePrefixTable(Location location, DatasetControl policy, StoreParams params) {
String primary = params.getPrimaryIndexPrefix();
String[] indexes = params.getPrefixIndexes();
TupleIndex[] prefixIndexes = makeTupleIndexes(location, primary, indexes, new String[] { params.getIndexPrefix() }, params);
if (prefixIndexes.length != 1)
error(log, "Wrong number of prefix table tuples indexes: " + prefixIndexes.length);
String pnNode2Id = params.getPrefixNode2Id();
String pnId2Node = params.getPrefixId2Node();
// No cache - the prefix mapping is a cache
NodeTable prefixNodes = makeNodeTableNoCache(location, pnNode2Id, pnId2Node, params);
NodeTupleTable prefixTable = new NodeTupleTableConcrete(primary.length(), prefixIndexes, prefixNodes, policy);
DatasetPrefixesTDB prefixes = new DatasetPrefixesTDB(prefixTable);
return prefixes;
}
use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.
the class SolverRX method matchQuadPattern.
// Entry point from SolverLib.
/*package*/
static Iterator<BindingNodeId> matchQuadPattern(Iterator<BindingNodeId> chain, Node graphNode, Triple tPattern, NodeTupleTable nodeTupleTable, Tuple<Node> patternTuple, boolean anyGraph, Predicate<Tuple<NodeId>> filter, ExecutionContext execCxt) {
if (DATAPATH) {
if (!tripleHasEmbTripleWithVars(tPattern))
// No RDF-star <<>> with variables.
return StageMatchTuple.access(nodeTupleTable, chain, patternTuple, filter, anyGraph, execCxt);
}
// RDF-star <<>> with variables.
// This path should work regardless.
boolean isTriple = (patternTuple.len() == 3);
NodeTable nodeTable = nodeTupleTable.getNodeTable();
Function<BindingNodeId, Iterator<BindingNodeId>> step = bnid -> find(bnid, nodeTupleTable, graphNode, tPattern, anyGraph, filter, execCxt);
return Iter.flatMap(chain, step);
}
Aggregations