code: @Override
      public int getTupleCount(InputQuery inputQuery) throws OntopReformulationException, OntopQueryEvaluationException {
          SQLExecutableQuery targetQuery = checkAndConvertTargetQuery(getExecutableQuery(inputQuery));
          String sql = targetQuery.getSQL();
          String newsql = "SELECT count(*) FROM (" + sql + ") t1";
          if (!isCanceled()) {
              try {
  
                  java.sql.ResultSet set = sqlStatement.executeQuery(newsql);
                  if (set.next()) {
                      return set.getInt(1);
                  } else {
                      //throw new OBDAException("Tuple count failed due to empty result set.");
                      return 0;
                  }
              } catch (SQLException e) {
                  throw new OntopQueryEvaluationException(e);
              }
          }
          else {
              throw new OntopQueryEvaluationException("Action canceled.");
          }
      }
docs: Returns the number of tuples returned by the query