Search in sources :

Example 1 with Exists

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");
}
Also used : Exists(uk.gov.gchq.koryphe.impl.predicate.Exists)

Example 2 with Exists

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);
}
Also used : HashMap(java.util.HashMap) Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) PredicateMap(uk.gov.gchq.koryphe.predicate.PredicateMap) Date(java.util.Date)

Example 3 with Exists

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();
}
Also used : Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) ExampleAggregateFunction(uk.gov.gchq.gaffer.function.ExampleAggregateFunction) Date(java.util.Date)

Example 4 with Exists

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);
}
Also used : Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) Test(org.junit.jupiter.api.Test)

Example 5 with Exists

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);
}
Also used : Exists(uk.gov.gchq.koryphe.impl.predicate.Exists) Test(org.junit.jupiter.api.Test)

Aggregations

Exists (uk.gov.gchq.koryphe.impl.predicate.Exists)38 Test (org.junit.jupiter.api.Test)31 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)12 JSONSerialisationTest (uk.gov.gchq.gaffer.JSONSerialisationTest)9 Schema (uk.gov.gchq.gaffer.store.schema.Schema)9 AccumuloStore (uk.gov.gchq.gaffer.accumulostore.AccumuloStore)8 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)6 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)6 HashMap (java.util.HashMap)5 Map (java.util.Map)3 MiniAccumuloStore (uk.gov.gchq.gaffer.accumulostore.MiniAccumuloStore)3 SingleUseMiniAccumuloStore (uk.gov.gchq.gaffer.accumulostore.SingleUseMiniAccumuloStore)3 AccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter)3 AccumuloKeyPackage (uk.gov.gchq.gaffer.accumulostore.key.AccumuloKeyPackage)3 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)3 ExampleFilterFunction (uk.gov.gchq.gaffer.function.ExampleFilterFunction)3 Operation (uk.gov.gchq.gaffer.operation.Operation)3 StringConcat (uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat)3 Date (java.util.Date)2 List (java.util.List)2