Search in sources :

Example 1 with RoadTrafficStringElementGenerator

use of uk.gov.gchq.gaffer.traffic.generator.RoadTrafficStringElementGenerator in project Gaffer by gchq.

the class Queries method createGraph.

private Graph createGraph(final User user) throws IOException, OperationException {
    final Graph graph = new Builder().config(new GraphConfig.Builder().graphId("roadTraffic").build()).addSchemas(StreamUtil.openStreams(ElementGroup.class, "schema")).storeProperties(StreamUtil.openStream(getClass(), "accumulo/store.properties")).build();
    final OperationChain<Void> populateChain = new OperationChain.Builder().first(new GenerateElements.Builder<String>().input(IOUtils.readLines(StreamUtil.openStream(getClass(), "roadTrafficSampleData.csv"))).generator(new RoadTrafficStringElementGenerator()).build()).then(new AddElements.Builder().skipInvalidElements(false).build()).build();
    graph.execute(populateChain, user);
    return graph;
}
Also used : Graph(uk.gov.gchq.gaffer.graph.Graph) Builder(uk.gov.gchq.gaffer.graph.Graph.Builder) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) RoadTrafficStringElementGenerator(uk.gov.gchq.gaffer.traffic.generator.RoadTrafficStringElementGenerator)

Aggregations

Graph (uk.gov.gchq.gaffer.graph.Graph)1 Builder (uk.gov.gchq.gaffer.graph.Graph.Builder)1 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)1 RoadTrafficStringElementGenerator (uk.gov.gchq.gaffer.traffic.generator.RoadTrafficStringElementGenerator)1