Search in sources :

Example 1 with GraphStatisticsHandler

use of org.apache.jena.graph.GraphStatisticsHandler in project jena by apache.

the class GraphMem_CS method testHasStatistics.

@ContractTest
public void testHasStatistics() {
    GraphStatisticsHandler h = graphProducer.newInstance().getStatisticsHandler();
    assertNotNull(h);
}
Also used : GraphStatisticsHandler(org.apache.jena.graph.GraphStatisticsHandler) ContractTest(org.xenei.junit.contract.ContractTest)

Example 2 with GraphStatisticsHandler

use of org.apache.jena.graph.GraphStatisticsHandler in project jena by apache.

the class UnionTest method testUnion.

/**
	 * Asserts that the statistic obtained by probing the three-element union
	 * with statistics <code>av</code>, <code>bv</code>, and <code>cv</code> is
	 * <code>expected</code>.
	 */
private void testUnion(int expected, int av, int bv, int cv) {
    AnInteger a = new AnInteger(av), b = new AnInteger(bv), c = new AnInteger(cv);
    Graph g1 = graphWithGivenStatistic(a);
    Graph g2 = graphWithGivenStatistic(b);
    Graph g3 = graphWithGivenStatistic(c);
    Graph[] graphs = new Graph[] { g1, g2, g3 };
    MultiUnion mu = new MultiUnion(graphs);
    GraphStatisticsHandler gs = new MultiUnion.MultiUnionStatisticsHandler(mu);
    assertEquals(expected, gs.getStatistic(Node.ANY, Node.ANY, Node.ANY));
}
Also used : Graph(org.apache.jena.graph.Graph) GraphStatisticsHandler(org.apache.jena.graph.GraphStatisticsHandler)

Example 3 with GraphStatisticsHandler

use of org.apache.jena.graph.GraphStatisticsHandler in project jena by apache.

the class TestMultiUnion method testMultiUnionHasMultiUnionStatisticsHandler.

/**
        A MultiUnion graph should have a MultiUnionStatisticsHandler, and that
        handler should point right back to that graph.
    */
public void testMultiUnionHasMultiUnionStatisticsHandler() {
    MultiUnion mu = new MultiUnion();
    GraphStatisticsHandler sh = mu.getStatisticsHandler();
    assertInstanceOf(MultiUnionStatisticsHandler.class, sh);
    assertSame(mu, ((MultiUnionStatisticsHandler) sh).getUnion());
}
Also used : GraphStatisticsHandler(org.apache.jena.graph.GraphStatisticsHandler) MultiUnion(org.apache.jena.graph.compose.MultiUnion)

Aggregations

GraphStatisticsHandler (org.apache.jena.graph.GraphStatisticsHandler)3 Graph (org.apache.jena.graph.Graph)1 MultiUnion (org.apache.jena.graph.compose.MultiUnion)1 ContractTest (org.xenei.junit.contract.ContractTest)1