public Set<String> getEdgeGroups() { return gafferSchema.getEdgeGroups(); }
private Set<String> getGroupsThatHaveProperty(final String property) { final Set<String> groups = new HashSet<>(); for (final String entityGroup : schema.getEntityGroups()) { if (schema.getEntity(entityGroup).getProperties().contains(property)) { groups.add(entityGroup); } } for (final String edgeGroup : schema.getEdgeGroups()) { if (schema.getEdge(edgeGroup).getProperties().contains(property)) { groups.add(edgeGroup); } } return groups; }
private static View createValidView(final View view, final Schema delegateGraphSchema) { View newView = view; if (view.hasGroups()) { final Set<String> validEntities = new HashSet<>(view.getEntityGroups()); final Set<String> validEdges = new HashSet<>(view.getEdgeGroups()); validEntities.retainAll(delegateGraphSchema.getEntityGroups()); validEdges.retainAll(delegateGraphSchema.getEdgeGroups()); if (!validEntities.equals(view.getEntityGroups()) || !validEdges.equals(view.getEdgeGroups())) { // Need to make changes to the view so start by cloning the view // and clearing all the edges and entities final View.Builder viewBuilder = new View.Builder() .merge(view) .entities(Collections.emptyMap()) .edges(Collections.emptyMap()); validEntities.forEach(e -> viewBuilder.entity(e, view.getEntity(e))); validEdges.forEach(e -> viewBuilder.edge(e, view.getEdge(e))); newView = viewBuilder.build(); } } return newView; } }
private static View createView(final Schema schema) { return new View.Builder() .entities(schema.getEntityGroups()) .edges(schema.getEdgeGroups()) .build(); } }
public MapImpl(final Schema schema, final MapStoreProperties mapStoreProperties) { this.schema = schema; propertyAggregator = new AggregatorUtil.IngestPropertiesBinaryOperator(schema); mapFactory = createMapFactory(schema, mapStoreProperties); maintainIndex = mapStoreProperties.getCreateIndex(); for (final String group : schema.getGroups()) { aggElements.put(group, mapFactory.getMap(group + "|" + AGG_ELEMENTS, Element.class, GroupedProperties.class)); nonAggElements.put(group, mapFactory.getMap(group + "|" + NON_AGG_ELEMENTS, Element.class, Long.class)); } if (maintainIndex) { entityIdToElements = mapFactory.getMultiMap(ENTITY_ID_TO_ELEMENTS, EntityId.class, Element.class); edgeIdToElements = mapFactory.getMultiMap(EDGE_ID_TO_ELEMENTS, EdgeId.class, Element.class); } else { entityIdToElements = null; edgeIdToElements = null; } this.aggregatedGroups = schema.getAggregatedGroups(); schema.getEntityGroups().forEach(this::addToGroupByMap); schema.getEdgeGroups().forEach(this::addToGroupByMap); }
private void updateView(final GraphConfig config) { if (null == config.getView()) { config.setView(new View.Builder() .entities(store.getSchema().getEntityGroups()) .edges(store.getSchema().getEdgeGroups()) .build()); } }
if (null == index) { groupToSplitPoints = new HashMap<>(); for (final String group : gafferSchema.getEdgeGroups()) { tasks.add(new CalculateSplitPointsFromIterable(parquetStoreProperties.getSampleRate(), parquetStoreProperties.getAddElementsOutputFilesPerGroup() - 1, input, group, false));
|| !view.getEdgeGroups().equals(schema.getEdgeGroups())) { stream = stream.filter(e -> viewGroups.contains(e.getGroup()));
if (null == index) { groupToSplitPoints = new HashMap<>(); for (final String group : gafferSchema.getEdgeGroups()) { tasks.add(new CalculateSplitPointsFromJavaRDD(parquetStoreProperties.getSampleRate(), parquetStoreProperties.getAddElementsOutputFilesPerGroup() - 1, input, group, false));
private static void updateOperationChainViews(final Operations<?> operations, final Schema schema) { for (final Operation operation : operations.getOperations()) { if (operation instanceof Operations) { updateOperationChainViews((Operations) operation, schema); } else if (operation instanceof OperationView) { View opView = ((OperationView) operation).getView(); if (null == opView) { opView = createView(schema); } else if (!(opView instanceof NamedView) && !opView.hasGroups() && !opView.isAllEdges() && !opView.isAllEntities()) { opView = new View.Builder() .merge(createView(schema)) .merge(opView) .build(); } else if (opView.isAllEdges() || opView.isAllEntities()) { View.Builder opViewBuilder = new View.Builder() .merge(opView); if (opView.isAllEdges()) { opViewBuilder.edges(schema.getEdgeGroups()); } if (opView.isAllEntities()) { opViewBuilder.entities(schema.getEntityGroups()); } opView = opViewBuilder.build(); } opView.expandGlobalDefinitions(); ((OperationView) operation).setView(opView); } } }
private void updateOperationChainView(final Operations<?> operations) { for (final Operation operation : operations.getOperations()) { if (operation instanceof Operations) { updateOperationChainView((Operations) operation); } else if (operation instanceof OperationView) { View opView = ((OperationView) operation).getView(); if (null == opView) { opView = config.getView(); } else if (!(opView instanceof NamedView) && !opView.hasGroups() && !opView.isAllEdges() && !opView.isAllEntities()) { opView = new View.Builder() .merge(config.getView()) .merge(opView) .build(); } else if (opView.isAllEdges() || opView.isAllEntities()) { View.Builder opViewBuilder = new View.Builder() .merge(opView); if (opView.isAllEdges()) { opViewBuilder.edges(getSchema().getEdgeGroups()); } if (opView.isAllEntities()) { opViewBuilder.entities(getSchema().getEntityGroups()); } opView = opViewBuilder.build(); } opView.expandGlobalDefinitions(); ((OperationView) operation).setView(opView); } } }