@Override
    public boolean nextKeyValue() throws IOException {
        while (true) {
            if (!this.lineRecordReader.nextKeyValue()) return false;
            try {
                final Bindings bindings = this.engine.createBindings();
                final StarGraph graph = StarGraph.open();
                bindings.put(GRAPH, graph);
                bindings.put(LINE, this.lineRecordReader.getCurrentValue().toString());
                final StarGraph.StarVertex sv = (StarGraph.StarVertex) script.eval(bindings);
                if (sv != null) {
                    final Optional<StarGraph.StarVertex> vertex = sv.applyGraphFilter(this.graphFilter);
                    if (vertex.isPresent()) {
                        this.vertexWritable.set(vertex.get());
                        return true;
                    }
                }
            } catch (final ScriptException e) {
                throw new IOException(e.getMessage());
            }
        }
    }
@author Daniel Kuppitz (http://gremlin.guru)
@author Marko A. Rodriguez (http://markorodriguez.com)
hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/script/ScriptRecordReader.java