Search in sources :

Example 11 with NodeId

use of org.apache.jena.tdb.store.NodeId in project jena by apache.

the class NodeTableLib method print.

public static void print(String label, NodeTable nodeTable) {
    if (label != null)
        System.out.println(label);
    Iterator<Pair<NodeId, Node>> iter = nodeTable.all();
    for (; iter.hasNext(); ) {
        Pair<NodeId, Node> x = iter.next();
        NodeId nodeId = x.getLeft();
        Node node = x.getRight();
        System.out.println(nodeId + " " + node);
    }
}
Also used : Node(org.apache.jena.graph.Node) NodeId(org.apache.jena.tdb.store.NodeId) Pair(org.apache.jena.atlas.lib.Pair)

Example 12 with NodeId

use of org.apache.jena.tdb.store.NodeId in project jena by apache.

the class NodeTableLogger method getAllocateNodeId.

@Override
public NodeId getAllocateNodeId(Node node) {
    //info("getAllocateNodeId("+node+") =>") ;
    NodeId nId = nodeTable.getAllocateNodeId(node);
    info("getAllocateNodeId(" + node + ") => " + nId);
    return nId;
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId)

Example 13 with NodeId

use of org.apache.jena.tdb.store.NodeId in project jena by apache.

the class NodeTableLogger method allocOffset.

@Override
public NodeId allocOffset() {
    NodeId nodeId = nodeTable.allocOffset();
    info("allocOffset() => " + nodeId);
    return nodeId;
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId)

Example 14 with NodeId

use of org.apache.jena.tdb.store.NodeId in project jena by apache.

the class BindingNodeId method putAll.

public void putAll(BindingNodeId other) {
    Iterator<Var> vIter = other.iterator();
    for (; vIter.hasNext(); ) {
        Var v = vIter.next();
        if (v == null)
            throw new IllegalArgumentException("Null key");
        NodeId n = other.get(v);
        if (n == null)
            throw new IllegalArgumentException("(" + v + "," + n + ")");
        super.put(v, n);
    }
}
Also used : Var(org.apache.jena.sparql.core.Var) NodeId(org.apache.jena.tdb.store.NodeId)

Example 15 with NodeId

use of org.apache.jena.tdb.store.NodeId in project jena by apache.

the class BindingTDB method get1.

@Override
public Node get1(Var var) {
    try {
        Node n = cacheGet(var);
        if (n != null)
            return n;
        NodeId id = idBinding.get(var);
        if (id == null)
            return null;
        n = nodeTable.getNodeForNodeId(id);
        // Update cache.
        cachePut(var, n);
        return n;
    } catch (Exception ex) {
        Log.error(this, String.format("get1(%s)", var), ex);
        return null;
    }
}
Also used : Node(org.apache.jena.graph.Node) NodeId(org.apache.jena.tdb.store.NodeId)

Aggregations

NodeId (org.apache.jena.tdb.store.NodeId)76 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)29 BaseTest (org.apache.jena.atlas.junit.BaseTest)28 Test (org.junit.Test)28 TupleIndex (org.apache.jena.tdb.store.tupletable.TupleIndex)20 Node (org.apache.jena.graph.Node)18 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)10 Pair (org.apache.jena.atlas.lib.Pair)5 Var (org.apache.jena.sparql.core.Var)5 TDBException (org.apache.jena.tdb.TDBException)5 Record (org.apache.jena.tdb.base.record.Record)5 StatsCollectorNodeId (org.apache.jena.tdb.solver.stats.StatsCollectorNodeId)5 NodeTableTrans (org.apache.jena.tdb.transaction.NodeTableTrans)5 Transaction (org.apache.jena.tdb.transaction.Transaction)5 Predicate (java.util.function.Predicate)2 Location (org.apache.jena.tdb.base.file.Location)2 RangeIndex (org.apache.jena.tdb.index.RangeIndex)2 StatsResults (org.apache.jena.tdb.solver.stats.StatsResults)2 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)2 Hash (org.apache.jena.tdb.store.Hash)2