code: private String getTopLevelCorpusFromTmpArea()
    {
      String sql = "SELECT name FROM " + tableInStagingArea("corpus")
        + " WHERE type='CORPUS'\n"
        + "AND pre = (SELECT min(pre) FROM " + tableInStagingArea("corpus")
        + ")\n"
        + "AND post = (SELECT max(post) FROM " + tableInStagingArea("corpus")
        + ")";
  
      return getJdbcTemplate().query(sql, new ResultSetExtractor<String>()
      {
        @Override
        public String extractData(ResultSet rs) throws SQLException,
          DataAccessException
        {
          if (rs.next())
          {
            return rs.getString("name");
          }
          else
          {
            return null;
          }
        }
      });
    }
docs: Retrieves the name of the top level corpus in the corpus.tab file.
  
  <p>
  At this point, the tab files must be in the staging area.</p>
  
  @return The name of the toplevel corpus or an empty String if no top level
  corpus is found.