if (null == addElements.getInput()) { if (!addElements.isValidate() || !addElements.isSkipInvalidElements()) { LOGGER.debug("Invalid elements will be skipped when added to {}", graph.getGraphId()); resultOp = (OP) addElements.shallowClone(); ((AddElements) resultOp).setValidate(true); ((AddElements) resultOp).setSkipInvalidElements(true); resultOp = (OP) addElements.shallowClone(); final Set<String> graphGroups = graph.getSchema().getGroups(); final Iterable<? extends Element> filteredInput = Iterables.filter( addElements.getInput(), element -> graphGroups.contains(null != element ? element.getGroup() : null) ); ((AddElements) resultOp).setInput(filteredInput);
.input(data) .build()) .then(new AddElements()) .build();
@Override public Void doOperation(final AddElements addElements, final Context context, final Store store) throws OperationException { Iterable<? extends Element> elements = addElements.getInput(); if (addElements.isValidate()) { elements = new ValidatedElements(elements, store.getSchema(), addElements.isSkipInvalidElements()); } addElements(elements, (MapStore) store); return null; }
final Iterable<? extends Element> input = addElementsOperation.getInput(); final ExecutorService pool = createThreadPool(spark, parquetStoreProperties); final List<Callable<Tuple2<String, Map<Object, Integer>>>> tasks = new ArrayList<>();
private void addElements(final AddElements operation, final AccumuloStore store) throws OperationException { try { final Iterable<?extends Element> validatedElements; if (operation.isValidate()) { validatedElements = new ValidatedElements(operation.getInput(), store.getSchema(), operation.isSkipInvalidElements()); } else { validatedElements = operation.getInput(); } store.addElements(validatedElements); } catch (final StoreException e) { throw new OperationException("Failed to add elements", e); } } }
protected Graph createExampleGraph() { final Graph graph = new Graph.Builder() .addSchemas(StreamUtil.openStreams(getClass(), "/example/operation/schema")) .storeProperties(StreamUtil.openStream(getClass(), "/example/operation/mockaccumulostore.properties")) .build(); // Create data generator final DataGenerator dataGenerator = new DataGenerator(); // Load data into memory final List<String> data = DataUtils.loadData(StreamUtil.openStream(getClass(), "/example/operation/data.txt", true)); //add the edges to the graph using an operation chain consisting of: //generateElements - generating edges from the data (note these are directed edges) //addElements - add the edges to the graph final OperationChain addOpChain = new OperationChain.Builder() .first(new GenerateElements.Builder<String>() .generator(dataGenerator) .objects(data) .build()) .then(new AddElements()) .build(); try { graph.execute(addOpChain, new User()); } catch (OperationException e) { throw new RuntimeException(e); } return graph; }
.objects(dummyData) .build()) .then(new AddElements()) .build();
.input(dummyData) .build()) .then(new AddElements()) .build();
.input(dummyData) .build()) .then(new AddElements()) .build();
.objects(dummyData) .build()) .then(new AddElements()) .build(); graph.execute(addOpChain, user);
.objects(dummyData) .build()) .then(new AddElements()) .build();
.input(IOUtils.readLines(StreamUtil.openStream(getClass(), "RoadAndRoadUse/data.txt"))) .build()) .then(new AddElements()) .build();
.input(dummyData) .build()) .then(new AddElements()) .build();
.objects(dummyData) .build()) .then(new AddElements()) .build();
.input(IOUtils.readLines(StreamUtil.openStream(getClass(), "RoadAndRoadUseWithTimesAndCardinalities/data.txt"))) .build()) .then(new AddElements()) .build();
.input(dummyData) .build()) .then(new AddElements()) .build();
.input(IOUtils.readLines(StreamUtil.openStream(getClass(), "RoadAndRoadUseWithTimesAndCardinalities/data.txt"))) .build()) .then(new AddElements()) .build();
.input(dummyData) .build()) .then(new AddElements()) .build();
.input(IOUtils.readLines(StreamUtil.openStream(getClass(), "RoadAndRoadUseWithTimesAndCardinalities/data.txt"))) .build()) .then(new AddElements()) .build();
.input(IOUtils.readLines(StreamUtil.openStream(getClass(), "RoadAndRoadUseWithSecurity/data.txt"))) .build()) .then(new AddElements()) .build();