Search in sources :

Example 11 with GetElementsBetweenSets

use of uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets in project Gaffer by gchq.

the class AccumuloIDBetweenSetsRetrieverTest method shouldStillApplyOtherFilter.

private void shouldStillApplyOtherFilter(final boolean loadIntoMemory, final AccumuloStore store) throws StoreException {
    // Query for all edges between the set {A0} and the set {A23}
    final AbstractAccumuloTwoSetSeededOperation<EntitySeed, Element> op = new GetElementsBetweenSets<>(AccumuloTestData.SEED_A0_SET, AccumuloTestData.SEED_A23_SET, defaultView);
    // Set graph to give us edges only
    op.setIncludeEdges(IncludeEdgeType.ALL);
    op.setIncludeEntities(false);
    final Set<Element> results = returnElementsFromOperation(store, op, new User(), loadIntoMemory);
    assertThat(results, IsCollectionContaining.hasItem(AccumuloTestData.EDGE_A0_A23));
    // Set graph to return entities only
    final AbstractAccumuloTwoSetSeededOperation<EntitySeed, Element> secondOp = new GetElementsBetweenSets<>(AccumuloTestData.SEED_A0_SET, AccumuloTestData.SEED_A23_SET, defaultView);
    secondOp.setIncludeEdges(IncludeEdgeType.NONE);
    secondOp.setIncludeEntities(true);
    // Query for all edges in set {A0, A23}, should get the entity for A0
    final Set<Element> secondResults = returnElementsFromOperation(store, secondOp, new User(), loadIntoMemory);
    assertThat(secondResults, IsCollectionContaining.hasItem(AccumuloTestData.A0_ENTITY));
    // Set graph to return both entities and edges again, and to only return summary type "X" (which will result
    // in no data).
    final View view = new View.Builder().edge("edgeX").entity("entityX").build();
    final AbstractAccumuloTwoSetSeededOperation<EntitySeed, Element> thirdOp = new GetElementsBetweenSets<>(AccumuloTestData.SEED_A0_SET, AccumuloTestData.SEED_A23_SET, view);
    thirdOp.setIncludeEdges(IncludeEdgeType.ALL);
    thirdOp.setIncludeEntities(true);
    final Set<Element> thirdResults = returnElementsFromOperation(store, thirdOp, new User(), loadIntoMemory);
    assertEquals(0, thirdResults.size());
}
Also used : User(uk.gov.gchq.gaffer.user.User) GetElementsBetweenSets(uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets) Element(uk.gov.gchq.gaffer.data.element.Element) EntitySeed(uk.gov.gchq.gaffer.operation.data.EntitySeed) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View)

Aggregations

GetElementsBetweenSets (uk.gov.gchq.gaffer.accumulostore.operation.impl.GetElementsBetweenSets)11 Element (uk.gov.gchq.gaffer.data.element.Element)11 EntitySeed (uk.gov.gchq.gaffer.operation.data.EntitySeed)7 User (uk.gov.gchq.gaffer.user.User)7 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)5 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)4 HashSet (java.util.HashSet)3 StoreException (uk.gov.gchq.gaffer.store.StoreException)2 BloomFilter (org.apache.hadoop.util.bloom.BloomFilter)1 Key (org.apache.hadoop.util.bloom.Key)1 Edge (uk.gov.gchq.gaffer.data.element.Edge)1