Search in sources :

Example 1 with BoundedTimestampSetElementGenerator

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;
}
Also used : AddElements(uk.gov.gchq.gaffer.operation.impl.add.AddElements) User(uk.gov.gchq.gaffer.user.User) Element(uk.gov.gchq.gaffer.data.element.Element) BoundedTimestampSetElementGenerator(uk.gov.gchq.gaffer.doc.properties.generator.BoundedTimestampSetElementGenerator) Graph(uk.gov.gchq.gaffer.graph.Graph) OperationChain(uk.gov.gchq.gaffer.operation.OperationChain) GetAllElements(uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)

Aggregations

Element (uk.gov.gchq.gaffer.data.element.Element)1 BoundedTimestampSetElementGenerator (uk.gov.gchq.gaffer.doc.properties.generator.BoundedTimestampSetElementGenerator)1 Graph (uk.gov.gchq.gaffer.graph.Graph)1 OperationChain (uk.gov.gchq.gaffer.operation.OperationChain)1 AddElements (uk.gov.gchq.gaffer.operation.impl.add.AddElements)1 GetAllElements (uk.gov.gchq.gaffer.operation.impl.get.GetAllElements)1 User (uk.gov.gchq.gaffer.user.User)1