Search in sources :

Example 16 with DirectedType

use of uk.gov.gchq.gaffer.data.element.id.DirectedType in project Gaffer by gchq.

the class ClassicIteratorSettingsFactory method getEdgeEntityDirectionFilterIteratorSetting.

@Override
public IteratorSetting getEdgeEntityDirectionFilterIteratorSetting(final GraphFilters operation) {
    final boolean includeEntities = operation.getView().hasEntities();
    final boolean includeEdges = operation.getView().hasEdges();
    final DirectedType directedType = operation.getDirectedType();
    final IncludeIncomingOutgoingType inOutType;
    if (operation instanceof SeededGraphFilters) {
        inOutType = ((SeededGraphFilters) operation).getIncludeIncomingOutGoing();
    } else {
        inOutType = IncludeIncomingOutgoingType.OUTGOING;
    }
    final boolean deduplicateUndirectedEdges = operation instanceof GetAllElements;
    if ((null == inOutType || inOutType == IncludeIncomingOutgoingType.EITHER) && includeEdges && (DirectedType.isEither(directedType)) && !deduplicateUndirectedEdges) {
        LOGGER.debug("Returning null from getEdgeEntityDirectionFilterIteratorSetting (" + "inOutType = {}, includeEdges = {}, directedType = {}, deduplicateUndirectedEdges = {})", inOutType, includeEdges, directedType, deduplicateUndirectedEdges);
        return null;
    }
    final IteratorSetting is = new IteratorSettingBuilder(AccumuloStoreConstants.EDGE_ENTITY_DIRECTED_UNDIRECTED_INCOMING_OUTGOING_FILTER_ITERATOR_PRIORITY, AccumuloStoreConstants.EDGE_ENTITY_DIRECTED_UNDIRECTED_INCOMING_OUTGOING_FILTER_ITERATOR_NAME, EDGE_DIRECTED_UNDIRECTED_FILTER).includeIncomingOutgoing(inOutType).directedType(directedType).includeEdges(includeEdges).includeEntities(includeEntities).deduplicateUndirectedEdges(deduplicateUndirectedEdges).build();
    LOGGER.debug("Creating IteratorSetting for iterator class {} with " + "priority = {}, includeIncomingOutgoing = {}, directedType = {}, " + "includeEdges = {}, includeEntities = {}, deduplicateUndirectedEdges = {}", EDGE_DIRECTED_UNDIRECTED_FILTER, AccumuloStoreConstants.EDGE_ENTITY_DIRECTED_UNDIRECTED_INCOMING_OUTGOING_FILTER_ITERATOR_PRIORITY, inOutType, directedType, includeEdges, includeEntities, deduplicateUndirectedEdges);
    return is;
}
Also used : IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) IncludeIncomingOutgoingType(uk.gov.gchq.gaffer.operation.graph.SeededGraphFilters.IncludeIncomingOutgoingType) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements) DirectedType(uk.gov.gchq.gaffer.data.element.id.DirectedType) SeededGraphFilters(uk.gov.gchq.gaffer.operation.graph.SeededGraphFilters) IteratorSettingBuilder(uk.gov.gchq.gaffer.accumulostore.utils.IteratorSettingBuilder)

Aggregations

DirectedType (uk.gov.gchq.gaffer.data.element.id.DirectedType)16 View (uk.gov.gchq.gaffer.data.elementdefinition.view.View)7 IncludeIncomingOutgoingType (uk.gov.gchq.gaffer.operation.graph.SeededGraphFilters.IncludeIncomingOutgoingType)7 ArrayList (java.util.ArrayList)6 Edge (uk.gov.gchq.gaffer.data.element.Edge)5 Entity (uk.gov.gchq.gaffer.data.element.Entity)5 EntityId (uk.gov.gchq.gaffer.data.element.id.EntityId)5 ViewElementDefinition (uk.gov.gchq.gaffer.data.elementdefinition.view.ViewElementDefinition)5 SeededGraphFilters (uk.gov.gchq.gaffer.operation.graph.SeededGraphFilters)5 HashSet (java.util.HashSet)4 List (java.util.List)4 Set (java.util.Set)4 Test (org.junit.Test)4 TestGroups (uk.gov.gchq.gaffer.commonutil.TestGroups)4 CloseableIterable (uk.gov.gchq.gaffer.commonutil.iterable.CloseableIterable)4 Element (uk.gov.gchq.gaffer.data.element.Element)4 ElementFilter (uk.gov.gchq.gaffer.data.element.function.ElementFilter)4 SeedMatching (uk.gov.gchq.gaffer.operation.SeedMatching)4 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)4 Collectors (java.util.stream.Collectors)3