@Test public void testExecute() throws Exception { GradoopId vertex1Id = GradoopId.get(); Map<String, Object> vertex1Props = new HashMap<>(); vertex1Props.put("foo", 23); GradoopId vertex2Id = GradoopId.get(); Map<String, Object> vertex2Props = new HashMap<>(); vertex2Props.put("foo", 42); EPGMVertex vertex1 = new EPGMVertex(vertex1Id, "A", Properties.createFromMap(vertex1Props), new GradoopIdSet()); EPGMVertex vertex2 = new EPGMVertex(vertex2Id, "B", Properties.createFromMap(vertex2Props), new GradoopIdSet()); DataSet<EPGMVertex> vertices = getExecutionEnvironment().fromElements(vertex1, vertex2); String query = "MATCH (n) WHERE n.foo = 23"; QueryHandler queryHandler = new QueryHandler(query); CNF filterPredicate = queryHandler.getPredicates().getSubCNF(Sets.newHashSet("n")); Set<String> projectionKeys = queryHandler.getPredicates().getPropertyKeys("n"); FilterAndProjectVerticesNode node = new FilterAndProjectVerticesNode( vertices, "n", filterPredicate, projectionKeys); List<Embedding> filteredVertices = node.execute().collect(); assertThat(filteredVertices.size(), is(1)); assertThat(filteredVertices.get(0).getId(0).equals(vertex1Id), is(true)); }
@Override public DataSet<Embedding> execute() { FilterAndProjectVertices<V> op = new FilterAndProjectVertices<>(vertices, filterPredicate, projectionKeys); op.setName(toString()); return op.evaluate(); }
FilterAndProjectVerticesNode extends LeafNode implements FilterNode, ProjectionNode { @Override public DataSet<Embedding> execute() { FilterAndProjectVertices<V> op = new FilterAndProjectVertices<>(vertices, filterPredicate, projectionKeys); op.setName(toString()); return op.evaluate(); } }
FilterAndProjectVerticesNode extends LeafNode implements FilterNode, ProjectionNode { @Override public DataSet<Embedding> execute() { FilterAndProjectVertices<V> op = new FilterAndProjectVertices<>(vertices, filterPredicate, projectionKeys); op.setName(toString()); return op.evaluate(); } FilterAndProjectVerticesNode(DataSet<V> vertices, String vertexVariable,
    CNF filterPredicate, Set<String> projectionKeys); }
FilterAndProjectVerticesNode extends LeafNode implements FilterNode, ProjectionNode { @Override public DataSet<Embedding> execute() { FilterAndProjectVertices<V> op = new FilterAndProjectVertices<>(vertices, filterPredicate, projectionKeys); op.setName(toString()); return op.evaluate(); } FilterAndProjectVerticesNode(DataSet<V> vertices, String vertexVariable,
    CNF filterPredicate, Set<String> projectionKeys); @Override DataSet<Embedding> execute(); CNF getFilterPredicate(); List<String> getProjectionKeys(); @Override String toString(); }
FilterAndProjectVerticesNode extends LeafNode implements FilterNode, ProjectionNode { @Override public DataSet<Embedding> execute() { FilterAndProjectVertices<V> op = new FilterAndProjectVertices<>(vertices, filterPredicate, projectionKeys); op.setName(toString()); return op.evaluate(); } FilterAndProjectVerticesNode(DataSet<V> vertices, String vertexVariable,
    CNF filterPredicate, Set<String> projectionKeys); @Override DataSet<Embedding> execute(); CNF getFilterPredicate(); List<String> getProjectionKeys(); @Override String toString();  }