Search in sources :

Example 1 with StatsCollectorNodeId

use of org.apache.jena.tdb.solver.stats.StatsCollectorNodeId in project jena by apache.

the class tdbstats method stats.

public static StatsResults stats(DatasetGraphTDB dsg, Node gn) {
    NodeTable nt = dsg.getTripleTable().getNodeTupleTable().getNodeTable();
    StatsCollectorNodeId stats = new StatsCollectorNodeId(nt);
    if (gn == null) {
        Iterator<Tuple<NodeId>> iter = dsg.getTripleTable().getNodeTupleTable().findAll();
        for (; iter.hasNext(); ) {
            Tuple<NodeId> t = iter.next();
            stats.record(null, t.get(0), t.get(1), t.get(2));
        }
    } else {
        // If the union graph, then we need to scan all quads but with uniqueness.
        boolean unionGraph = Quad.isUnionGraph(gn);
        NodeId gnid = null;
        if (!unionGraph) {
            gnid = nt.getNodeIdForNode(gn);
            if (NodeId.isDoesNotExist(gnid))
                Log.warn(tdbstats.class, "No such graph: " + gn);
        }
        NodeTupleTable ntt = dsg.getQuadTable().getNodeTupleTable();
        Iterator<Tuple<NodeId>> iter = unionGraph ? SolverLib.unionGraph(ntt) : ntt.find(gnid, null, null, null);
        for (; iter.hasNext(); ) {
            Tuple<NodeId> t = iter.next();
            stats.record(t.get(0), t.get(1), t.get(2), t.get(3));
        }
    }
    return stats.results();
}
Also used : NodeTupleTable(org.apache.jena.tdb.store.nodetupletable.NodeTupleTable) NodeId(org.apache.jena.tdb.store.NodeId) StatsCollectorNodeId(org.apache.jena.tdb.solver.stats.StatsCollectorNodeId) NodeTable(org.apache.jena.tdb.store.nodetable.NodeTable) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) StatsCollectorNodeId(org.apache.jena.tdb.solver.stats.StatsCollectorNodeId)

Example 2 with StatsCollectorNodeId

use of org.apache.jena.tdb.solver.stats.StatsCollectorNodeId in project jena by apache.

the class TestStats method statsForGraph.

private StatsResults statsForGraph(NodeId gid) {
    Iterator<Tuple<NodeId>> iter = quads.find(gid, null, null, null);
    StatsCollectorNodeId stats = new StatsCollectorNodeId(nt);
    for (; iter.hasNext(); ) {
        Tuple<NodeId> t = iter.next();
        stats.record(t.get(0), t.get(1), t.get(2), t.get(3));
    }
    return stats.results();
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) StatsCollectorNodeId(org.apache.jena.tdb.solver.stats.StatsCollectorNodeId) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) StatsCollectorNodeId(org.apache.jena.tdb.solver.stats.StatsCollectorNodeId)

Example 3 with StatsCollectorNodeId

use of org.apache.jena.tdb.solver.stats.StatsCollectorNodeId in project jena by apache.

the class TestStats method statsForDftGraph.

private StatsResults statsForDftGraph() {
    Iterator<Tuple<NodeId>> iter = triples.findAll();
    StatsCollectorNodeId stats = new StatsCollectorNodeId(nt);
    for (; iter.hasNext(); ) {
        Tuple<NodeId> t = iter.next();
        stats.record(null, t.get(0), t.get(1), t.get(2));
    }
    return stats.results();
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) StatsCollectorNodeId(org.apache.jena.tdb.solver.stats.StatsCollectorNodeId) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) StatsCollectorNodeId(org.apache.jena.tdb.solver.stats.StatsCollectorNodeId)

Aggregations

Tuple (org.apache.jena.atlas.lib.tuple.Tuple)3 StatsCollectorNodeId (org.apache.jena.tdb.solver.stats.StatsCollectorNodeId)3 NodeId (org.apache.jena.tdb.store.NodeId)3 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)1 NodeTupleTable (org.apache.jena.tdb.store.nodetupletable.NodeTupleTable)1