Search in sources :

Example 11 with NodeTable

use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.

the class DatasetBuilderStd method makeNodeTable$.

/**
 * Make a node table overriding the node->id and id->node table names
 */
private NodeTable makeNodeTable$(Location location, String indexNode2Id, String indexId2Node, StoreParams params) {
    FileSet fsNodeToId = new FileSet(location, indexNode2Id);
    FileSet fsId2Node = new FileSet(location, indexId2Node);
    NodeTable nt = /*nodeTableBuilder.*/
    buildNodeTable(fsNodeToId, fsId2Node, params);
    return nt;
}
Also used : FileSet(org.apache.jena.tdb.base.file.FileSet) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable)

Example 12 with NodeTable

use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.

the class TDBInternal method getNode.

/**
 * Return the node for a NodeId (if any). Returns null if the NodeId does
 * not exist in the dataset.
 */
public static Node getNode(DatasetGraphTDB dsg, NodeId nodeId) {
    if (dsg == null)
        return null;
    NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable();
    Node node = nodeTable.getNodeForNodeId(nodeId);
    return node;
}
Also used : Node(org.apache.jena.graph.Node) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable)

Example 13 with NodeTable

use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.

the class DebugTDB method dumpNodeTable.

public static void dumpNodeTable(String label, DatasetGraphTDB dsg) {
    NodeTable nt1 = dsg.getTripleTable().getNodeTupleTable().getNodeTable();
    NodeTableLib.print(label, nt1);
}
Also used : NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable)

Example 14 with NodeTable

use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.

the class DebugTDB method lookup.

public static NodeId lookup(DatasetGraphTDB dsg, Node n) {
    NodeTable nt = dsg.getTripleTable().getNodeTupleTable().getNodeTable();
    NodeId nid = nt.getNodeIdForNode(n);
    return nid;
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable)

Example 15 with NodeTable

use of org.apache.jena.tdb.store.nodetable.NodeTable in project jena by apache.

the class TestQuadFilter method createFilter.

/**
 * Create a filter to exclude the graph http://example/g2
 */
private static Predicate<Tuple<NodeId>> createFilter(Dataset dataset) {
    return Txn.calculateRead(dataset, () -> {
        DatasetGraphTDB dsg = TDBInternal.getDatasetGraphTDB(dataset);
        final NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable();
        final NodeId target = nodeTable.getNodeIdForNode(NodeFactory.createURI(graphToHide));
        // Check g slot. Exclude graphToHide
        return item -> !(item.len() == 4 && item.get(0).equals(target));
    });
}
Also used : TDBInternal(org.apache.jena.tdb.sys.TDBInternal) NodeFactory(org.apache.jena.graph.NodeFactory) org.apache.jena.query(org.apache.jena.query) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Assert.assertNotNull(org.junit.Assert.assertNotNull) Predicate(java.util.function.Predicate) Test(org.junit.Test) SystemTDB(org.apache.jena.tdb.sys.SystemTDB) SSE(org.apache.jena.sparql.sse.SSE) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable) Txn(org.apache.jena.system.Txn) Quad(org.apache.jena.sparql.core.Quad) TDBFactory(org.apache.jena.tdb.TDBFactory) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) Assert.assertEquals(org.junit.Assert.assertEquals) TDB(org.apache.jena.tdb.TDB) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable)

Aggregations

NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)27 NodeId (org.apache.jena.tdb.store.NodeId)12 Node (org.apache.jena.graph.Node)8 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)5 NodeTupleTable (org.apache.jena.tdb.store.nodetupletable.NodeTupleTable)5 Triple (org.apache.jena.graph.Triple)4 Quad (org.apache.jena.sparql.core.Quad)4 Binding (org.apache.jena.sparql.engine.binding.Binding)4 Predicate (java.util.function.Predicate)3 BaseTest (org.apache.jena.atlas.junit.BaseTest)3 TDBException (org.apache.jena.tdb.TDBException)3 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)3 NodeTableTrans (org.apache.jena.tdb.transaction.NodeTableTrans)3 Transaction (org.apache.jena.tdb.transaction.Transaction)3 Test (org.junit.Test)3 Iterator (java.util.Iterator)2 Function (java.util.function.Function)2 Iter (org.apache.jena.atlas.iterator.Iter)2 InternalErrorException (org.apache.jena.atlas.lib.InternalErrorException)2 TupleFactory (org.apache.jena.atlas.lib.tuple.TupleFactory)2