use of uk.gov.gchq.gaffer.doc.properties.generator.BoundedTimestampSetElementGenerator in project gaffer-doc by gchq.
the class BoundedTimestampSetWalkthrough method run.
@Override
public CloseableIterable<? extends Element> run() throws OperationException {
// / [graph] create a graph using our schema and store properties
// ---------------------------------------------------------
final Graph graph = new Graph.Builder().config(getDefaultGraphConfig()).addSchemas(StreamUtil.openStreams(getClass(), schemaPath)).storeProperties(getDefaultStoreProperties()).build();
// ---------------------------------------------------------
// [user] Create a user
// ---------------------------------------------------------
final User user = new User("user01");
// ---------------------------------------------------------
// [add] addElements - add the edges to the graph
// ---------------------------------------------------------
final Set<String> dummyData = Collections.singleton("");
final OperationChain<Void> addOpChain = new OperationChain.Builder().first(new GenerateElements.Builder<String>().generator(new BoundedTimestampSetElementGenerator()).input(dummyData).build()).then(new AddElements()).build();
graph.execute(addOpChain, user);
// ---------------------------------------------------------
print("Added an edge A-B 3 times, each time with a BoundedTimestampSet containing a random time in 2017.");
// [get] Get all edges
// ---------------------------------------------------------
CloseableIterable<? extends Element> allEdges = graph.execute(new GetAllElements(), user);
// ---------------------------------------------------------
print("\nAll edges:");
for (final Element edge : allEdges) {
print("GET_ALL_EDGES_RESULT", edge.toString());
}
return null;
}
Aggregations