code: @GET
    @Produces("text/plain;charset=UTF-8")
    @Path("hasNext")
    public String hasNext() {
      logger.debug("Received hasNext");
      JSONObject resultJson = new JSONObject();
      try {
        if (machine.hasNextStep()) {
          resultJson.put("hasNext", "true").toString();
        } else {
          resultJson.put("hasNext", "false").toString();
        }
        resultJson.put("result", "ok");
      } catch (Exception e) {
        resultJson.put("result", "nok");
        resultJson.put("error", e.getMessage());
      }
      return resultJson.toString();
    }
docs: Returns the next step (element) to be executed on the model. An element can
  be either a vertex or an edge,
  
  @return The label of the next step as a plain or a JSON formatted string. If the label is empty or
  non-existent, the label of the step is an empty string.