Search in sources :

Example 1 with ExtractWalkEntities

use of uk.gov.gchq.gaffer.data.graph.function.walk.ExtractWalkEntities in project gaffer-doc by gchq.

the class ExtractWalkEntitiesExample method extractEntitiesFromWalk.

public void extractEntitiesFromWalk() {
    // ---------------------------------------------------------
    final ExtractWalkEntities function = new ExtractWalkEntities();
    // ---------------------------------------------------------
    runExample(function, null, new Walk.Builder().entity(new Entity.Builder().group("BasicEntity").vertex("A").build()).edge(new Edge.Builder().group("BasicEdge").source("A").dest("B").directed(true).build()).entity(new Entity.Builder().group("BasicEntity").vertex("B").build()).entity(new Entity.Builder().group("EnhancedEntity").vertex("B").build()).edge(new Edge.Builder().group("BasicEdge").source("B").dest("C").directed(true).build()).entity(new Entity.Builder().group("BasicEntity").vertex("C").build()).edge(new Edge.Builder().group("BasicEdge").source("C").dest("A").directed(true).build()).entity(new Entity.Builder().group("BasicEntity").vertex("A").build()).build());
}
Also used : Entity(uk.gov.gchq.gaffer.data.element.Entity) ExtractWalkEntities(uk.gov.gchq.gaffer.data.graph.function.walk.ExtractWalkEntities) Edge(uk.gov.gchq.gaffer.data.element.Edge)

Example 2 with ExtractWalkEntities

use of uk.gov.gchq.gaffer.data.graph.function.walk.ExtractWalkEntities 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 3 with ExtractWalkEntities

use of uk.gov.gchq.gaffer.data.graph.function.walk.ExtractWalkEntities in project Gaffer by gchq.

the class GetWalksIT method getWalksThatPassPredicateTest.

private Iterable<Walk> getWalksThatPassPredicateTest(final Predicate predicate) 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());
    conditional.setPredicate(predicate);
    return executeGetWalksApplyingConditional(conditional);
}
Also used : 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)

Aggregations

ExtractWalkEntities (uk.gov.gchq.gaffer.data.graph.function.walk.ExtractWalkEntities)3 HashMap (java.util.HashMap)2 ExtractProperty (uk.gov.gchq.gaffer.data.element.function.ExtractProperty)2 ForEach (uk.gov.gchq.gaffer.operation.impl.ForEach)2 Builder (uk.gov.gchq.gaffer.operation.impl.GetWalks.Builder)2 Map (uk.gov.gchq.gaffer.operation.impl.Map)2 Conditional (uk.gov.gchq.gaffer.operation.util.Conditional)2 IterableConcat (uk.gov.gchq.koryphe.impl.function.IterableConcat)2 Test (org.junit.Test)1 Edge (uk.gov.gchq.gaffer.data.element.Edge)1 Entity (uk.gov.gchq.gaffer.data.element.Entity)1 Walk (uk.gov.gchq.gaffer.data.graph.Walk)1