Search in sources :

Example 26 with Walk

use of uk.gov.gchq.gaffer.data.graph.Walk in project Gaffer by gchq.

the class GetWalksIT method shouldFilterWalksThatDoNotContainProperty5.

@Test
public void shouldFilterWalksThatDoNotContainProperty5() throws Exception {
    final Iterable<Walk> walks = getWalksThatPassPredicateTest(new CollectionContains(5));
    assertThat(getPaths(walks)).isEqualTo("AED");
}
Also used : Walk(uk.gov.gchq.gaffer.data.graph.Walk) CollectionContains(uk.gov.gchq.koryphe.impl.predicate.CollectionContains) Test(org.junit.Test)

Example 27 with Walk

use of uk.gov.gchq.gaffer.data.graph.Walk in project Gaffer by gchq.

the class GetWalksIT method shouldNotFilterWalksWhenNoPredicateSupplied.

@Test
public void shouldNotFilterWalksWhenNoPredicateSupplied() throws Exception {
    final Conditional conditional = new Conditional();
    conditional.setTransform(new OperationChain.Builder().first(new Map.Builder<>().first(new ExtractWalkEntities()).then(new IterableConcat()).build()).then(new ForEach.Builder<>().operation(new Map.Builder<>().first(new ExtractProperty(TestPropertyNames.PROP_1)).build()).build()).build());
    final Iterable<Walk> walks = executeGetWalksApplyingConditional(conditional);
    assertThat(getPaths(walks)).isEqualTo("AED,ABC");
}
Also used : Walk(uk.gov.gchq.gaffer.data.graph.Walk) ExtractWalkEntities(uk.gov.gchq.gaffer.data.graph.function.walk.ExtractWalkEntities) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) Conditional(uk.gov.gchq.gaffer.operation.util.Conditional) ExtractProperty(uk.gov.gchq.gaffer.data.element.function.ExtractProperty) IterableConcat(uk.gov.gchq.koryphe.impl.function.IterableConcat) HashMap(java.util.HashMap) Map(uk.gov.gchq.gaffer.operation.impl.Map) ForEach(uk.gov.gchq.gaffer.operation.impl.ForEach) Test(org.junit.Test)

Example 28 with Walk

use of uk.gov.gchq.gaffer.data.graph.Walk 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();
}
Also used : Walk(uk.gov.gchq.gaffer.data.graph.Walk) GetWalks(uk.gov.gchq.gaffer.operation.impl.GetWalks) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) ViewElementDefinition(uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition) View(uk.gov.gchq.gaffer.data.elementdefinition.view.View) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) IsMoreThan(uk.gov.gchq.koryphe.impl.predicate.IsMoreThan) Test(org.junit.Test)

Example 29 with Walk

use of uk.gov.gchq.gaffer.data.graph.Walk 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");
}
Also used : Walk(uk.gov.gchq.gaffer.data.graph.Walk) GetWalks(uk.gov.gchq.gaffer.operation.impl.GetWalks) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) Builder(uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder) GetElements(uk.gov.gchq.gaffer.operation.impl.get.GetElements) ViewElementDefinition(uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition) Test(org.junit.Test)

Example 30 with Walk

use of uk.gov.gchq.gaffer.data.graph.Walk in project Gaffer by gchq.

the class GetWalksIT method shouldFilterWalksThatDoNotContainProperty2.

@Test
public void shouldFilterWalksThatDoNotContainProperty2() throws Exception {
    final Iterable<Walk> walks = getWalksThatPassPredicateTest(new CollectionContains(2));
    assertThat(getPaths(walks)).isEqualTo("ABC");
}
Also used : Walk(uk.gov.gchq.gaffer.data.graph.Walk) CollectionContains(uk.gov.gchq.koryphe.impl.predicate.CollectionContains) Test(org.junit.Test)

Aggregations

Walk (uk.gov.gchq.gaffer.data.graph.Walk)36 Test (org.junit.Test)25 GetWalks (uk.gov.gchq.gaffer.operation.impl.GetWalks)19 Builder (uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder)19 GetElements (uk.gov.gchq.gaffer.operation.impl.get.GetElements)19 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)17 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)13 Test (org.junit.jupiter.api.Test)7 Set (java.util.Set)6 Conditional (uk.gov.gchq.gaffer.operation.util.Conditional)5 CollectionContains (uk.gov.gchq.koryphe.impl.predicate.CollectionContains)5 IsMoreThan (uk.gov.gchq.koryphe.impl.predicate.IsMoreThan)5 HashMap (java.util.HashMap)4 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)4 Map (uk.gov.gchq.gaffer.operation.impl.Map)4 Edge (uk.gov.gchq.gaffer.data.element.Edge)3 Entity (uk.gov.gchq.gaffer.data.element.Entity)3 TraitRequirement (uk.gov.gchq.gaffer.integration.TraitRequirement)3 OperationException (uk.gov.gchq.gaffer.operation.OperationException)3 List (java.util.List)2