idToEdgeName.get(e.getId()), e.getLabel(), propertiesToGDLString(e.getProperties()), idToVertexName.get(e.getTargetId())); } else {
idToEdgeName.get(e.getId()), e.getLabel(), propertiesToGDLString(e.getProperties()), idToVertexName.get(e.getTargetId())); } else {
/** * find all edges by property equality * * @throws Throwable if error */ @Test public void edgePropEquals() throws Throwable { doTest(TEST02, (loader, store, config) -> { List<Edge> inputVertices = loader.getEdges().stream() .filter(it -> { assert it.getProperties() != null; return it.getProperties().get("since") != null && Objects.equals(it.getProperties() .get("since") .getInt(), 2014); }) .collect(Collectors.toList()); List<Edge> query = store .getEdgeSpace( Query.elements() .fromAll() .where(AccumuloFilters.propEquals("since", 2014))) .readRemainsAndClose(); GradoopTestUtils.validateEPGMElementCollections(inputVertices, query); }); }
/** * find all edges by property value compare * * @throws Throwable if error */ @Test public void propLargerThan() throws Throwable { doTest(TEST04, (loader, store, config) -> { List<Edge> inputVertices = loader.getEdges().stream() .filter(it -> { assert it.getProperties() != null; return it.getProperties().get("since") != null && it.getProperties().get("since").isInt() && it.getProperties() .get("since") .getInt() >= 2014; }) .collect(Collectors.toList()); List<Edge> query = store .getEdgeSpace( Query.elements() .fromAll() .where(AccumuloFilters .propLargerThan("since", 2014, true))) .readRemainsAndClose(); GradoopTestUtils.validateEPGMElementCollections(inputVertices, query); }); }
@Test public void queryEdgeByProperty() throws Throwable { doTest(TEST01, (loader, store, config) -> { List<Edge> storeEdges = loader.getEdges().stream() .filter(it -> { assert it.getProperties() != null; return it.getProperties().get("since") != null && Objects.equals(it.getProperties() .get("since") .getInt(), 2013); }) .collect(Collectors.toList()); AccumuloDataSource source = new AccumuloDataSource( store, GradoopFlinkConfig.createConfig(getExecutionEnvironment())); List<Edge> query = source.applyEdgePredicate( Query.elements() .fromAll() .where(AccumuloFilters.propEquals("since", 2013))) .getGraphCollection() .getEdges() .collect(); GradoopTestUtils.validateEPGMElementCollections(storeEdges, query); }); }
@Override public void join(Edge edge, Vertex vertex, Collector<Edge> collector) throws Exception { if (vertex == null) { collector.collect(edge); } else if (edge != null) { REUSABLE_EDGE.setId(GradoopId.get()); REUSABLE_EDGE.setSourceId(isSourceNow ? vId : edge.getSourceId()); REUSABLE_EDGE.setTargetId(isSourceNow ? edge.getTargetId() : vId); REUSABLE_EDGE.setProperties(edge.getProperties()); REUSABLE_EDGE.setLabel(edge.getLabel()); REUSABLE_EDGE.setGraphIds(edge.getGraphIds()); collector.collect(REUSABLE_EDGE); } } }
@Override public void join(Edge edge, Vertex vertex, Collector<Edge> collector) throws Exception { if (vertex == null) { collector.collect(edge); } else if (edge != null) { REUSABLE_EDGE.setId(GradoopId.get()); REUSABLE_EDGE.setSourceId(isSourceNow ? vId : edge.getSourceId()); REUSABLE_EDGE.setTargetId(isSourceNow ? edge.getTargetId() : vId); REUSABLE_EDGE.setProperties(edge.getProperties()); REUSABLE_EDGE.setLabel(edge.getLabel()); REUSABLE_EDGE.setGraphIds(edge.getGraphIds()); collector.collect(REUSABLE_EDGE); } } }