use of uk.gov.gchq.gaffer.operation.impl.GetWalks in project Gaffer by gchq.
the class GetWalksIT method shouldGetPartialPaths.
@Test
@TraitRequirement(StoreTrait.POST_AGGREGATION_FILTERING)
public void shouldGetPartialPaths() throws Exception {
// Given
final GetElements operation = new GetElements.Builder().directedType(DirectedType.DIRECTED).view(new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).build()).inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.OUTGOING).build();
final OperationChain operationChain = new OperationChain.Builder().first(new GetElements.Builder().view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().postAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.PROP_1).execute(new IsMoreThan(3)).build()).build()).build()).build()).then(operation).build();
final GetWalks op = new GetWalks.Builder().input(seedA).operations(operation, operationChain).includePartial().build();
// When
final Iterable<Walk> results = graph.execute(op, getUser());
// Then
assertThat(getPaths(results)).isEqualTo("AED,AB");
}
use of uk.gov.gchq.gaffer.operation.impl.GetWalks in project Gaffer by gchq.
the class GetWalksIT method shouldReturnNoResultsWhenNoEntityResults.
@Test
public void shouldReturnNoResultsWhenNoEntityResults() throws Exception {
// Given
final GetWalks op = new GetWalks.Builder().input(seedA).operations(new GetElements.Builder().view(new View.Builder().edge(TestGroups.EDGE).build()).build(), new OperationChain.Builder().first(new GetElements.Builder().view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(TestPropertyNames.INT).execute(new IsMoreThan(10000)).build()).build()).build()).build()).then(new GetElements()).build()).build();
// When
final Iterable<Walk> results = graph.execute(op, getUser());
// Then
assertThat(Lists.newArrayList(results)).isEmpty();
}
use of uk.gov.gchq.gaffer.operation.impl.GetWalks in project Gaffer by gchq.
the class GetWalksIT method shouldGetPathsWithMultipleSeedsAndMultipleEdgeTypes.
@Test
public void shouldGetPathsWithMultipleSeedsAndMultipleEdgeTypes() throws Exception {
// Given
final GetElements operation = new GetElements.Builder().directedType(DirectedType.DIRECTED).view(new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).edge(TestGroups.EDGE_2, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).build()).inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.OUTGOING).build();
final GetWalks op = new GetWalks.Builder().input(seedA, seedE).operations(operation, operation).build();
// When
final Iterable<Walk> results = graph.execute(op, getUser());
// Then
assertThat(getPaths(results)).isEqualTo("AED,AEF,ABC,EDA,EFC");
}
use of uk.gov.gchq.gaffer.operation.impl.GetWalks in project Gaffer by gchq.
the class AbstractExamplesFactoryTest method shouldProvideSchemaPopulatedGetWalksIfSchemaContainsEdges.
@Test
public void shouldProvideSchemaPopulatedGetWalksIfSchemaContainsEdges() throws InstantiationException, IllegalAccessException {
// Given
TestExamplesFactory examplesFactory = new TestExamplesFactory(SCHEMA);
// When
GetWalks operation = (GetWalks) examplesFactory.generateExample(GetWalks.class);
// Then
assertEquals(Lists.newArrayList(new EntitySeed("vertex1")), Lists.newArrayList(operation.getInput()));
assertEquals(Lists.newArrayList(new OperationChain.Builder().first(new GetElements.Builder().view(new View.Builder().edge("BasicEdge").build()).build()).build()), operation.getOperations());
}
use of uk.gov.gchq.gaffer.operation.impl.GetWalks in project Gaffer by gchq.
the class GetWalksIT method shouldGetPathsWithLoops.
@Test
public void shouldGetPathsWithLoops() throws Exception {
// Given
final GetElements operation = new GetElements.Builder().directedType(DirectedType.DIRECTED).view(new View.Builder().edge(TestGroups.EDGE, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).edge(TestGroups.EDGE_2, new ViewElementDefinition.Builder().properties(TestPropertyNames.COUNT).build()).build()).inOutType(SeededGraphFilters.IncludeIncomingOutgoingType.OUTGOING).build();
final GetWalks op = new GetWalks.Builder().input(seedA).operations(operation, operation, operation).build();
// When
final Iterable<Walk> results = graph.execute(op, getUser());
// Then
assertThat(getPaths(results)).isEqualTo("AEDA,AEFC");
}
Aggregations