use of uk.gov.gchq.koryphe.impl.predicate.Exists in project gaffer-doc by gchq.
the class ExistsExample method exists.
public void exists() {
// ---------------------------------------------------------
final Exists function = new Exists();
// ---------------------------------------------------------
runExample(function, null, 1, null, "", "abc");
}
use of uk.gov.gchq.koryphe.impl.predicate.Exists in project gaffer-doc by gchq.
the class PredicateMapExample method mapWithDateKeyHasAValueThatExists.
public void mapWithDateKeyHasAValueThatExists() {
// ---------------------------------------------------------
final PredicateMap function = new PredicateMap(new Date(0L), new Exists());
// ---------------------------------------------------------
final Map<Date, Long> map1 = new HashMap<>();
map1.put(new Date(0L), 1L);
final Map<Date, Long> map2 = new HashMap<>();
map2.put(new Date(), 2L);
runExample(function, null, map1, map2);
}
use of uk.gov.gchq.koryphe.impl.predicate.Exists in project Gaffer by gchq.
the class SchemaElementDefinitionTest method setupSchema.
protected void setupSchema(final T elementDef) {
final Schema.Builder schemaBuilder = new Schema.Builder().type("id.integer", Integer.class).type("id.date", Date.class).type("directed.true", Boolean.class).type("property.integer", Integer.class).type("property.object", Object.class).type(PROPERTY_STRING_TYPE, new TypeDefinition.Builder().clazz(String.class).aggregateFunction(new ExampleAggregateFunction()).validateFunctions(new Exists()).build()).visibilityProperty("visibility");
if (elementDef instanceof SchemaEdgeDefinition) {
schemaBuilder.edge(TestGroups.EDGE, (SchemaEdgeDefinition) elementDef);
} else {
schemaBuilder.entity(TestGroups.ENTITY, (SchemaEntityDefinition) elementDef);
}
schemaBuilder.build();
}
use of uk.gov.gchq.koryphe.impl.predicate.Exists in project Gaffer by gchq.
the class SchemaTest method shouldReturnTrueWhenSchemaHasValidatorEntityFilters.
@Test
public void shouldReturnTrueWhenSchemaHasValidatorEntityFilters() {
// Given
final Schema schema = new Schema.Builder().entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().validator(new ElementFilter.Builder().select(TestPropertyNames.PROP_1).execute(new Exists()).build()).build()).edge(TestGroups.EDGE, new SchemaEdgeDefinition()).build();
// When
final boolean result = schema.hasValidation();
// Then
assertTrue(result);
}
use of uk.gov.gchq.koryphe.impl.predicate.Exists in project Gaffer by gchq.
the class SchemaTest method shouldReturnTrueWhenSchemaHasValidatorEntityIdentifierFilters.
@Test
public void shouldReturnTrueWhenSchemaHasValidatorEntityIdentifierFilters() {
// Given
final Schema schema = new Schema.Builder().entity(TestGroups.ENTITY, new SchemaEntityDefinition.Builder().vertex("str").build()).type("str", new TypeDefinition.Builder().validateFunctions(new Exists()).build()).edge(TestGroups.EDGE, new SchemaEdgeDefinition()).build();
// When
final boolean result = schema.hasValidation();
// Then
assertTrue(result);
}
Aggregations