Search in sources :

Example 6 with StatsResults

use of org.apache.jena.tdb2.solver.stats.StatsResults in project jena by apache.

the class TestStats method statsForDftGraph.

private StatsResults statsForDftGraph() {
    // StatsCollectorNodeId writes nodes for rdf:type (this is not good).
    return Txn.calculateWrite(dsg, () -> {
        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.tdb2.store.NodeId) StatsCollectorNodeId(org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) StatsCollectorNodeId(org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId)

Example 7 with StatsResults

use of org.apache.jena.tdb2.solver.stats.StatsResults in project jena by apache.

the class TestStats method statsForGraph.

private StatsResults statsForGraph(NodeId gid) {
    // StatsCollectorNodeId writes nodes for rdf:type (this is not good).
    return Txn.calculateWrite(dsg, () -> {
        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.tdb2.store.NodeId) StatsCollectorNodeId(org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) StatsCollectorNodeId(org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId)

Example 8 with StatsResults

use of org.apache.jena.tdb2.solver.stats.StatsResults in project jena by apache.

the class TestStats method stats_03.

@Test
public void stats_03() {
    NodeId gid = nt.getNodeIdForNode(NodeFactory.createURI("g2"));
    StatsResults r = statsForGraph(gid);
    assertEquals(2, r.getCount());
    assertEquals(1, r.getPredicates().keySet().size());
}
Also used : NodeId(org.apache.jena.tdb2.store.NodeId) StatsCollectorNodeId(org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId) StatsResults(org.apache.jena.tdb2.solver.stats.StatsResults) Test(org.junit.Test)

Aggregations

StatsCollectorNodeId (org.apache.jena.tdb2.solver.stats.StatsCollectorNodeId)5 StatsResults (org.apache.jena.tdb2.solver.stats.StatsResults)5 NodeId (org.apache.jena.tdb2.store.NodeId)5 Test (org.junit.Test)4 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)3 Node (org.apache.jena.graph.Node)1 DatasetGraphTDB (org.apache.jena.tdb2.store.DatasetGraphTDB)1 NodeTable (org.apache.jena.tdb2.store.nodetable.NodeTable)1 NodeTupleTable (org.apache.jena.tdb2.store.nodetupletable.NodeTupleTable)1