.edge("red") .build()) .build(); final CloseableIterable<? extends Element> allEdges = graph.execute(getAllEdges, user);
public void simpleExportWithCustomGraph() { // --------------------------------------------------------- final Schema schema = Schema.fromJson(StreamUtil.openStreams(getClass(), "operation/schema")); final StoreProperties storeProperties = StoreProperties.loadStoreProperties(StreamUtil.openStream(getClass(), "othermockaccumulostore.properties")); final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetAllElements.Builder() .view(new View.Builder() .edge("edge") .build()) .build()) .then(new ExportToOtherGraph.Builder() .graphId("newGraphId") .schema(schema) .storeProperties(storeProperties) .build()) .build(); // --------------------------------------------------------- showExample(opChain, "This example will export all Edges with group 'edge' to another Gaffer graph with new ID 'newGraphId'. " + "The new graph will have the custom provided schema (note it must contain the same Edge group 'edge' otherwise the exported edges will be invalid') and custom store properties. " + "The store properties could be any store properties e.g. Accumulo, HBase, Map, Proxy store properties."); }
.edge("edge") .build()) .build()) .then(new ExportToOtherGraph.Builder() .graphId("exportGraphId")
.entity("size") .build()) .build(); final CloseableIterable<? extends Element> entities = graph.execute(get, user); for (final Element entity : entities) { .entity("size") .build()) .build(); final CloseableIterable<? extends Element> allEntities2 = graph.execute(getAllEntities2, user); final CloseableIterator<? extends Element> it = allEntities2.iterator(); .build(); final CloseableIterable<? extends Element> allEntities = graph.execute(getAllEntities, user); final Element entity = allEntities.iterator().next();
.edge("edge") .build()) .build()) .then(new ExportToOtherGraph.Builder() .graphId("newGraphId")
public void simpleToOtherGafferRestApi() { // --------------------------------------------------------- final ProxyProperties proxyProperties = new ProxyProperties(); proxyProperties.setStoreClass(ProxyStore.class); proxyProperties.setStorePropertiesClass(ProxyProperties.class); proxyProperties.setGafferHost("localhost"); proxyProperties.setGafferPort(8081); proxyProperties.setGafferContextRoot("/rest/v1"); final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetAllElements.Builder() .view(new View.Builder() .edge("edge") .build()) .build()) .then(new ExportToOtherGraph.Builder() .graphId("otherGafferRestApiGraphId") .storeProperties(proxyProperties) .build()) .build(); // --------------------------------------------------------- showExample(opChain, "This example will export all Edges with group 'edge' to another Gaffer REST API." + "To export to another Gaffer REST API, we go via a Gaffer Proxy Store. We just need to tell the proxy store the host, port and context root of the REST API." + "Note that you will need to include the proxy-store module as a maven dependency to do this."); }
public CloseableIterable<? extends Element> getAllElementsWithCountGreaterThan2() { // --------------------------------------------------------- final GetAllElements operation = new GetAllElements.Builder() .view(new View.Builder() .entity("entity", new ViewElementDefinition.Builder() .preAggregationFilter(new ElementFilter.Builder() .select("count") .execute(new IsMoreThan(2)) .build()) .build()) .edge("edge", new ViewElementDefinition.Builder() .preAggregationFilter(new ElementFilter.Builder() .select("count") .execute(new IsMoreThan(2)) .build()) .build()) .build()) .build(); // --------------------------------------------------------- return runExample(operation, null); } }
public void exportToNewGraphUsingPreconfiguredSchemaAndProperties() { // --------------------------------------------------------- final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetAllElements.Builder() .view(new View.Builder() .edge("edge") .build()) .build()) .then(new ExportToOtherAuthorisedGraph.Builder() .graphId("newGraphId") .parentStorePropertiesId("storePropsId1") .parentSchemaIds("schemaId1") .build()) .build(); // --------------------------------------------------------- showExample(opChain, "This example will export all Edges with group 'edge' to another Gaffer graph with new ID 'newGraphId'. " + "The new graph will have a parent Schema and Store Properties within the graph library specifed by the ID's schemaId1 and storePropsId1. " + "In order to export to newGraphId with storePropsId1 and schemaId1 the user must have the required user authorisations that were configured for this operation to use each of these 3 ids."); } }
public CloseableIterable<Element> getAllElementsWithCountGreaterThan2() { // --------------------------------------------------------- final GetAllElements<Element> operation = new GetAllElements.Builder<>() .view(new View.Builder() .entity("entity", new ViewElementDefinition.Builder() .preAggregationFilter(new ElementFilter.Builder() .select("count") .execute(new IsMoreThan(2)) .build()) .build()) .edge("edge", new ViewElementDefinition.Builder() .preAggregationFilter(new ElementFilter.Builder() .select("count") .execute(new IsMoreThan(2)) .build()) .build()) .build()) .build(); // --------------------------------------------------------- return runExample(operation); } }
public void exportToPreconfiguredGraph() { // --------------------------------------------------------- final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetAllElements.Builder() .view(new View.Builder() .edge("edge") .build()) .build()) .then(new ExportToOtherAuthorisedGraph.Builder() .graphId("graph2") .build()) .build(); // --------------------------------------------------------- showExample(opChain, "This example will export all Edges with group 'edge' to another Gaffer graph with ID 'graph2'. " + "The graph will be loaded from the configured GraphLibrary, so it must already exist. " + "In order to export to graph2 the user must have the required user authorisations that were configured for this operation."); }
public void simpleExport() { // --------------------------------------------------------- final OperationChain<Iterable<? extends Element>> opChain = new OperationChain.Builder() .first(new GetAllElements.Builder() .view(new View.Builder() .edge("edge") .build()) .build()) .then(new ExportToOtherGraph.Builder() .graphId("newGraphId") .build()) .build(); // --------------------------------------------------------- showExample(opChain, "This example will export all Edges with group 'edge' to another Gaffer graph with new ID 'newGraphId'. " + "The new graph will have the same schema and same store properties as the current graph. " + "In this case it will just create another table in accumulo called 'newGraphId'."); }
private GetAllElements getGetAllElements(final OP getRDDOfAllElements) { return new GetAllElements.Builder() .view(getRDDOfAllElements.getView()) .directedType(getRDDOfAllElements.getDirectedType()) .options(getRDDOfAllElements.getOptions()) .build(); }
public Iterable<Element> limitElementsTo3() { // --------------------------------------------------------- final GetAllElements<Element> operation = new GetAllElements.Builder<>() .limitResults(3) .build(); // --------------------------------------------------------- return runExample(operation); }