use of uk.gov.gchq.koryphe.impl.function.Concat in project gaffer-doc by gchq.
the class GetElementsExample method getEntitiesAndExcludeProperties.
public CloseableIterable<? extends Element> getEntitiesAndExcludeProperties() {
// ---------------------------------------------------------
final Concat concat = new Concat();
concat.setSeparator("|");
final GetElements operation = new GetElements.Builder().input(new EntitySeed(2)).view(new View.Builder().edge("edge", new ViewElementDefinition.Builder().transientProperty("vertex|count", String.class).excludeProperties("count").transformer(new ElementTransformer.Builder().select(IdentifierType.SOURCE.name(), "count").execute(concat).project("vertex|count").build()).build()).build()).build();
return runExample(operation, null);
}
use of uk.gov.gchq.koryphe.impl.function.Concat in project Gaffer by gchq.
the class TransformationIT method shouldCreateTransientEntityProperty.
@Test
@TraitRequirement(StoreTrait.TRANSFORMATION)
public void shouldCreateTransientEntityProperty() throws OperationException {
// Given
final GetElements getEntities = new GetElements.Builder().input(new EntitySeed("A1")).view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().transientProperty(TestPropertyNames.TRANSIENT_1, String.class).transformer(new ElementTransformer.Builder().select(IdentifierType.VERTEX.name(), TestPropertyNames.SET).execute(new Concat()).project(TestPropertyNames.TRANSIENT_1).build()).build()).build()).build();
// When
final List<Element> results = Lists.newArrayList(graph.execute(getEntities, getUser()));
assertThat(results).hasSize(1);
for (final Element result : results) {
assertThat(result.getProperty(TestPropertyNames.TRANSIENT_1)).isEqualTo("A1,[3]");
}
}
use of uk.gov.gchq.koryphe.impl.function.Concat in project Gaffer by gchq.
the class TransformationIT method shouldTransformVertex.
@Test
@TraitRequirement(StoreTrait.TRANSFORMATION)
public void shouldTransformVertex() throws OperationException {
// Given
final GetElements getEntities = new GetElements.Builder().input(new EntitySeed("A1")).view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().transformer(new ElementTransformer.Builder().select(IdentifierType.VERTEX.name(), TestPropertyNames.SET).execute(new Concat()).project(IdentifierType.VERTEX.name()).build()).build()).build()).build();
// When
final List<Element> results = Lists.newArrayList(graph.execute(getEntities, getUser()));
assertThat(results).hasSize(1);
for (final Element result : results) {
assertThat(((Entity) result).getVertex()).isEqualTo("A1,[3]");
}
}
use of uk.gov.gchq.koryphe.impl.function.Concat in project Gaffer by gchq.
the class GetAllElementsIT method shouldGetAllTransformedFilteredElements.
@Test
@TraitRequirement({ StoreTrait.TRANSFORMATION, StoreTrait.PRE_AGGREGATION_FILTERING })
public void shouldGetAllTransformedFilteredElements() throws Exception {
final GetAllElements op = new GetAllElements.Builder().view(new View.Builder().entity(TestGroups.ENTITY, new ViewElementDefinition.Builder().preAggregationFilter(new ElementFilter.Builder().select(IdentifierType.VERTEX.name()).execute(new IsEqual("A1")).build()).transientProperty(TestPropertyNames.TRANSIENT_1, String.class).transformer(new ElementTransformer.Builder().select(IdentifierType.VERTEX.name(), TestPropertyNames.SET).execute(new Concat()).project(TestPropertyNames.TRANSIENT_1).build()).build()).build()).build();
// When
final CloseableIterable<? extends Element> results = graph.execute(op, getUser());
// Then
final List<Element> resultList = Lists.newArrayList(results);
assertThat(resultList).hasSize(1);
assertThat(resultList.get(0).getProperties()).containsEntry(TestPropertyNames.TRANSIENT_1, "A1,[3]");
}
Aggregations